Bladeren bron

qcacmn: hif/ce changes for wcn6450

Add the following hif/ce changes to add support for wcn6450,
* New host/target wlan ce config for wcn6450
* New service to pipe map for wcn6450
* New host/ce/target table attach for wcn6450

Change-Id: I20fa1410f5e4e7a0146bc2d0b48a18269ca4a8c9
CRs-Fixed: 3381111
Venkateswara Naralasetty 2 jaren geleden
bovenliggende
commit
ad3cd5fa15

+ 1 - 0
hif/inc/hif.h

@@ -84,6 +84,7 @@ typedef void *hif_handle_t;
 #define HIF_TYPE_QCA5332 30
 #define HIF_TYPE_QCN9160 31
 #define HIF_TYPE_PEACH 32
+#define HIF_TYPE_WCN6450 33
 
 #define DMA_COHERENT_MASK_DEFAULT   37
 

+ 5 - 0
hif/inc/target_type.h

@@ -104,6 +104,11 @@ extern "C" {
 #define TARGET_TYPE_PEACH    37
 #endif
 
+/* Evros */
+#ifndef TARGET_TYPE_WCN6450
+#define TARGET_TYPE_WCN6450 38
+#endif
+
 #ifdef __cplusplus
 }
 #endif

+ 71 - 0
hif/src/ce/ce_assignment.h

@@ -1783,4 +1783,75 @@ static struct CE_pipe_config target_ce_config_wlan_qcn9224[] = {
 };
 #endif
 
+static struct CE_attr host_ce_config_wlan_wcn6450[] = {
+	/* 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,  2048, 128, NULL,},
+	/* host->target WMI */
+	{ /* CE3 */ CE_ATTR_FLAGS, 0, 32, 2048, 0, NULL,},
+	/* host->target HTT command*/
+	{ /* CE4 */ CE_ATTR_FLAGS, 0,
+		CE_HTT_H2T_MSG_SRC_NENTRIES, 256, 0, NULL,},
+	/* host->target HTT data */
+	{ /* CE5 */ (CE_ATTR_FLAGS | CE_ATTR_DISABLE_INTR), 0,
+		CE_HTT_H2T_MSG_SRC_NENTRIES, 256, 0, NULL,},
+	/* target->target M3 image download + HIF MEMCPY(offload)
+	 * HIF memcpy(ring refill)
+	 */
+	{ /* CE6 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL,},
+#ifdef WLAN_FEATURE_WMI_DIAG_OVER_CE7
+	/* target->host WMI logging */
+	{ /* CE7 */ CE_ATTR_FLAGS, 0, 0, 2048, 32, NULL,},
+#else
+	/* ce_diag, the Diagnostic Window */
+	{ /* CE7 */ (CE_ATTR_DIAG_FLAGS | CE_ATTR_DISABLE_INTR), 0,
+		0, DIAG_TRANSFER_LIMIT, 0, NULL,},
+#endif
+	/* Unused*/
+	{ /* CE8 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL,},
+	/* target->host RDDM */
+	{ /* CE9 */ CE_ATTR_FLAGS, 0, 0, 0, 0, NULL,},
+	/* target->host HTT */
+	{ /* CE10 */ CE_ATTR_FLAGS, 0, 0,  2048, 512, NULL,},
+	/* target->host HTT */
+	{ /* CE11 */ CE_ATTR_FLAGS, 0, 0, 2048, 512, NULL,},
+};
+
+static struct CE_pipe_config target_ce_config_wlan_wcn6450[] = {
+	/* 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,  64, 2048, CE_ATTR_FLAGS, 0,},
+	/* host->target WMI */
+	{ /* CE3 */ 3, PIPEDIR_OUT, 32, 2048, CE_ATTR_FLAGS, 0,},
+	/* host->target HTT command*/
+	{ /* CE4 */ 4, PIPEDIR_OUT, 256, 256,
+		(CE_ATTR_FLAGS | CE_ATTR_DISABLE_INTR), 0,},
+	/* host->target HTT data */
+	{ /* CE5 */ 5, PIPEDIR_OUT, 256, 256,
+		(CE_ATTR_FLAGS | CE_ATTR_DISABLE_INTR), 0,},
+	/* target->target HIF_memcpy*/
+	{ /* CE6 */ 6, PIPEDIR_INOUT, 1024, 2048, CE_ATTR_FLAGS, 0,},
+#ifdef WLAN_FEATURE_WMI_DIAG_OVER_CE7
+	/* target->host WMI logging */
+	{ /* CE7 */ 7, PIPEDIR_IN, 32, 2048, CE_ATTR_FLAGS, 0,},
+#else
+	/* CE7 used only by Host */
+	{ /* CE7 */ 7, PIPEDIR_INOUT_H2H, 0, 0,
+		(CE_ATTR_FLAGS | CE_ATTR_DISABLE_INTR), 0,},
+#endif
+	/* CE8 unused */
+	{ /* CE8 */ 8, PIPEDIR_IN, 0, 0, CE_ATTR_FLAGS, 0,},
+	/* CE9 target->host RDDM*/
+	{ /* CE9 */ 9, PIPEDIR_IN,  32, 2048, CE_ATTR_FLAGS, 0,},
+	/* CE10 target->host HTT */
+	{ /* CE10 */ 10, PIPEDIR_IN,  32, 2048, CE_ATTR_FLAGS, 0,},
+	/* Target->host HTT */
+	{ /* CE11 */ 11, PIPEDIR_IN,  32, 2048, CE_ATTR_FLAGS, 0,},
+};
 #endif /* __HIF_PCI_INTERNAL_H__ */

+ 73 - 2
hif/src/ce/ce_main.c

@@ -56,7 +56,8 @@
 #if (defined(QCA_WIFI_QCA8074) || defined(QCA_WIFI_QCA6290) || \
 	defined(QCA_WIFI_QCA6018) || defined(QCA_WIFI_QCA5018) || \
 	defined(QCA_WIFI_KIWI) || defined(QCA_WIFI_QCA5332) || \
-	defined(QCA_WIFI_QCA9574)) && !defined(QCA_WIFI_SUPPORT_SRNG)
+	defined(QCA_WIFI_QCA9574)) && !defined(QCA_WIFI_SUPPORT_SRNG) && \
+	!defined(QCA_WIFI_WCN6450)
 #define QCA_WIFI_SUPPORT_SRNG
 #endif
 
