mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-26 06:33:19 -04:00
qcacmn: Make HIF independent of NIC_DEV
NIC_DEV is not needed in hif. Remove it from HIF. Initialize cdf_device global structure in HDD. Change-Id: Iff3e88c269ed0324d18289e23a0369fa6c2b14b0 CRs-Fixed: 967765
This commit is contained in:
parent
644263d323
commit
3f78aa6a1d
6 changed files with 24 additions and 103 deletions
|
|
@ -194,17 +194,6 @@ struct bmi_info {
|
|||
};
|
||||
|
||||
struct ol_softc {
|
||||
/*
|
||||
* handle for code that uses the osdep.h version of OS
|
||||
* abstraction primitives
|
||||
*/
|
||||
struct _NIC_DEV aps_osdev;
|
||||
/*
|
||||
* handle for code that uses cdf version of OS
|
||||
* abstraction primitives
|
||||
*/
|
||||
cdf_device_t cdf_dev;
|
||||
|
||||
struct targetdef_s *targetdef;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -395,35 +395,6 @@ cdf_size_t init_buffer_count(cdf_size_t maxSize)
|
|||
return maxSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* hif_init_cdf_ctx(): hif_init_cdf_ctx
|
||||
* @hif_ctx: hif_ctx
|
||||
*
|
||||
* Return: int
|
||||
*/
|
||||
int hif_init_cdf_ctx(struct hif_softc *scn)
|
||||
{
|
||||
cdf_device_t cdf_ctx = scn->cdf_dev;
|
||||
|
||||
cdf_ctx->drv = &scn->aps_osdev;
|
||||
cdf_ctx->drv_hdl = scn->aps_osdev.bdev;
|
||||
cdf_ctx->dev = scn->aps_osdev.device;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* hif_deinit_cdf_ctx(): hif_deinit_cdf_ctx
|
||||
* @hif_ctx: hif_ctx
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
void hif_deinit_cdf_ctx(struct hif_softc *scn)
|
||||
{
|
||||
if (scn == NULL || !scn->cdf_dev)
|
||||
return;
|
||||
scn->cdf_dev = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* hif_save_htc_htt_config_endpoint():
|
||||
* hif_save_htc_htt_config_endpoint
|
||||
|
|
@ -507,13 +478,11 @@ CDF_STATUS hif_open(cdf_device_t cdf_ctx, enum ath_hal_bus_type bus_type)
|
|||
cdf_mem_zero(scn, bus_context_size);
|
||||
hif_hdl = GET_HIF_OPAQUE_HDL(scn);
|
||||
scn->cdf_dev = cdf_ctx;
|
||||
hif_hdl->cdf_dev = cdf_ctx;
|
||||
cfg = hif_get_ini_handle(hif_hdl);
|
||||
cfg->max_no_of_peers = 1;
|
||||
cdf_atomic_init(&scn->active_tasklet_cnt);
|
||||
cdf_atomic_init(&scn->link_suspended);
|
||||
cdf_atomic_init(&scn->tasklet_from_intr);
|
||||
init_waitqueue_head(&scn->aps_osdev.event_queue);
|
||||
scn->linkstate_vote = 0;
|
||||
|
||||
status = hif_bus_open(scn, bus_type);
|
||||
|
|
@ -555,9 +524,6 @@ void hif_init_opaque_handle(struct hif_softc *scn)
|
|||
{
|
||||
struct ol_softc *hif_hdl = GET_HIF_OPAQUE_HDL(scn);
|
||||
|
||||
cdf_mem_copy(&hif_hdl->aps_osdev, &scn->aps_osdev,
|
||||
sizeof(hif_hdl->aps_osdev));
|
||||
hif_hdl->cdf_dev = scn->cdf_dev;
|
||||
hif_hdl->targetdef = scn->targetdef;
|
||||
}
|
||||
|
||||
|
|
@ -599,7 +565,7 @@ CDF_STATUS hif_enable(struct ol_softc *hif_ctx, struct device *dev,
|
|||
|
||||
if (hif_config_ce(scn)) {
|
||||
HIF_ERROR("%s: Target probe failed.", __func__);
|
||||
hif_disable_bus(scn->aps_osdev.bdev);
|
||||
hif_disable_bus(scn);
|
||||
status = CDF_STATUS_E_FAILURE;
|
||||
return status;
|
||||
}
|
||||
|
|
@ -666,8 +632,7 @@ void hif_disable(struct ol_softc *hif_ctx, enum hif_disable_type type)
|
|||
if (ADRASTEA_BU)
|
||||
hif_vote_link_down(hif_ctx);
|
||||
|
||||
if (scn->aps_osdev.bdev)
|
||||
hif_disable_bus(scn->aps_osdev.bdev);
|
||||
hif_disable_bus(scn);
|
||||
|
||||
hif_wlan_disable();
|
||||
|
||||
|
|
|
|||
|
|
@ -117,7 +117,6 @@ struct hif_softc {
|
|||
enum ath_hal_bus_type bus_type;
|
||||
void *ce_id_to_state[CE_COUNT_MAX];
|
||||
cdf_device_t cdf_dev;
|
||||
struct _NIC_DEV aps_osdev;
|
||||
bool hif_init_done;
|
||||
bool request_irq_done;
|
||||
/* Packet statistics */
|
||||
|
|
@ -170,8 +169,6 @@ int hif_get_device_type(uint32_t device_id,
|
|||
uint32_t revision_id,
|
||||
uint32_t *hif_type, uint32_t *target_type);
|
||||
/*These functions are exposed to HDD*/
|
||||
int hif_init_cdf_ctx(struct hif_softc *ol_sc);
|
||||
void hif_deinit_cdf_ctx(struct hif_softc *ol_sc);
|
||||
bool hif_targ_is_awake(struct hif_softc *scn, void *__iomem *mem);
|
||||
void hif_nointrs(struct hif_softc *scn);
|
||||
void hif_bus_close(struct hif_softc *ol_sc);
|
||||
|
|
@ -179,7 +176,7 @@ CDF_STATUS hif_bus_open(struct hif_softc *ol_sc,
|
|||
enum ath_hal_bus_type bus_type);
|
||||
CDF_STATUS hif_enable_bus(struct hif_softc *ol_sc, struct device *dev,
|
||||
void *bdev, const hif_bus_id *bid, enum hif_enable_type type);
|
||||
void hif_disable_bus(void *bdev);
|
||||
void hif_disable_bus(struct hif_softc *scn);
|
||||
void hif_bus_prevent_linkdown(struct hif_softc *scn, bool flag);
|
||||
int hif_bus_get_context_size(void);
|
||||
void hif_read_phy_mem_base(struct hif_softc *scn, cdf_dma_addr_t *bar_value);
|
||||
|
|
|
|||
|
|
@ -250,8 +250,7 @@ inline struct qca_napi_data *hif_napi_get_all(struct ol_softc *hif_ctx)
|
|||
* = 0: NAPI is now disabled
|
||||
* = 1: NAPI is now enabled
|
||||
*/
|
||||
int hif_napi_event(struct ol_softc *hif_ctx,
|
||||
enum qca_napi_event event,
|
||||
int hif_napi_event(struct ol_softc *hif_ctx, enum qca_napi_event event,
|
||||
void *data)
|
||||
{
|
||||
int rc;
|
||||
|
|
|
|||
|
|
@ -1304,10 +1304,6 @@ int hif_enable_pci(struct hif_pci_softc *sc,
|
|||
sc->mem = mem;
|
||||
sc->pdev = pdev;
|
||||
sc->dev = &pdev->dev;
|
||||
ol_sc->aps_osdev.bdev = pdev;
|
||||
ol_sc->aps_osdev.device = &pdev->dev;
|
||||
ol_sc->aps_osdev.bc.bc_handle = (void *)mem;
|
||||
ol_sc->aps_osdev.bc.bc_bustype = HAL_BUS_TYPE_PCI;
|
||||
sc->devid = id->device;
|
||||
sc->cacheline_sz = dma_get_cache_alignment();
|
||||
ol_sc->mem = mem;
|
||||
|
|
@ -1628,11 +1624,10 @@ void hif_nointrs(struct hif_softc *scn)
|
|||
*
|
||||
* Return: none
|
||||
*/
|
||||
void hif_disable_bus(void *bdev)
|
||||
void hif_disable_bus(struct hif_softc *scn)
|
||||
{
|
||||
struct pci_dev *pdev = bdev;
|
||||
struct hif_pci_softc *sc = pci_get_drvdata(pdev);
|
||||
struct hif_softc *scn;
|
||||
struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(scn);
|
||||
struct pci_dev *pdev = sc->pdev;
|
||||
void __iomem *mem;
|
||||
|
||||
/* Attach did not succeed, all resources have been
|
||||
|
|
@ -1641,8 +1636,6 @@ void hif_disable_bus(void *bdev)
|
|||
if (!sc)
|
||||
return;
|
||||
|
||||
scn = HIF_GET_SOFTC(sc);
|
||||
|
||||
if (ADRASTEA_BU) {
|
||||
hif_write32_mb(sc->mem + PCIE_INTR_ENABLE_ADDRESS, 0);
|
||||
hif_write32_mb(sc->mem + PCIE_INTR_CLR_ADDRESS,
|
||||
|
|
@ -1653,7 +1646,6 @@ void hif_disable_bus(void *bdev)
|
|||
if (mem) {
|
||||
pci_disable_msi(pdev);
|
||||
hif_dump_pipe_debug_count(scn);
|
||||
hif_deinit_cdf_ctx(scn);
|
||||
if (scn->athdiag_procfs_inited) {
|
||||
athdiag_procfs_remove();
|
||||
scn->athdiag_procfs_inited = false;
|
||||
|
|
@ -1759,11 +1751,12 @@ static int hif_bus_suspend_link_up(struct hif_softc *scn)
|
|||
{
|
||||
struct pci_dev *pdev;
|
||||
int status;
|
||||
struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(scn);
|
||||
|
||||
if (!scn)
|
||||
if (!sc)
|
||||
return -EFAULT;
|
||||
|
||||
pdev = scn->aps_osdev.bdev;
|
||||
pdev = sc->pdev;
|
||||
|
||||
status = hif_drain_tasklets(scn);
|
||||
if (status != 0)
|
||||
|
|
@ -1787,11 +1780,13 @@ static int hif_bus_suspend_link_up(struct hif_softc *scn)
|
|||
static int hif_bus_resume_link_up(struct hif_softc *scn)
|
||||
{
|
||||
struct pci_dev *pdev;
|
||||
struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(scn);
|
||||
|
||||
if (!scn)
|
||||
if (!sc)
|
||||
return -EFAULT;
|
||||
|
||||
pdev = scn->aps_osdev.bdev;
|
||||
pdev = sc->pdev;
|
||||
|
||||
if (!pdev) {
|
||||
HIF_ERROR("%s: pci_dev is null", __func__);
|
||||
return -EFAULT;
|
||||
|
|
@ -1818,16 +1813,11 @@ static int hif_bus_resume_link_up(struct hif_softc *scn)
|
|||
static int hif_bus_suspend_link_down(struct hif_softc *scn)
|
||||
{
|
||||
struct pci_dev *pdev;
|
||||
struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn);
|
||||
struct ol_softc *hif_hdl = GET_HIF_OPAQUE_HDL(scn);
|
||||
struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(scn);
|
||||
int status = 0;
|
||||
|
||||
if (!hif_state) {
|
||||
HIF_ERROR("%s: hif_state is null", __func__);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
pdev = scn->aps_osdev.bdev;
|
||||
pdev = sc->pdev;
|
||||
|
||||
disable_irq(pdev->irq);
|
||||
|
||||
|
|
@ -1855,11 +1845,13 @@ static int hif_bus_suspend_link_down(struct hif_softc *scn)
|
|||
static int hif_bus_resume_link_down(struct hif_softc *scn)
|
||||
{
|
||||
struct pci_dev *pdev;
|
||||
struct hif_pci_softc *sc = HIF_GET_PCI_SOFTC(scn);
|
||||
|
||||
if (!scn)
|
||||
if (!sc)
|
||||
return -EFAULT;
|
||||
|
||||
pdev = scn->aps_osdev.bdev;
|
||||
pdev = sc->pdev;
|
||||
|
||||
if (!pdev) {
|
||||
HIF_ERROR("%s: pci_dev is null", __func__);
|
||||
return -EFAULT;
|
||||
|
|
@ -2162,10 +2154,10 @@ static void hif_free_msi_ctx(struct hif_softc *scn)
|
|||
{
|
||||
struct hif_pci_softc *sc = scn->hif_sc;
|
||||
struct hif_msi_info *info = &sc->msi_info;
|
||||
struct device *dev = scn->cdf_dev->dev;
|
||||
|
||||
OS_FREE_CONSISTENT(&scn->aps_osdev, 4,
|
||||
info->magic, info->magic_dma,
|
||||
OS_GET_DMA_MEM_CONTEXT(scn, dmacontext));
|
||||
OS_FREE_CONSISTENT(dev, 4, info->magic, info->magic_dma,
|
||||
OS_GET_DMA_MEM_CONTEXT(scn, dmacontext));
|
||||
info->magic = NULL;
|
||||
info->magic_dma = 0;
|
||||
}
|
||||
|
|
@ -2726,10 +2718,6 @@ CDF_STATUS hif_enable_bus(struct hif_softc *ol_sc,
|
|||
|
||||
sc->pdev = pdev;
|
||||
sc->dev = &pdev->dev;
|
||||
ol_sc->aps_osdev.bdev = pdev;
|
||||
ol_sc->aps_osdev.device = &pdev->dev;
|
||||
ol_sc->aps_osdev.bc.bc_handle = (void *)ol_sc->mem;
|
||||
ol_sc->aps_osdev.bc.bc_bustype = type;
|
||||
sc->devid = id->device;
|
||||
sc->cacheline_sz = dma_get_cache_alignment();
|
||||
tgt_info = hif_get_target_info_handle(hif_hdl);
|
||||
|
|
@ -2786,17 +2774,10 @@ again:
|
|||
BUG_ON(pci_get_drvdata(sc->pdev) != NULL);
|
||||
pci_set_drvdata(sc->pdev, sc);
|
||||
|
||||
ret = hif_init_cdf_ctx(ol_sc);
|
||||
if (ret != 0) {
|
||||
HIF_ERROR("%s: cannot init CDF", __func__);
|
||||
goto err_tgtstate;
|
||||
}
|
||||
|
||||
hif_target_sync(ol_sc);
|
||||
return 0;
|
||||
|
||||
err_tgtstate:
|
||||
hif_deinit_cdf_ctx(ol_sc);
|
||||
hif_disable_pci(sc);
|
||||
sc->pci_enabled = false;
|
||||
HIF_ERROR("%s: error, hif_disable_pci done", __func__);
|
||||
|
|
|
|||
|
|
@ -267,10 +267,6 @@ CDF_STATUS hif_enable_bus(struct hif_softc *ol_sc,
|
|||
return CDF_STATUS_E_NOMEM;
|
||||
}
|
||||
|
||||
ol_sc->aps_osdev.device = dev;
|
||||
ol_sc->aps_osdev.bc.bc_handle = (void *)ol_sc->mem;
|
||||
ol_sc->aps_osdev.bc.bc_bustype = type;
|
||||
|
||||
ret = hif_get_target_type(ol_sc, dev, bdev, bid,
|
||||
&hif_type, &target_type);
|
||||
if (ret < 0) {
|
||||
|
|
@ -284,12 +280,6 @@ CDF_STATUS hif_enable_bus(struct hif_softc *ol_sc,
|
|||
HIF_TRACE("%s: X - hif_type = 0x%x, target_type = 0x%x",
|
||||
__func__, hif_type, target_type);
|
||||
|
||||
ret = hif_init_cdf_ctx(ol_sc);
|
||||
if (ret != 0) {
|
||||
HIF_ERROR("%s: cannot init CDF", __func__);
|
||||
return CDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
return CDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
@ -302,7 +292,7 @@ CDF_STATUS hif_enable_bus(struct hif_softc *ol_sc,
|
|||
*
|
||||
* Return: none
|
||||
*/
|
||||
void hif_disable_bus(void *bdev)
|
||||
void hif_disable_bus(struct hif_softc *scn)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue