From 04a752e8756ed47647e2726bc7e13f6577602468 Mon Sep 17 00:00:00 2001 From: Kannan Saravanan Date: Tue, 11 Oct 2022 12:16:13 +0530 Subject: [PATCH] qcacmn: Initial changes for york bring-up in HIF Layer Add device Id and target type checks for qcn9160 target compilation. Change-Id: I40f5ae3f1ac715f977f9df5a46c71740c61c7399 CRs-Fixed: 3282629 --- hif/inc/hif.h | 1 + hif/inc/hostdef.h | 1 + hif/inc/target_type.h | 5 ++++ hif/inc/targetdef.h | 2 ++ hif/src/ath_procfs.c | 2 ++ hif/src/ce/ce_assignment.h | 51 ++++++++++++++++++++++++++++++++++++++ hif/src/ce/ce_main.c | 13 ++++++++-- hif/src/hif_main.c | 6 +++++ hif/src/hif_main.h | 1 + hif/src/pcie/if_pci.c | 3 +++ hif/src/regtable.c | 13 ++++++++++ hif/src/snoc/if_ahb.c | 12 ++++++--- 12 files changed, 105 insertions(+), 5 deletions(-) diff --git a/hif/inc/hif.h b/hif/inc/hif.h index c86e6b4a06..ec7c4cbb6d 100644 --- a/hif/inc/hif.h +++ b/hif/inc/hif.h @@ -82,6 +82,7 @@ typedef void *hif_handle_t; #define HIF_TYPE_QCA9574 28 #define HIF_TYPE_MANGO 29 #define HIF_TYPE_QCA5332 30 +#define HIF_TYPE_QCN9160 31 #define DMA_COHERENT_MASK_DEFAULT 37 diff --git a/hif/inc/hostdef.h b/hif/inc/hostdef.h index 456fe38e0d..d5484a4816 100644 --- a/hif/inc/hostdef.h +++ b/hif/inc/hostdef.h @@ -50,4 +50,5 @@ extern struct hostdef_s *QCN9224v1_HOSTDEF; extern struct hostdef_s *QCN9224_HOSTDEF; extern struct hostdef_s *QCA9574_HOSTDEF; extern struct hostdef_s *QCA5332_HOSTDEF; +extern struct hostdef_s *QCN9160_HOSTDEF; #endif diff --git a/hif/inc/target_type.h b/hif/inc/target_type.h index a2a6bda772..0b0e0be4ff 100644 --- a/hif/inc/target_type.h +++ b/hif/inc/target_type.h @@ -95,6 +95,11 @@ extern "C" { #define TARGET_TYPE_QCA5332 35 #endif +/* York */ +#ifndef TARGET_TYPE_QCN9160 +#define TARGET_TYPE_QCN9160 36 +#endif + #ifdef __cplusplus } #endif diff --git a/hif/inc/targetdef.h b/hif/inc/targetdef.h index 75339ebc49..56acc83815 100644 --- a/hif/inc/targetdef.h +++ b/hif/inc/targetdef.h @@ -50,6 +50,7 @@ extern struct targetdef_s *QCN9224v1_TARGETDEF; extern struct targetdef_s *QCN9224_TARGETDEF; extern struct targetdef_s *QCA9574_TARGETDEF; extern struct targetdef_s *QCA5332_TARGETDEF; +extern struct targetdef_s *QCN9160_TARGETDEF; extern struct ce_reg_def *AR6002_CE_TARGETdef; extern struct ce_reg_def *AR6003_CE_TARGETdef; @@ -75,5 +76,6 @@ extern struct ce_reg_def *QCN9224v1_CE_TARGETDEF; extern struct ce_reg_def *QCN9224_CE_TARGETDEF; extern struct ce_reg_def *QCA9574_CE_TARGETDEF; extern struct ce_reg_def *QCA5332_CE_TARGETDEF; +extern struct ce_reg_def *QCN9160_CE_TARGETDEF; #endif diff --git a/hif/src/ath_procfs.c b/hif/src/ath_procfs.c index de7e85efbf..b19fc7e167 100644 --- a/hif/src/ath_procfs.c +++ b/hif/src/ath_procfs.c @@ -117,6 +117,7 @@ static ssize_t ath_procfs_diag_read_legacy(struct file *file, (tgt_info->target_type == TARGET_TYPE_QCN9000) || (tgt_info->target_type == TARGET_TYPE_QCN9224) || (tgt_info->target_type == TARGET_TYPE_QCN6122) || + (tgt_info->target_type == TARGET_TYPE_QCN9160) || (tgt_info->target_type == TARGET_TYPE_QCA5018) || (tgt_info->target_type == TARGET_TYPE_QCA5332) || (tgt_info->target_type == TARGET_TYPE_QCA6018) || @@ -201,6 +202,7 @@ static ssize_t ath_procfs_diag_write_legacy(struct file *file, (tgt_info->target_type == TARGET_TYPE_QCN9000) || (tgt_info->target_type == TARGET_TYPE_QCN9224) || (tgt_info->target_type == TARGET_TYPE_QCN6122) || + (tgt_info->target_type == TARGET_TYPE_QCN9160) || (tgt_info->target_type == TARGET_TYPE_QCA5018) || (tgt_info->target_type == TARGET_TYPE_QCA5332) || (tgt_info->target_type == TARGET_TYPE_QCA6018) || diff --git a/hif/src/ce/ce_assignment.h b/hif/src/ce/ce_assignment.h index a2a55c42e7..b3f0a57d5b 100644 --- a/hif/src/ce/ce_assignment.h +++ b/hif/src/ce/ce_assignment.h @@ -1062,6 +1062,57 @@ static struct CE_pipe_config target_ce_config_wlan_qcn6122[] = { /* CE 9, 10, 11 belong to CoreBsp & MHI driver */ }; +#define QCN_9160_CE_COUNT 6 +static struct CE_attr host_ce_config_wlan_qcn9160[] = { + /* host->target HTC control and raw streams */ + {/*CE0*/ CE_ATTR_FLAGS, 0, 16, 2048, 0, NULL,}, + /* target->host HTT + HTC control */ + {/*CE1*/ (CE_ATTR_FLAGS), 0, 0, 2048, + 512, NULL,}, + /* target->host WMI */ + {/*CE2*/ (CE_ATTR_FLAGS), 0, 0, WMI_CE_BUF_SIZE, + 128, NULL,}, + /* host->target WMI */ + {/*CE3*/ (CE_ATTR_FLAGS), 0, 32, WMI_CE_BUF_SIZE, 0, NULL,}, + /* host->target HTT */ + {/*CE4*/ (CE_ATTR_FLAGS), 0, + CE_HTT_H2T_MSG_SRC_NENTRIES, 256, 0, NULL,}, + /* target -> host PKTLOG */ + {/*CE5*/ (CE_ATTR_FLAGS), 0, 0, 2048, + 512, NULL,}, + /* Target autonomous HIF_memcpy */ + {/*CE6*/ (CE_ATTR_FLAGS), 0, 0, 0, 0, NULL,}, + /* host->target WMI (mac1) */ + {/*CE7*/ (CE_ATTR_FLAGS), 0, 0, 0, 0, NULL,}, + /* Reserved for target */ + {/*CE8*/ (CE_ATTR_FLAGS), 0, 0, 0, 0, NULL,}, + /* CE 9, 10, 11 belong to CoreBsp & MHI driver */ +}; + +static struct CE_pipe_config target_ce_config_wlan_qcn9160[] = { + /* host->target HTC control and raw streams */ + { /* CE0 */ 0, PIPEDIR_OUT, 32, 2048, CE_ATTR_FLAGS, 0,}, + /* target->host HTT */ + { /* CE1 */ 1, PIPEDIR_IN, 32, 2048, CE_ATTR_FLAGS, 0,}, + /* target->host WMI + HTC control */ + { /* CE2 */ 2, PIPEDIR_IN, 32, WMI_CE_BUF_SIZE, CE_ATTR_FLAGS, 0,}, + /* host->target WMI */ + { /* CE3 */ 3, PIPEDIR_OUT, 32, WMI_CE_BUF_SIZE, CE_ATTR_FLAGS, 0,}, + /* host->target HTT */ + { /* CE4 */ 4, PIPEDIR_OUT, 256, 256, + (CE_ATTR_FLAGS | CE_ATTR_DISABLE_INTR), 0,}, + /* Target -> host PKTLOG */ + { /* CE5 */ 5, PIPEDIR_IN, 32, 2048, CE_ATTR_FLAGS, 0,}, + /* Reserved for target autonomous HIF_memcpy */ + { /* CE6 */ 6, PIPEDIR_INOUT, 32, 16384, CE_ATTR_FLAGS, 0,}, + /* CE7 used only by Host */ + { /* CE7 */ 7, PIPEDIR_OUT, 32, 2048, + 8192, 0,}, + /* Reserved for target */ + { /* CE8 */ 8, PIPEDIR_INOUT, 32, 16384, CE_ATTR_FLAGS, 0,}, + /* CE 9, 10, 11 belong to CoreBsp & MHI driver */ +}; + #ifdef QCA_LOWMEM_CONFIG #define PKTLOG_DST_ENTRIES 128 #else diff --git a/hif/src/ce/ce_main.c b/hif/src/ce/ce_main.c index 995101a192..213d86a25e 100644 --- a/hif/src/ce/ce_main.c +++ b/hif/src/ce/ce_main.c @@ -941,7 +941,7 @@ static struct service_to_pipe target_service_to_ce_map_qcn9224[] = { }; #endif -#if (defined(QCA_WIFI_QCA5018)) +#if defined(QCA_WIFI_QCA5018) || defined(QCA_WIFI_QCN9160) static struct service_to_pipe target_service_to_ce_map_qca5018[] = { { WMI_DATA_VO_SVC, PIPEDIR_OUT, 3, }, { WMI_DATA_VO_SVC, PIPEDIR_IN, 2, }, @@ -1439,6 +1439,7 @@ static void hif_select_service_to_pipe_map(struct hif_softc *scn, break; case TARGET_TYPE_QCA5018: case TARGET_TYPE_QCN6122: + case TARGET_TYPE_QCN9160: *tgt_svc_map_to_use = target_service_to_ce_map_qca5018; *sz_tgt_svc_map_to_use = @@ -1707,6 +1708,7 @@ bool ce_srng_based(struct hif_softc *scn) case TARGET_TYPE_QCA6018: case TARGET_TYPE_QCN9000: case TARGET_TYPE_QCN6122: + case TARGET_TYPE_QCN9160: case TARGET_TYPE_QCA5018: case TARGET_TYPE_KIWI: case TARGET_TYPE_MANGO: @@ -2361,7 +2363,6 @@ struct CE_handle *ce_init(struct hif_softc *scn, src_ring, attr); if (status < 0) goto error_target_access; - ce_ring_test_initial_indexes(CE_id, src_ring, "src_ring"); } @@ -4104,6 +4105,14 @@ void hif_ce_prepare_config(struct hif_softc *scn) scn->ce_count = QCN_6122_CE_COUNT; scn->disable_wake_irq = 1; break; + case TARGET_TYPE_QCN9160: + hif_state->host_ce_config = host_ce_config_wlan_qcn9160; + hif_state->target_ce_config = target_ce_config_wlan_qcn9160; + hif_state->target_ce_config_sz = + sizeof(target_ce_config_wlan_qcn9160); + scn->ce_count = QCN_9160_CE_COUNT; + scn->disable_wake_irq = 1; + break; case TARGET_TYPE_QCA5018: hif_state->host_ce_config = host_ce_config_wlan_qca5018; hif_state->target_ce_config = target_ce_config_wlan_qca5018; diff --git a/hif/src/hif_main.c b/hif/src/hif_main.c index 03e65410b0..f7b1216f3a 100644 --- a/hif/src/hif_main.c +++ b/hif/src/hif_main.c @@ -1636,6 +1636,12 @@ int hif_get_device_type(uint32_t device_id, hif_info(" *********** QCN6122 *************"); break; + case QCN9160_DEVICE_ID: + *hif_type = HIF_TYPE_QCN9160; + *target_type = TARGET_TYPE_QCN9160; + hif_info(" *********** QCN9160 *************"); + break; + case QCN7605_DEVICE_ID: case QCN7605_COMPOSITE: case QCN7605_STANDALONE: diff --git a/hif/src/hif_main.h b/hif/src/hif_main.h index d985a83b3c..d8c344f357 100644 --- a/hif/src/hif_main.h +++ b/hif/src/hif_main.h @@ -92,6 +92,7 @@ #define QCN9000_DEVICE_ID (0x1104) #define QCN9224_DEVICE_ID (0x1109) #define QCN6122_DEVICE_ID (0xFFFB) +#define QCN9160_DEVICE_ID (0xFFF8) #define QCA6390_EMULATION_DEVICE_ID (0x0108) #define QCA6390_DEVICE_ID (0x1101) /* TODO: change IDs for HastingsPrime */ diff --git a/hif/src/pcie/if_pci.c b/hif/src/pcie/if_pci.c index a050db55f8..11c36e2da4 100644 --- a/hif/src/pcie/if_pci.c +++ b/hif/src/pcie/if_pci.c @@ -1733,6 +1733,7 @@ int hif_pci_bus_configure(struct hif_softc *hif_sc) (hif_sc->target_info.target_type == TARGET_TYPE_QCA5332) || (hif_sc->target_info.target_type == TARGET_TYPE_QCA5018) || (hif_sc->target_info.target_type == TARGET_TYPE_QCN6122) || + (hif_sc->target_info.target_type == TARGET_TYPE_QCN9160) || (hif_sc->target_info.target_type == TARGET_TYPE_QCA6018)) && (hif_sc->bus_type == QDF_BUS_TYPE_AHB)) { hif_sc->per_ce_irq = true; @@ -1757,6 +1758,7 @@ int hif_pci_bus_configure(struct hif_softc *hif_sc) (hif_sc->target_info.target_type == TARGET_TYPE_QCA5332) || (hif_sc->target_info.target_type == TARGET_TYPE_QCA5018) || (hif_sc->target_info.target_type == TARGET_TYPE_QCN6122) || + (hif_sc->target_info.target_type == TARGET_TYPE_QCN9160) || (hif_sc->target_info.target_type == TARGET_TYPE_QCA6018)) && (hif_sc->bus_type == QDF_BUS_TYPE_PCI)) hif_debug("Skip irq config for PCI based 8074 target"); @@ -3550,6 +3552,7 @@ int hif_configure_irq(struct hif_softc *scn) case TARGET_TYPE_QCA5018: case TARGET_TYPE_QCA5332: case TARGET_TYPE_QCA9574: + case TARGET_TYPE_QCN9160: ret = hif_ahb_configure_irq(sc); break; case TARGET_TYPE_QCN9224: diff --git a/hif/src/regtable.c b/hif/src/regtable.c index 6451988499..702acbe6d2 100644 --- a/hif/src/regtable.c +++ b/hif/src/regtable.c @@ -156,6 +156,14 @@ void hif_target_register_tbl_attach(struct hif_softc *scn, u32 target_type) break; #endif +#if defined(QCN9160_HEADERS_DEF) + case TARGET_TYPE_QCN9160: + scn->targetdef = QCN9160_TARGETDEF; + scn->target_ce_def = QCN9160_CE_TARGETDEF; + hif_info("TARGET_TYPE_QCN9160"); + break; +#endif + #if defined(QCA5018_HEADERS_DEF) case TARGET_TYPE_QCA5018: scn->targetdef = QCA5018_TARGETDEF; @@ -309,6 +317,11 @@ void hif_register_tbl_attach(struct hif_softc *scn, u32 hif_type) scn->hostdef = QCN6122_HOSTDEF; break; #endif +#if defined(QCN9160_HEADERS_DEF) + case HIF_TYPE_QCN9160: + scn->hostdef = QCN9160_HOSTDEF; + break; +#endif #if defined(QCA5018_HEADERS_DEF) case HIF_TYPE_QCA5018: scn->hostdef = QCA5018_HOSTDEF; diff --git a/hif/src/snoc/if_ahb.c b/hif/src/snoc/if_ahb.c index 21ce7563ab..dd521d5f1a 100644 --- a/hif/src/snoc/if_ahb.c +++ b/hif/src/snoc/if_ahb.c @@ -475,11 +475,16 @@ QDF_STATUS hif_ahb_enable_bus(struct hif_softc *ol_sc, } if (target_type == TARGET_TYPE_QCN6122 || - target_type == TARGET_TYPE_QCA5332) { + target_type == TARGET_TYPE_QCN9160) { hif_ahb_get_soc_info_pld(sc, dev); } - if (target_type == TARGET_TYPE_QCN6122) { + /* 11BE SoC chipsets Need to call this function to get cmem addr */ + if (target_type == TARGET_TYPE_QCA5332) + hif_ahb_get_soc_info_pld(sc, dev); + + if (target_type == TARGET_TYPE_QCN6122 || + target_type == TARGET_TYPE_QCN9160) { hif_update_irq_ops_with_pci(ol_sc); } else { status = pfrm_platform_get_resource(&pdev->dev, @@ -792,7 +797,8 @@ void hif_display_ahb_irq_regs(struct hif_softc *scn) void *mem = scn->mem_ce ? scn->mem_ce : scn->mem; struct hif_target_info *tgt_info = &scn->target_info; - if (tgt_info->target_type == TARGET_TYPE_QCN6122) { + if (tgt_info->target_type == TARGET_TYPE_QCN6122 || + tgt_info->target_type == TARGET_TYPE_QCN9160) { return; } if (scn->per_ce_irq) {