Browse Source

qcacmn: hal changes for wcn6450

Changes required for hal attach for wcn6450.

Change-Id: I7953f14f168b570d598ff88fcdf1f5363e2d4d52
CRs-Fixed: 3383310
Venkateswara Naralasetty 2 years ago
parent
commit
bd07dadb15

+ 4 - 2
hal/wifi3.0/hal_api.h

@@ -243,7 +243,8 @@ static inline void hal_tx_init_cmd_credit_ring(hal_soc_handle_t hal_soc_hdl,
  *                            that window would be a bug
  */
 #if !defined(QCA_WIFI_QCA6390) && !defined(QCA_WIFI_QCA6490) && \
-    !defined(QCA_WIFI_QCA6750) && !defined(QCA_WIFI_KIWI)
+    !defined(QCA_WIFI_QCA6750) && !defined(QCA_WIFI_KIWI) && \
+    !defined(QCA_WIFI_WCN6450)
 static inline void hal_write32_mb(struct hal_soc *hal_soc, uint32_t offset,
 				  uint32_t value)
 {
@@ -486,7 +487,8 @@ static inline void hal_srng_write_address_32_mb(struct hal_soc *hal_soc,
 #endif
 
 #if !defined(QCA_WIFI_QCA6390) && !defined(QCA_WIFI_QCA6490) && \
-    !defined(QCA_WIFI_QCA6750) && !defined(QCA_WIFI_KIWI)
+    !defined(QCA_WIFI_QCA6750) && !defined(QCA_WIFI_KIWI) && \
+    !defined(QCA_WIFI_WCN6450)
 /**
  * hal_read32_mb() - Access registers to read configuration
  * @hal_soc: hal soc handle

+ 26 - 23
hal/wifi3.0/hal_generic_api.h

@@ -157,29 +157,6 @@ void hal_get_hw_hptp_generic(struct hal_soc *hal_soc,
 	}
 }
 
-#if defined(WBM_IDLE_LSB_WRITE_CONFIRM_WAR)
-/**
- * hal_wbm_idle_lsb_write_confirm() - Check and update WBM_IDLE_LINK ring LSB
- * @srng: srng handle
- *
- * Return: None
- */
-static void hal_wbm_idle_lsb_write_confirm(struct hal_srng *srng)
-{
-	if (srng->ring_id == HAL_SRNG_WBM_IDLE_LINK) {
-		while (SRNG_SRC_REG_READ(srng, BASE_LSB) !=
-		       ((unsigned int)srng->ring_base_paddr & 0xffffffff))
-				SRNG_SRC_REG_WRITE(srng, BASE_LSB,
-						   srng->ring_base_paddr &
-						   0xffffffff);
-	}
-}
-#else
-static void hal_wbm_idle_lsb_write_confirm(struct hal_srng *srng)
-{
-}
-#endif
-
 #ifdef DP_UMAC_HW_RESET_SUPPORT
 /**
  * hal_srng_src_hw_write_cons_prefetch_timer() - Write cons prefetch timer reg
@@ -229,6 +206,31 @@ void hal_srng_src_hw_write_cons_prefetch_timer(struct hal_srng *srng,
 {
 }
 #endif
+
+#ifndef WLAN_SOFTUMAC_SUPPORT
+#if defined(WBM_IDLE_LSB_WRITE_CONFIRM_WAR)
+/**
+ * hal_wbm_idle_lsb_write_confirm() - Check and update WBM_IDLE_LINK ring LSB
+ * @srng: srng handle
+ *
+ * Return: None
+ */
+static void hal_wbm_idle_lsb_write_confirm(struct hal_srng *srng)
+{
+	if (srng->ring_id == HAL_SRNG_WBM_IDLE_LINK) {
+		while (SRNG_SRC_REG_READ(srng, BASE_LSB) !=
+		       ((unsigned int)srng->ring_base_paddr & 0xffffffff))
+				SRNG_SRC_REG_WRITE(srng, BASE_LSB,
+						   srng->ring_base_paddr &
+						   0xffffffff);
+	}
+}
+#else
+static void hal_wbm_idle_lsb_write_confirm(struct hal_srng *srng)
+{
+}
+#endif
+
 /**
  * hal_srng_src_hw_init_generic() - Private function to initialize SRNG
  *                                  source ring HW
@@ -587,6 +589,7 @@ static inline void hal_srng_hw_reg_offset_init_generic(struct hal_soc *hal_soc)
 				REG_OFFSET(SRC, CONSUMER_PREFETCH_TIMER);
 #endif
 }
+#endif
 
 #ifdef FEATURE_DIRECT_LINK
 /**

+ 41 - 0
hal/wifi3.0/hal_internal.h

@@ -173,6 +173,7 @@ union hal_tx_cmn_config_ppe;
 union hal_tx_bank_config;
 union hal_tx_ppe_idx_map_config;
 
+#ifndef WLAN_SOFTUMAC_SUPPORT
 /* TBD: This should be movded to shared HW header file */
 enum hal_srng_ring_id {
 	/* UMAC rings */
@@ -317,6 +318,45 @@ enum hal_srng_ring_id {
 	HAL_SRNG_SW2TXMON_BUF0,
 	HAL_SRNG_LMAC1_ID_END = (HAL_SRNG_SW2TXMON_BUF0 + 2),
 };
+#else
+/* lmac rings are remains same for evros */
+enum hal_srng_ring_id {
+	HAL_SRNG_LMAC1_ID_START,
+	HAL_SRNG_WMAC1_SW2RXDMA0_BUF0 = HAL_SRNG_LMAC1_ID_START,
+#ifdef IPA_OFFLOAD
+	HAL_SRNG_WMAC1_SW2RXDMA0_BUF1,
+	HAL_SRNG_WMAC1_SW2RXDMA0_BUF2,
+#ifdef IPA_WDI3_VLAN_SUPPORT
+	HAL_SRNG_WMAC1_SW2RXDMA0_BUF3,
+#endif
+#endif
+	HAL_SRNG_WMAC1_SW2RXDMA1_BUF,
+#ifdef FEATURE_DIRECT_LINK
+	HAL_SRNG_WMAC1_RX_DIRECT_LINK_SW_REFILL_RING,
+#endif
+	HAL_SRNG_WMAC1_SW2RXDMA2_BUF,
+	HAL_SRNG_WMAC1_SW2RXDMA0_STATBUF,
+	HAL_SRNG_WMAC1_SW2RXDMA1_STATBUF,
+	HAL_SRNG_WMAC1_RXDMA2SW0,
+	HAL_SRNG_WMAC1_RXDMA2SW1,
+	HAL_SRNG_WMAC1_RXMON2SW0 = HAL_SRNG_WMAC1_RXDMA2SW1,
+	HAL_SRNG_WMAC1_SW2RXDMA1_DESC,
+#ifdef WLAN_FEATURE_CIF_CFR
+	HAL_SRNG_WIFI_POS_SRC_DMA_RING,
+	HAL_SRNG_DIR_BUF_RX_SRC_DMA_RING,
+	HAL_SRNG_DIR_BUF_RX_SRC_DMA_RING1,
+#else
+	HAL_SRNG_DIR_BUF_RX_SRC_DMA_RING,
+	HAL_SRNG_DIR_BUF_RX_SRC_DMA_RING1,
+#endif
+	HAL_SRNG_WMAC1_TXMON2SW0,
+	HAL_SRNG_SW2TXMON_BUF0,
+	HAL_SRNG_LMAC1_ID_END = (HAL_SRNG_SW2TXMON_BUF0 + 2),
+};
+
+#define HAL_SRNG_DMAC_CMN_ID_END 0
+#define HAL_SRNG_WBM_IDLE_LINK 120
+#endif
 
 #define HAL_RXDMA_MAX_RING_SIZE 0xFFFF
 #define HAL_MAX_LMACS 3
@@ -1554,6 +1594,7 @@ void hal_kiwi_attach(struct hal_soc *hal_soc);
 
 void hal_qcn9224v1_attach(struct hal_soc *hal_soc);
 void hal_qcn9224v2_attach(struct hal_soc *hal_soc);
+void hal_wcn6450_attach(struct hal_soc *hal_soc);
 
 /**
  * hal_soc_to_hal_soc_handle() - API to convert hal_soc to opaque

+ 13 - 0
hal/wifi3.0/hal_srng.c

@@ -531,6 +531,13 @@ static void hal_target_based_configure(struct hal_soc *hal)
 		hal->static_window_map = true;
 		hal_qca5332_attach(hal);
 	break;
+#endif
+#ifdef QCA_WIFI_WCN6450
+	case TARGET_TYPE_WCN6450:
+		hal->use_register_windowing = true;
+		hal->static_window_map = true;
+		hal_wcn6450_attach(hal);
+	break;
 #endif
 	default:
 	break;
@@ -575,6 +582,7 @@ char *hal_fill_reg_write_srng_stats(struct hal_srng *srng,
 /* bytes for local buffer */
 #define HAL_REG_WRITE_SRNG_STATS_LEN 100
 
+#ifndef WLAN_SOFTUMAC_SUPPORT
 void hal_dump_reg_write_srng_stats(hal_soc_handle_t hal_soc_hdl)
 {
 	struct hal_srng *srng;
@@ -601,6 +609,11 @@ void hal_dump_reg_write_srng_stats(hal_soc_handle_t hal_soc_hdl)
 	hal_debug("REO2SW3: %s",
 		  hal_fill_reg_write_srng_stats(srng, buf, sizeof(buf)));
 }
+#else
+void hal_dump_reg_write_srng_stats(hal_soc_handle_t hal_soc_hdl)
+{
+}
+#endif
 
 void hal_dump_reg_write_stats(hal_soc_handle_t hal_soc_hdl)
 {

+ 118 - 0
hal/wifi3.0/wcn6450/hal_wcn6450.c

@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 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 copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "qdf_types.h"
+#include "qdf_util.h"
+#include "qdf_types.h"
+#include "qdf_lock.h"
+#include "qdf_mem.h"
+#include "qdf_nbuf.h"
+#include "hal_internal.h"
+#include "hal_api.h"
+#include "target_type.h"
+#include "wcss_version.h"
+#include "qdf_module.h"
+#include "hal_flow.h"
+#include "rx_flow_search_entry.h"
+#include "hal_rx_flow_info.h"
+
+struct hal_hw_srng_config hw_srng_table_wcn6450[] = {
+	/* TODO: max_rings can populated by querying HW capabilities */
+	{/* REO_DST */ 0},
+	{/* REO_EXCEPTION */ 0},
+	{/* REO_REINJECT */ 0},
+	{/* REO_CMD */ 0},
+	{/* REO_STATUS */ 0},
+	{/* TCL_DATA */ 0},
+	{/* TCL_CMD */ 0},
+	{/* TCL_STATUS */ 0},
+	{/* CE_SRC */ 0},
+	{/* CE_DST */ 0},
+	{/* CE_DST_STATUS */ 0},
+	{/* WBM_IDLE_LINK */ 0},
+	{/* SW2WBM_RELEASE */ 0},
+	{/* WBM2SW_RELEASE */ 0},
+	{ /* RXDMA_BUF */
+		.start_ring_id = HAL_SRNG_WMAC1_SW2RXDMA0_BUF0,
+#ifdef IPA_OFFLOAD
+		.max_rings = 3,
+#else
+		.max_rings = 2,
+#endif
+		.entry_size = sizeof(struct wbm_buffer_ring) >> 2,
+		.lmac_ring = TRUE,
+		.ring_dir = HAL_SRNG_SRC_RING,
+		/* reg_start is not set because LMAC rings are not accessed
+		 * from host
+		 */
+		.reg_start = {},
+		.reg_size = {},
+		.max_size = HAL_RXDMA_MAX_RING_SIZE,
+	},
+	{ /* RXDMA_DST */
+		.start_ring_id = HAL_SRNG_WMAC1_RXDMA2SW0,
+		.max_rings = 1,
+		.entry_size = sizeof(struct reo_entrance_ring) >> 2,
+		.lmac_ring =  TRUE,
+		.ring_dir = HAL_SRNG_DST_RING,
+		/* reg_start is not set because LMAC rings are not accessed
+		 * from host
+		 */
+		.reg_start = {},
+		.reg_size = {},
+		.max_size = HAL_RXDMA_MAX_RING_SIZE,
+	},
+	{/* RXDMA_MONITOR_BUF */ 0},
+	{ /* RXDMA_MONITOR_STATUS */
+		.start_ring_id = HAL_SRNG_WMAC1_SW2RXDMA1_STATBUF,
+		.max_rings = 1,
+		.entry_size = sizeof(struct wbm_buffer_ring) >> 2,
+		.lmac_ring = TRUE,
+		.ring_dir = HAL_SRNG_SRC_RING,
+		/* reg_start is not set because LMAC rings are not accessed
+		 * from host
+		 */
+		.reg_start = {},
+		.reg_size = {},
+		.max_size = HAL_RXDMA_MAX_RING_SIZE,
+	},
+	{/* RXDMA_MONITOR_DST */ 0},
+	{/* RXDMA_MONITOR_DESC */ 0},
+	{/* DIR_BUF_RX_DMA_SRC */ 0},
+#ifdef WLAN_FEATURE_CIF_CFR
+	{/* WIFI_POS_SRC */ 0},
+#endif
+	{ /* REO2PPE */ 0},
+	{ /* PPE2TCL */ 0},
+	{ /* PPE_RELEASE */ 0},
+	{ /* TX_MONITOR_BUF */ 0},
+	{ /* TX_MONITOR_DST */ 0},
+	{ /* SW2RXDMA_NEW */ 0},
+};
+
+/**
+ * hal_wcn6450_attach() - Attach 6450 target specific hal_soc ops,
+ *				offset and srng table
+ * @hal_soc: HAL Soc handle
+ *
+ * Return: None
+ */
+void hal_wcn6450_attach(struct hal_soc *hal_soc)
+{
+	hal_soc->hw_srng_table = hw_srng_table_wcn6450;
+}

+ 19 - 1
hif/src/hif_main.c

@@ -1376,7 +1376,25 @@ uint8_t hif_get_ep_vote_access(struct hif_opaque_softc *hif_ctx,
 }
 #endif
 
-#if (defined(QCA_WIFI_QCA8074) || defined(QCA_WIFI_QCA6018) || \
+#if defined(QCA_WIFI_WCN6450)
+static QDF_STATUS hif_hal_attach(struct hif_softc *scn)
+{
+	scn->hal_soc = hal_attach(hif_softc_to_hif_opaque_softc(scn),
+				  scn->qdf_dev);
+	if (!scn->hal_soc)
+		return QDF_STATUS_E_FAILURE;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+static QDF_STATUS hif_hal_detach(struct hif_softc *scn)
+{
+	hal_detach(scn->hal_soc);
+	scn->hal_soc = NULL;
+
+	return QDF_STATUS_SUCCESS;
+}
+#elif (defined(QCA_WIFI_QCA8074) || defined(QCA_WIFI_QCA6018) || \
 	defined(QCA_WIFI_QCA6290) || defined(QCA_WIFI_QCA6390) || \
 	defined(QCA_WIFI_QCN9000) || defined(QCA_WIFI_QCA6490) || \
 	defined(QCA_WIFI_QCA6750) || defined(QCA_WIFI_QCA5018) || \