@@ -1168,6 +1169,36 @@ static struct service_to_pipe target_service_to_ce_map_kiwi[] = {
 };
 #endif
 
+#ifdef QCA_WIFI_WCN6450
+static struct service_to_pipe target_service_to_ce_map_wcn6450[] = {
+	{ WMI_DATA_VO_SVC, PIPEDIR_OUT, 3, },
+	{ WMI_DATA_VO_SVC, PIPEDIR_IN, 2, },
+	{ WMI_DATA_BK_SVC, PIPEDIR_OUT, 3, },
+	{ WMI_DATA_BK_SVC, PIPEDIR_IN, 2, },
+	{ WMI_DATA_BE_SVC, PIPEDIR_OUT, 3, },
+	{ WMI_DATA_BE_SVC, PIPEDIR_IN, 2, },
+	{ WMI_DATA_VI_SVC, PIPEDIR_OUT, 3, },
+	{ WMI_DATA_VI_SVC, PIPEDIR_IN, 2, },
+	{ WMI_CONTROL_SVC, PIPEDIR_OUT, 3, },
+	{ WMI_CONTROL_SVC, PIPEDIR_IN, 2, },
+	{ HTC_CTRL_RSVD_SVC, PIPEDIR_OUT, 0, },
+	{ HTC_CTRL_RSVD_SVC, PIPEDIR_IN, 2, },
+	{ HTT_DATA_MSG_SVC, PIPEDIR_OUT, 4, },
+	{ HTT_DATA2_MSG_SVC, PIPEDIR_OUT, 5, },
+	{ HTT_DATA_MSG_SVC, PIPEDIR_IN, 1, },
+	{ HTT_DATA2_MSG_SVC, PIPEDIR_IN, 10, },
+	{ HTT_DATA3_MSG_SVC, PIPEDIR_IN, 11, },
+#ifdef WLAN_FEATURE_WMI_DIAG_OVER_CE7
+	{ WMI_CONTROL_DIAG_SVC, PIPEDIR_IN, 7, },
+#endif
+	/* (Additions here) */
+	{ 0, 0, 0, },
+};
+#else
+static struct service_to_pipe target_service_to_ce_map_wcn6450[] = {
+};
+#endif
+
 static struct service_to_pipe target_service_to_ce_map_ar900b[] = {
 	{
 		WMI_DATA_VO_SVC,
@@ -1447,6 +1478,11 @@ static void hif_select_service_to_pipe_map(struct hif_softc *scn,
 							 tgt_svc_map_to_use,
 							 sz_tgt_svc_map_to_use);
 			break;
+		case TARGET_TYPE_WCN6450:
+			*tgt_svc_map_to_use = target_service_to_ce_map_wcn6450;
+			*sz_tgt_svc_map_to_use =
+				 sizeof(target_service_to_ce_map_wcn6450);
+			break;
 		case TARGET_TYPE_QCA8074:
 			*tgt_svc_map_to_use = target_service_to_ce_map_qca8074;
 			*sz_tgt_svc_map_to_use =
@@ -1500,6 +1536,7 @@ static void hif_select_service_to_pipe_map(struct hif_softc *scn,
 					sizeof(struct service_to_pipe);
 }
 
+#ifndef QCA_WIFI_WCN6450
 /**
  * ce_mark_datapath() - marks the ce_state->htt_rx_data accordingly
  * @ce_state : pointer to the state context of the CE
@@ -1540,6 +1577,35 @@ static bool ce_mark_datapath(struct CE_state *ce_state)
 	}
 	return rc;
 }
+#else
+static bool ce_mark_datapath(struct CE_state *ce_state)
+{
+	struct service_to_pipe *svc_map;
+	uint32_t map_sz, map_len;
+	int i;
+
+	if (ce_state) {
+		hif_select_service_to_pipe_map(ce_state->scn, &svc_map,
+					       &map_sz);
+
+		map_len = map_sz / sizeof(struct service_to_pipe);
+		for (i = 0; i < map_len; i++) {
+			if ((svc_map[i].pipenum == ce_state->id) &&
+			    ((svc_map[i].service_id == HTT_DATA_MSG_SVC)  ||
+			     (svc_map[i].service_id == HTT_DATA2_MSG_SVC) ||
+			     (svc_map[i].service_id == HTT_DATA3_MSG_SVC)) &&
+			    (svc_map[i].pipedir == PIPEDIR_IN))
+				ce_state->htt_rx_data = true;
+			else if ((svc_map[i].pipenum == ce_state->id) &&
+				 (svc_map[i].service_id == HTT_DATA2_MSG_SVC) &&
+				 (svc_map[i].pipedir == PIPEDIR_OUT))
+				ce_state->htt_tx_data = true;
+		}
+	}
+
+	return (ce_state->htt_rx_data || ce_state->htt_tx_data);
+}
+#endif
 
 /**
  * hif_get_max_wmi_ep() - Get max WMI EPs configured in target svc map
@@ -4261,7 +4327,12 @@ void hif_ce_prepare_config(struct hif_softc *scn)
 					sizeof(target_ce_config_wlan_adrastea);
 		}
 		break;
-
+	case TARGET_TYPE_WCN6450:
+		hif_state->host_ce_config = host_ce_config_wlan_wcn6450;
+		hif_state->target_ce_config = target_ce_config_wlan_wcn6450;
+		hif_state->target_ce_config_sz =
+				sizeof(target_ce_config_wlan_wcn6450);
+		break;
 	}
 	QDF_BUG(scn->ce_count <= CE_COUNT_MAX);
 }

+ 1 - 0
hif/src/hif_hw_version.h

@@ -47,6 +47,7 @@
 #define QCA6490_v2                      0x400c0200
 #define WCN3990_v2_2                    0x400f0000
 #define WCN6750_V1                      0x40140110
+#define WCN6450_V1			0x40200100
 #define WCN3990_TALOS                   0x40670000
 #define WCN3990_MOOREA                  0x40090000
 #define WCN3990_SAIPAN                  0x400B0000

+ 6 - 1
hif/src/hif_io32.h

@@ -301,7 +301,12 @@ static inline uint32_t hif_read32_mb_reg_window(void *scn, void __iomem *addr)
 }
 #endif
 
-#ifdef CONFIG_IO_MEM_ACCESS_DEBUG
+#if defined(HIF_HAL_REG_ACCESS_SUPPORT)
+#define A_TARGET_READ(scn, offset) \
+	hif_reg_window_read(scn, offset)
+#define A_TARGET_WRITE(scn, offset, value) \
+	hif_reg_window_write(scn, offset, value)
+#elif defined(CONFIG_IO_MEM_ACCESS_DEBUG)
 uint32_t hif_target_read_checked(struct hif_softc *scn,
 					uint32_t offset);
 void hif_target_write_checked(struct hif_softc *scn, uint32_t offset,

+ 24 - 0
hif/src/hif_main.c

@@ -387,6 +387,11 @@ static const struct qwlan_hw qwlan_hw_list[] = {
 		.subid = 0,
 		.name = "WCN6750_V1",
 	},
+	{
+		.id = WCN6450_V1,
+		.subid = 0,
+		.name = "WCN6450_V1",
+	},
 	{
 		.id = QCA6490_v2_1,
 		.subid = 0,
@@ -1268,6 +1273,19 @@ QDF_STATUS hif_try_complete_tasks(struct hif_softc *scn)
 	return QDF_STATUS_SUCCESS;
 }
 
+#ifdef HIF_HAL_REG_ACCESS_SUPPORT
+void hif_reg_window_write(struct hif_softc *scn, uint32_t offset,
+			  uint32_t value)
+{
+	hal_write32_mb(scn->hal_soc, offset, value);
+}
+
+uint32_t hif_reg_window_read(struct hif_softc *scn, uint32_t offset)
+{
+	return hal_read32_mb(scn->hal_soc, offset);
+}
+#endif
+
 #if defined(HIF_IPCI) && defined(FEATURE_HAL_DELAYED_REG_WRITE)
 QDF_STATUS hif_try_prevent_ep_vote_access(struct hif_opaque_softc *hif_ctx)
 {
@@ -1831,6 +1849,12 @@ int hif_get_device_type(uint32_t device_id,
 		hif_info(" *********** QCA9574 *************");
 		break;
 
+	case WCN6450_DEVICE_ID:
+		*hif_type = HIF_TYPE_WCN6450;
+		*target_type = TARGET_TYPE_WCN6450;
+		hif_info(" *********** WCN6450 *************");
+		break;
+
 	default:
 		hif_err("Unsupported device ID = 0x%x!", device_id);
 		ret = -ENODEV;

+ 16 - 1
hif/src/hif_main.h

@@ -108,6 +108,9 @@
 /* TODO: change IDs for Hamilton */
 #define KIWI_DEVICE_ID (0x1107)
 
+/*TODO: change IDs for Evros */
+#define WCN6450_DEVICE_ID (0x1108)
+
 #define ADRASTEA_DEVICE_ID_P2_E12 (0x7021)
 #define AR9887_DEVICE_ID    (0x0050)
 #define AR900B_DEVICE_ID    (0x0040)
@@ -588,8 +591,14 @@ static inline void hif_usb_ramdump_handler(struct hif_opaque_softc *scn) {}
  */
 irqreturn_t hif_wake_interrupt_handler(int irq, void *context);
 
-#ifdef HIF_SNOC
+#if defined(HIF_SNOC)
 bool hif_is_target_register_access_allowed(struct hif_softc *hif_sc);
+#elif defined(HIF_IPCI)
+static inline bool
+hif_is_target_register_access_allowed(struct hif_softc *hif_sc)
+{
+	return !(hif_sc->recovery);
+}
 #else
 static inline
 bool hif_is_target_register_access_allowed(struct hif_softc *hif_sc)
@@ -622,4 +631,10 @@ void hif_runtime_prevent_linkdown(struct hif_softc *scn, bool is_get)
 }
 #endif
 
+#ifdef HIF_HAL_REG_ACCESS_SUPPORT
+void hif_reg_window_write(struct hif_softc *scn,
+			  uint32_t offset, uint32_t value);
+uint32_t hif_reg_window_read(struct hif_softc *scn, uint32_t offset);
+#endif
+
 #endif /* __HIF_MAIN_H__ */

+ 2 - 1
hif/src/hif_main_legacy.c

@@ -22,7 +22,8 @@
 #include "qdf_module.h"
 #include "hif_main.h"
 
-#if defined(HIF_PCI) || defined(HIF_SNOC) || defined(HIF_AHB)
+#if defined(HIF_PCI) || defined(HIF_SNOC) || defined(HIF_AHB) || \
+	defined(HIF_IPCI)
 #include "ce_api.h"
 #include "ce_internal.h"
 #endif

+ 3 - 2
hif/src/ipcie/if_ipci.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -814,6 +814,7 @@ static bool hif_is_pld_based_target(struct hif_ipci_softc *sc,
 #ifdef QCA_WIFI_QCA6750
 	case QCA6750_DEVICE_ID:
 #endif
+	case WCN6450_DEVICE_ID:
 		return true;
 	}
 	return false;
@@ -846,7 +847,7 @@ QDF_STATUS hif_ipci_enable_bus(struct hif_softc *ol_sc,
 	struct hif_opaque_softc *hif_hdl = GET_HIF_OPAQUE_HDL(ol_sc);
 	uint16_t revision_id = 0;
 	struct hif_target_info *tgt_info;
-	int device_id = QCA6750_DEVICE_ID;
+	int device_id = HIF_IPCI_DEVICE_ID;
 
 	if (!ol_sc) {
 		hif_err("hif_ctx is NULL");

+ 8 - 0
hif/src/ipcie/if_ipci.h

@@ -79,6 +79,14 @@ struct hif_ipci_stats {
 #define EP_WAKE_DELAY_US 200
 #endif
 
+#if defined(QCA_WIFI_WCN6450)
+#define HIF_IPCI_DEVICE_ID WCN6450_DEVICE_ID
+#elif defined(QCA_WIFI_QCA6750)
+#define HIF_IPCI_DEVICE_ID QCA6750_DEVICE_ID
+#else
+#define HIF_IPCI_DEVICE_ID 0
+#endif
+
 struct hif_ipci_softc {
 	struct HIF_CE_state ce_sc;
 	void __iomem *mem;      /* PCI address. */

+ 19 - 0
hif/src/regtable.c

@@ -25,6 +25,7 @@
 #include "ar6320v2def.h"
 #include "hif_main.h"
 #include "adrastea_reg_def.h"
+#include "wcn6450def.h"
 
 #include "targetdef.h"
 #include "hostdef.h"
@@ -223,6 +224,15 @@ void hif_target_register_tbl_attach(struct hif_softc *scn, u32 target_type)
 		hif_info("TARGET_TYPE_QCA6750");
 		break;
 #endif /* QCA6750_HEADERS_DEF */
+
+#if defined(WCN6450_HEADERS_DEF)
+	case TARGET_TYPE_WCN6450:
+		scn->targetdef = &wcn6450_targetdef;
+		scn->target_ce_def = &wcn6450_ce_targetdef;
+		hif_info("TARGET_TYPE_WCN6450");
+		break;
+#endif /* WCN6450_HEADERS_DEF */
+
 	default:
 		break;
 	}
@@ -382,6 +392,15 @@ void hif_register_tbl_attach(struct hif_softc *scn, u32 hif_type)
 		hif_info("HIF_TYPE_QCA6750");
 		break;
 #endif /* QCA6750_HEADERS_DEF */
+
+#if defined(WCN6450_HEADERS_DEF)
+	case HIF_TYPE_WCN6450:
+		scn->hostdef = &wcn6450_hostdef;
+		scn->host_shadow_regs = &wcn6450_host_shadow_regs;
+		hif_info("HIF_TYPE_WCN6450");
+		break;
+#endif /* WCN6450_HEADERS_DEF */
+
 	default:
 		break;
 	}