From dbacd5e70f76a7f3a847b1ace057d2792112e10a Mon Sep 17 00:00:00 2001 From: Venkateswara Swamy Bandaru Date: Tue, 7 Aug 2018 13:01:50 +0530 Subject: [PATCH] qcacmn: Add hif support for qca8074v2 Add new target type for qca8074v2 and extend target type checks of QCA8074 for QCA8074V2. Change-Id: Ib3ff4505e2057fc843b492b9720004dcac042a65 CRs-Fixed: 2292271 --- hif/inc/hif.h | 1 + hif/inc/hostdef.h | 1 + hif/inc/target_type.h | 3 +++ hif/inc/targetdef.h | 2 ++ hif/src/ath_procfs.c | 22 ++++++++++++---------- hif/src/ce/ce_main.c | 3 +++ hif/src/hif_main.c | 14 ++++++++++---- hif/src/hif_main.h | 1 + hif/src/pcie/if_pci.c | 11 +++++++---- hif/src/regtable.c | 12 +++++++++++- hif/src/snoc/if_ahb.c | 9 ++++++--- 11 files changed, 57 insertions(+), 22 deletions(-) diff --git a/hif/inc/hif.h b/hif/inc/hif.h index 296c835cc1ed..fb6c415021b3 100644 --- a/hif/inc/hif.h +++ b/hif/inc/hif.h @@ -60,6 +60,7 @@ typedef void *hif_handle_t; #define HIF_TYPE_QCA6290 16 #define HIF_TYPE_QCN7605 17 #define HIF_TYPE_QCA6390 18 +#define HIF_TYPE_QCA8074V2 19 #ifdef IPA_OFFLOAD #define DMA_COHERENT_MASK_IPA_VER_3_AND_ABOVE 37 diff --git a/hif/inc/hostdef.h b/hif/inc/hostdef.h index 6a0c868735e5..270d70f6d926 100644 --- a/hif/inc/hostdef.h +++ b/hif/inc/hostdef.h @@ -39,5 +39,6 @@ extern struct hostdef_s *QCA6390_HOSTdef; extern struct hostdef_s *IPQ4019_HOSTdef; #endif extern struct hostdef_s *QCA8074_HOSTdef; +extern struct hostdef_s *QCA8074V2_HOSTDEF; #endif diff --git a/hif/inc/target_type.h b/hif/inc/target_type.h index ab598a3557f5..e268cf1528de 100644 --- a/hif/inc/target_type.h +++ b/hif/inc/target_type.h @@ -67,6 +67,9 @@ extern "C" { #ifndef TARGET_TYPE_QCA6390 #define TARGET_TYPE_QCA6390 23 #endif +#ifndef TARGET_TYPE_QCA8074V2 +#define TARGET_TYPE_QCA8074V2 24 +#endif #ifdef __cplusplus } diff --git a/hif/inc/targetdef.h b/hif/inc/targetdef.h index 283ae3b1bc70..b48d28d93a90 100644 --- a/hif/inc/targetdef.h +++ b/hif/inc/targetdef.h @@ -39,6 +39,7 @@ extern struct targetdef_s *QCA6390_TARGETdef; extern struct targetdef_s *IPQ4019_TARGETdef; #endif extern struct targetdef_s *QCA8074_TARGETdef; +extern struct targetdef_s *QCA8074V2_TARGETDEF; extern struct ce_reg_def *AR6002_CE_TARGETdef; extern struct ce_reg_def *AR6003_CE_TARGETdef; @@ -55,6 +56,7 @@ extern struct ce_reg_def *QCA6390_CE_TARGETdef; extern struct ce_reg_def *IPQ4019_CE_TARGETdef; #endif extern struct ce_reg_def *QCA8074_CE_TARGETdef; +extern struct ce_reg_def *QCA8074V2_CE_TARGETDEF; #endif diff --git a/hif/src/ath_procfs.c b/hif/src/ath_procfs.c index 075010807f3e..bf94f48f8f1a 100644 --- a/hif/src/ath_procfs.c +++ b/hif/src/ath_procfs.c @@ -81,11 +81,12 @@ static ssize_t ath_procfs_diag_read(struct file *file, char __user *buf, read_buffer, count, (int)*pos, buf); tgt_info = hif_get_target_info_handle(GET_HIF_OPAQUE_HDL(hif_hdl)); - if (scn->bus_type == QDF_BUS_TYPE_SNOC || - (scn->bus_type == QDF_BUS_TYPE_PCI && - (tgt_info->target_type == TARGET_TYPE_QCA6290 || - tgt_info->target_type == TARGET_TYPE_QCA6390 || - tgt_info->target_type == TARGET_TYPE_QCA8074))) { + if ((scn->bus_type == QDF_BUS_TYPE_SNOC) || + (scn->bus_type == QDF_BUS_TYPE_PCI && + ((tgt_info->target_type == TARGET_TYPE_QCA6290) || + (tgt_info->target_type == TARGET_TYPE_QCA6390) || + (tgt_info->target_type == TARGET_TYPE_QCA8074) || + (tgt_info->target_type == TARGET_TYPE_QCA8074V2)))) { memtype = ((uint32_t)(*pos) & 0xff000000) >> 24; offset = (uint32_t)(*pos) & 0xffffff; HIF_TRACE("%s: offset 0x%x memtype 0x%x, datalen %zu\n", @@ -153,11 +154,12 @@ static ssize_t ath_procfs_diag_write(struct file *file, (int)*pos, *((uint32_t *) write_buffer)); tgt_info = hif_get_target_info_handle(GET_HIF_OPAQUE_HDL(hif_hdl)); - if (scn->bus_type == QDF_BUS_TYPE_SNOC || - (scn->bus_type == QDF_BUS_TYPE_PCI && - (tgt_info->target_type == TARGET_TYPE_QCA6290 || - tgt_info->target_type == TARGET_TYPE_QCA6390 || - tgt_info->target_type == TARGET_TYPE_QCA8074))) { + if ((scn->bus_type == QDF_BUS_TYPE_SNOC) || + ((scn->bus_type == QDF_BUS_TYPE_PCI) && + ((tgt_info->target_type == TARGET_TYPE_QCA6290) || + (tgt_info->target_type == TARGET_TYPE_QCA6390) || + (tgt_info->target_type == TARGET_TYPE_QCA8074) || + (tgt_info->target_type == TARGET_TYPE_QCA8074V2)))) { memtype = ((uint32_t)(*pos) & 0xff000000) >> 24; offset = (uint32_t)(*pos) & 0xffffff; HIF_TRACE("%s: offset 0x%x memtype 0x%x, datalen %zu\n", diff --git a/hif/src/ce/ce_main.c b/hif/src/ce/ce_main.c index 809577990be9..0906aa1bdc5b 100644 --- a/hif/src/ce/ce_main.c +++ b/hif/src/ce/ce_main.c @@ -718,6 +718,7 @@ static void hif_select_service_to_pipe_map(struct hif_softc *scn, sizeof(target_service_to_ce_map_qca6390); break; case TARGET_TYPE_QCA8074: + case TARGET_TYPE_QCA8074V2: *tgt_svc_map_to_use = target_service_to_ce_map_qca8074; *sz_tgt_svc_map_to_use = sizeof(target_service_to_ce_map_qca8074); @@ -902,6 +903,7 @@ bool ce_srng_based(struct hif_softc *scn) switch (tgt_info->target_type) { case TARGET_TYPE_QCA8074: + case TARGET_TYPE_QCA8074V2: case TARGET_TYPE_QCA6290: case TARGET_TYPE_QCA6390: return true; @@ -2803,6 +2805,7 @@ void hif_ce_prepare_config(struct hif_softc *scn) break; case TARGET_TYPE_QCA8074: + case TARGET_TYPE_QCA8074V2: if (scn->bus_type == QDF_BUS_TYPE_PCI) { hif_state->host_ce_config = host_ce_config_wlan_qca8074_pci; diff --git a/hif/src/hif_main.c b/hif/src/hif_main.c index fc2265a065e8..fb9ebde91579 100644 --- a/hif/src/hif_main.c +++ b/hif/src/hif_main.c @@ -800,10 +800,6 @@ int hif_get_device_type(uint32_t device_id, break; case QCA8074_DEVICE_ID: - case RUMIM2M_DEVICE_ID_NODE0: - case RUMIM2M_DEVICE_ID_NODE1: - case RUMIM2M_DEVICE_ID_NODE2: - case RUMIM2M_DEVICE_ID_NODE3: *hif_type = HIF_TYPE_QCA8074; *target_type = TARGET_TYPE_QCA8074; HIF_INFO(" *********** QCA8074 *************\n"); @@ -830,6 +826,16 @@ int hif_get_device_type(uint32_t device_id, HIF_INFO(" *********** QCA6390 *************\n"); break; + case QCA8074V2_DEVICE_ID: + case RUMIM2M_DEVICE_ID_NODE0: + case RUMIM2M_DEVICE_ID_NODE1: + case RUMIM2M_DEVICE_ID_NODE2: + case RUMIM2M_DEVICE_ID_NODE3: + *hif_type = HIF_TYPE_QCA8074V2; + *target_type = TARGET_TYPE_QCA8074V2; + HIF_INFO(" *********** QCA8074V2 *************\n"); + break; + default: HIF_ERROR("%s: Unsupported device ID = 0x%x!", __func__, device_id); diff --git a/hif/src/hif_main.h b/hif/src/hif_main.h index 638813cb001a..4bfde09b43cc 100644 --- a/hif/src/hif_main.h +++ b/hif/src/hif_main.h @@ -94,6 +94,7 @@ actual number once available. currently defining this to 0xffff for emulation purpose */ +#define QCA8074V2_DEVICE_ID (0xfffe) /* Todo: replace this with actual number */ /* Genoa */ #define QCN7605_COMPOSITE (0x9900) #define QCN7605_STANDALONE (0x9901) diff --git a/hif/src/pcie/if_pci.c b/hif/src/pcie/if_pci.c index 940933a0dde0..4124a3f0231e 100644 --- a/hif/src/pcie/if_pci.c +++ b/hif/src/pcie/if_pci.c @@ -2014,8 +2014,9 @@ int hif_pci_bus_configure(struct hif_softc *hif_sc) } /* todo: consider replacing this with an srng field */ - if ((hif_sc->target_info.target_type == TARGET_TYPE_QCA8074) && - (hif_sc->bus_type == QDF_BUS_TYPE_AHB)) { + if (((hif_sc->target_info.target_type == TARGET_TYPE_QCA8074) || + (hif_sc->target_info.target_type == TARGET_TYPE_QCA8074V2)) && + (hif_sc->bus_type == QDF_BUS_TYPE_AHB)) { hif_sc->per_ce_irq = true; } @@ -2034,8 +2035,9 @@ int hif_pci_bus_configure(struct hif_softc *hif_sc) hif_register_bmi_callbacks(hif_sc); } - if ((hif_sc->target_info.target_type == TARGET_TYPE_QCA8074) && - (hif_sc->bus_type == QDF_BUS_TYPE_PCI)) + if (((hif_sc->target_info.target_type == TARGET_TYPE_QCA8074) || + (hif_sc->target_info.target_type == TARGET_TYPE_QCA8074V2)) && + (hif_sc->bus_type == QDF_BUS_TYPE_PCI)) HIF_INFO_MED("%s: Skip irq config for PCI based 8074 target", __func__); else { @@ -3703,6 +3705,7 @@ int hif_configure_irq(struct hif_softc *scn) ret = hif_ahb_configure_legacy_irq(sc); break; case TARGET_TYPE_QCA8074: + case TARGET_TYPE_QCA8074V2: ret = hif_ahb_configure_irq(sc); break; default: diff --git a/hif/src/regtable.c b/hif/src/regtable.c index 13c1f7e4e1db..3a4e29f95efc 100644 --- a/hif/src/regtable.c +++ b/hif/src/regtable.c @@ -113,6 +113,12 @@ void hif_target_register_tbl_attach(struct hif_softc *scn, u32 target_type) scn->target_ce_def = QCA6290_CE_TARGETdef; break; #endif +#if defined(QCA8074V2_HEADERS_DEF) + case TARGET_TYPE_QCA8074V2: + scn->targetdef = QCA8074V2_TARGETDEF; + scn->target_ce_def = QCA8074V2_CE_TARGETDEF; + break; +#endif #if defined(QCA6390_HEADERS_DEF) case TARGET_TYPE_QCA6390: @@ -194,7 +200,11 @@ void hif_register_tbl_attach(struct hif_softc *scn, u32 hif_type) scn->hostdef = QCA8074_HOSTdef; break; #endif - +#if defined(QCA8074V2_HEADERS_DEF) + case HIF_TYPE_QCA8074V2: + scn->hostdef = QCA8074V2_HOSTDEF; + break; +#endif #if defined(QCA6290_HEADERS_DEF) case HIF_TYPE_QCA6290: scn->hostdef = QCA6290_HOSTdef; diff --git a/hif/src/snoc/if_ahb.c b/hif/src/snoc/if_ahb.c index 0da994ac2a79..5274d9bd4473 100644 --- a/hif/src/snoc/if_ahb.c +++ b/hif/src/snoc/if_ahb.c @@ -436,7 +436,8 @@ void hif_ahb_disable_bus(struct hif_softc *scn) mem_pa_size = memres->end - memres->start + 1; /* Should not be executed on 8074 platform */ - if (tgt_info->target_type != TARGET_TYPE_QCA8074) { + if ((tgt_info->target_type != TARGET_TYPE_QCA8074) && + (tgt_info->target_type != TARGET_TYPE_QCA8074V2)) { hif_ahb_clk_enable_disable(&pdev->dev, 0); hif_ahb_device_reset(scn); @@ -538,7 +539,8 @@ QDF_STATUS hif_ahb_enable_bus(struct hif_softc *ol_sc, hif_target_register_tbl_attach(ol_sc, target_type); /* QCA_WIFI_QCA8074_VP:Should not be executed on 8074 VP platform */ - if (tgt_info->target_type != TARGET_TYPE_QCA8074) { + if ((tgt_info->target_type != TARGET_TYPE_QCA8074) && + (tgt_info->target_type != TARGET_TYPE_QCA8074V2)) { if (hif_ahb_enable_radio(sc, pdev, id) != 0) { HIF_INFO("error in enabling soc\n"); return -EIO; @@ -555,7 +557,8 @@ QDF_STATUS hif_ahb_enable_bus(struct hif_softc *ol_sc, return QDF_STATUS_SUCCESS; err_target_sync: /* QCA_WIFI_QCA8074_VP:Should not be executed on 8074 VP platform */ - if (tgt_info->target_type != TARGET_TYPE_QCA8074) { + if ((tgt_info->target_type != TARGET_TYPE_QCA8074) && + (tgt_info->target_type != TARGET_TYPE_QCA8074V2)) { HIF_INFO("Error: Disabling target\n"); hif_ahb_disable_bus(ol_sc); }