浏览代码

qcacmn: Initialize command/credit ring for qca8074 & qcn9000

Initialize command/credit ring for qca8074 & qcn9000.

Change-Id: I28087dd4d8f4afddd954c764c2e85da43eaf78f1
CRs-fixed: 2562649
Ankit Kumar 5 年之前
父节点
当前提交
2bf9b7a18a

+ 6 - 6
dp/wifi3.0/dp_main.c

@@ -2948,12 +2948,6 @@ static int dp_soc_cmn_setup(struct dp_soc *soc)
 		soc->num_tcl_data_rings = 0;
 	}
 
-	if (dp_tx_soc_attach(soc)) {
-		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
-				FL("dp_tx_soc_attach failed"));
-		goto fail1;
-	}
-
 	entries = wlan_cfg_get_dp_soc_tcl_cmd_credit_ring_size(soc_cfg_ctx);
 	if (dp_srng_setup(soc, &soc->tcl_cmd_credit_ring, TCL_CMD_CREDIT, 0, 0,
 			  entries, 0)) {
@@ -2967,6 +2961,12 @@ static int dp_soc_cmn_setup(struct dp_soc *soc)
 			  WLAN_MD_DP_SRNG_TCL_CMD,
 			  "tcl_cmd_credit_ring");
 
+	if (dp_tx_soc_attach(soc)) {
+		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
+			  FL("dp_tx_soc_attach failed"));
+		goto fail1;
+	}
+
 	entries = wlan_cfg_get_dp_soc_tcl_status_ring_size(soc_cfg_ctx);
 	if (dp_srng_setup(soc, &soc->tcl_status_ring, TCL_STATUS, 0, 0,
 			  entries, 0)) {

+ 7 - 0
dp/wifi3.0/dp_tx.c

@@ -4335,6 +4335,13 @@ QDF_STATUS dp_tx_soc_attach(struct dp_soc *soc)
 					soc->tcl_data_ring[IPA_TCL_DATA_RING_IDX].hal_srng);
 	}
 
+	/*
+	 * Initialize command/credit ring descriptor
+	 * Command/CREDIT ring also used for sending DATA cmds
+	 */
+	hal_tx_init_cmd_credit_ring(soc->hal_soc,
+				    soc->tcl_cmd_credit_ring.hal_srng);
+
 	/*
 	 * todo - Add a runtime config option to enable this.
 	 */

+ 9 - 0
hal/wifi3.0/hal_api.h

@@ -240,6 +240,15 @@ static inline qdf_iomem_t hal_get_window_address(struct hal_soc *hal_soc,
 	return hal_soc->ops->hal_get_window_address(hal_soc, addr);
 }
 
+static inline void hal_tx_init_cmd_credit_ring(hal_soc_handle_t hal_soc_hdl,
+					       hal_ring_handle_t hal_ring_hdl)
+{
+	struct hal_soc *hal_soc = (struct hal_soc *)hal_soc_hdl;
+
+	return hal_soc->ops->hal_tx_init_cmd_credit_ring(hal_soc_hdl,
+							 hal_ring_hdl);
+}
+
 /**
  * hal_write32_mb() - Access registers to update configuration
  * @hal_soc: hal soc handle

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

@@ -375,6 +375,8 @@ struct hal_hw_txrx_ops {
 	uint8_t (*hal_tx_comp_get_release_reason)(void *hal_desc);
 	uint8_t (*hal_get_wbm_internal_error)(void *hal_desc);
 	void (*hal_tx_desc_set_mesh_en)(void *desc, uint8_t en);
+	void (*hal_tx_init_cmd_credit_ring)(hal_soc_handle_t hal_soc_hdl,
+					    hal_ring_handle_t hal_ring_hdl);
 
 	/* rx */
 	uint32_t (*hal_rx_msdu_start_nss_get)(uint8_t *);

+ 2 - 1
hal/wifi3.0/qca5018/hal_5018.c

@@ -1366,6 +1366,7 @@ struct hal_hw_txrx_ops qca5018_hal_hw_txrx_ops = {
 	hal_tx_comp_get_release_reason_generic,
 	hal_get_wbm_internal_error_generic,
 	hal_tx_desc_set_mesh_en_5018,
+	hal_tx_init_cmd_credit_ring_5018,
 
 	/* rx */
 	hal_rx_msdu_start_nss_get_5018,
@@ -1571,7 +1572,7 @@ struct hal_hw_srng_config hw_srng_table_5018[] = {
 		.start_ring_id = HAL_SRNG_SW2TCL_CMD,
 		.max_rings = 1,
 		.entry_size = (sizeof(struct tlv_32_hdr) +
-			sizeof(struct tcl_gse_cmd)) >> 2,
+			sizeof(struct tcl_data_cmd)) >> 2,
 		.lmac_ring =  FALSE,
 		.ring_dir = HAL_SRNG_SRC_RING,
 		.reg_start = {

+ 30 - 0
hal/wifi3.0/qca5018/hal_5018_tx.h

@@ -207,3 +207,33 @@ static void hal_tx_desc_set_lmac_id_5018(void *desc, uint8_t lmac_id)
 	HAL_SET_FLD(desc, TCL_DATA_CMD_4, LMAC_ID) |=
 		HAL_TX_SM(TCL_DATA_CMD_4, LMAC_ID, lmac_id);
 }
+
+/**
+ * hal_tx_init_cmd_credit_ring_5018() - Initialize TCL command/credit SRNG
+ * @hal_soc_hdl: Handle to HAL SoC structure
+ * @hal_srng: Handle to HAL SRNG structure
+ *
+ * Return: none
+ */
+static inline void hal_tx_init_cmd_credit_ring_5018(hal_soc_handle_t hal_soc_hdl,
+						    hal_ring_handle_t hal_ring_hdl)
+{
+	uint8_t *desc_addr;
+	struct hal_srng_params srng_params;
+	uint32_t desc_size;
+	uint32_t num_desc;
+
+	hal_get_srng_params(hal_soc_hdl, hal_ring_hdl, &srng_params);
+
+	desc_addr = (uint8_t *)srng_params.ring_base_vaddr;
+	desc_size = sizeof(struct tcl_data_cmd);
+	num_desc = srng_params.num_entries;
+
+	while (num_desc) {
+		/* using CMD/CREDIT Ring to send DATA CMD tag */
+		HAL_TX_DESC_SET_TLV_HDR(desc_addr, WIFITCL_DATA_CMD_E,
+					desc_size);
+		desc_addr += (desc_size + sizeof(struct tlv_32_hdr));
+		num_desc--;
+	}
+}

+ 2 - 0
hal/wifi3.0/qca6290/hal_6290.c

@@ -1014,6 +1014,8 @@ struct hal_hw_txrx_ops qca6290_hal_hw_txrx_ops = {
 	hal_tx_comp_get_release_reason_generic,
 	hal_get_wbm_internal_error_generic,
 	hal_tx_desc_set_mesh_en_6290,
+	hal_tx_init_cmd_credit_ring_6290,
+
 	/* rx */
 	hal_rx_msdu_start_nss_get_6290,
 	hal_rx_mon_hw_desc_get_mpdu_status_6290,

+ 13 - 1
hal/wifi3.0/qca6290/hal_6290_tx.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2020 The Linux Foundation. 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
@@ -254,3 +254,15 @@ static void hal_tx_desc_set_lmac_id_6290(void *desc, uint8_t lmac_id)
 {
 }
 #endif
+
+/**
+ * hal_tx_init_cmd_credit_ring_6290() - Initialize command/credit SRNG
+ * @hal_soc_hdl: Handle to HAL SoC structure
+ * @hal_srng: Handle to HAL SRNG structure
+ *
+ * Return: none
+ */
+static inline void hal_tx_init_cmd_credit_ring_6290(hal_soc_handle_t hal_soc_hdl,
+						    hal_ring_handle_t hal_ring_hdl)
+{
+}

+ 2 - 0
hal/wifi3.0/qca6390/hal_6390.c

@@ -1010,6 +1010,8 @@ struct hal_hw_txrx_ops qca6390_hal_hw_txrx_ops = {
 	hal_tx_comp_get_release_reason_generic,
 	hal_get_wbm_internal_error_generic,
 	hal_tx_desc_set_mesh_en_6390,
+	hal_tx_init_cmd_credit_ring_6390,
+
 	/* rx */
 	hal_rx_msdu_start_nss_get_6390,
 	hal_rx_mon_hw_desc_get_mpdu_status_6390,

+ 12 - 1
hal/wifi3.0/qca6390/hal_6390_tx.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2020 The Linux Foundation. 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
@@ -161,3 +161,14 @@ static void hal_tx_desc_set_lmac_id_6390(void *desc, uint8_t lmac_id)
 		HAL_TX_SM(TCL_DATA_CMD_4, LMAC_ID, lmac_id);
 }
 
+/**
+ * hal_tx_init_cmd_credit_ring_6390() - Initialize command/credit SRNG
+ * @hal_soc_hdl: Handle to HAL SoC structure
+ * @hal_srng: Handle to HAL SRNG structure
+ *
+ * Return: none
+ */
+static inline void hal_tx_init_cmd_credit_ring_6390(hal_soc_handle_t hal_soc_hdl,
+						    hal_ring_handle_t hal_ring_hdl)
+{
+}

+ 1 - 0
hal/wifi3.0/qca6490/hal_6490.c

@@ -1433,6 +1433,7 @@ struct hal_hw_txrx_ops qca6490_hal_hw_txrx_ops = {
 	hal_tx_comp_get_release_reason_generic,
 	hal_get_wbm_internal_error_generic,
 	hal_tx_desc_set_mesh_en_6490,
+	hal_tx_init_cmd_credit_ring_6490,
 
 	/* rx */
 	hal_rx_msdu_start_nss_get_6490,

+ 13 - 1
hal/wifi3.0/qca6490/hal_6490_tx.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2019-2020 The Linux Foundation. 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
@@ -164,3 +164,15 @@ static void hal_tx_desc_set_lmac_id_6490(void *desc, uint8_t lmac_id)
 	HAL_SET_FLD(desc, TCL_DATA_CMD_4, LMAC_ID) |=
 		HAL_TX_SM(TCL_DATA_CMD_4, LMAC_ID, lmac_id);
 }
+
+/**
+ * hal_tx_init_cmd_credit_ring_6490() - Initialize command/credit SRNG
+ * @hal_soc_hdl: Handle to HAL SoC structure
+ * @hal_srng: Handle to HAL SRNG structure
+ *
+ * Return: none
+ */
+static inline void hal_tx_init_cmd_credit_ring_6490(hal_soc_handle_t hal_soc_hdl,
+						    hal_ring_handle_t hal_ring_hdl)
+{
+}

+ 1 - 0
hal/wifi3.0/qca6750/hal_6750.c

@@ -1342,6 +1342,7 @@ struct hal_hw_txrx_ops qca6750_hal_hw_txrx_ops = {
 	hal_tx_comp_get_release_reason_generic,
 	hal_get_wbm_internal_error_generic,
 	hal_tx_desc_set_mesh_en_6750,
+	hal_tx_init_cmd_credit_ring_6750,
 
 	/* rx */
 	hal_rx_msdu_start_nss_get_6750,

+ 12 - 0
hal/wifi3.0/qca6750/hal_6750_tx.h

@@ -167,4 +167,16 @@ static void hal_tx_desc_set_lmac_id_6750(void *desc, uint8_t lmac_id)
 	HAL_SET_FLD(desc, TCL_DATA_CMD_4, LMAC_ID) |=
 		HAL_TX_SM(TCL_DATA_CMD_4, LMAC_ID, lmac_id);
 }
+
+/**
+ * hal_tx_init_cmd_credit_ring_6750() - Initialize command/credit SRNG
+ * @hal_soc_hdl: Handle to HAL SoC structure
+ * @hal_srng: Handle to HAL SRNG structure
+ *
+ * Return: none
+ */
+static inline void hal_tx_init_cmd_credit_ring_6750(hal_soc_handle_t hal_soc_hdl,
+						    hal_ring_handle_t hal_ring_hdl)
+{
+}
 #endif

+ 3 - 1
hal/wifi3.0/qca8074v1/hal_8074v1.c

@@ -1035,6 +1035,8 @@ struct hal_hw_txrx_ops qca8074_hal_hw_txrx_ops = {
 	hal_tx_comp_get_release_reason_generic,
 	hal_get_wbm_internal_error_generic,
 	hal_tx_desc_set_mesh_en_8074v1,
+	hal_tx_init_cmd_credit_ring_8074v1,
+
 	/* rx */
 	hal_rx_msdu_start_nss_get_8074,
 	hal_rx_mon_hw_desc_get_mpdu_status_8074,
@@ -1248,7 +1250,7 @@ struct hal_hw_srng_config hw_srng_table_8074[] = {
 		.start_ring_id = HAL_SRNG_SW2TCL_CMD,
 		.max_rings = 1,
 		.entry_size = (sizeof(struct tlv_32_hdr) +
-			sizeof(struct tcl_gse_cmd)) >> 2,
+			sizeof(struct tcl_data_cmd)) >> 2,
 		.lmac_ring =  FALSE,
 		.ring_dir = HAL_SRNG_SRC_RING,
 		.reg_start = {

+ 31 - 1
hal/wifi3.0/qca8074v1/hal_8074v1_tx.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2020 The Linux Foundation. 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
@@ -144,3 +144,33 @@ void hal_tx_update_dscp_tid_8074(struct hal_soc *soc, uint8_t tid,
 static void hal_tx_desc_set_lmac_id_8074(void *desc, uint8_t lmac_id)
 {
 }
+
+/**
+ * hal_tx_init_cmd_credit_ring_8074v1() - Initialize command/credit SRNG
+ * @hal_soc_hdl: Handle to HAL SoC structure
+ * @hal_srng: Handle to HAL SRNG structure
+ *
+ * Return: none
+ */
+static inline void hal_tx_init_cmd_credit_ring_8074v1(hal_soc_handle_t hal_soc_hdl,
+						      hal_ring_handle_t hal_ring_hdl)
+{
+	uint8_t *desc_addr;
+	struct hal_srng_params srng_params;
+	uint32_t desc_size;
+	uint32_t num_desc;
+
+	hal_get_srng_params(hal_soc_hdl, hal_ring_hdl, &srng_params);
+
+	desc_addr = (uint8_t *)srng_params.ring_base_vaddr;
+	desc_size = sizeof(struct tcl_data_cmd);
+	num_desc = srng_params.num_entries;
+
+	while (num_desc) {
+		/* using CMD/CREDIT Ring to send DATA CMD tag */
+		HAL_TX_DESC_SET_TLV_HDR(desc_addr, WIFITCL_DATA_CMD_E,
+					desc_size);
+		desc_addr += (desc_size + sizeof(struct tlv_32_hdr));
+		num_desc--;
+	}
+}

+ 3 - 1
hal/wifi3.0/qca8074v2/hal_8074v2.c

@@ -1032,6 +1032,7 @@ struct hal_hw_txrx_ops qca8074v2_hal_hw_txrx_ops = {
 	hal_tx_comp_get_release_reason_generic,
 	hal_get_wbm_internal_error_generic,
 	hal_tx_desc_set_mesh_en_8074v2,
+	hal_tx_init_cmd_credit_ring_8074v2,
 
 	/* rx */
 	hal_rx_msdu_start_nss_get_8074v2,
@@ -1249,10 +1250,11 @@ struct hal_hw_srng_config hw_srng_table_8074v2[] = {
 			HWIO_TCL_R0_SW2TCL1_RING_BASE_MSB_RING_SIZE_SHFT,
 	},
 	{ /* TCL_CMD */
+	  /* qca8074v2 and qcn9000 uses this ring for data commands */
 		.start_ring_id = HAL_SRNG_SW2TCL_CMD,
 		.max_rings = 1,
 		.entry_size = (sizeof(struct tlv_32_hdr) +
-			sizeof(struct tcl_gse_cmd)) >> 2,
+			sizeof(struct tcl_data_cmd)) >> 2,
 		.lmac_ring =  FALSE,
 		.ring_dir = HAL_SRNG_SRC_RING,
 		.reg_start = {

+ 30 - 1
hal/wifi3.0/qca8074v2/hal_8074v2_tx.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2020 The Linux Foundation. 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
@@ -212,3 +212,32 @@ static void hal_tx_desc_set_lmac_id_8074v2(void *desc, uint8_t lmac_id)
 		HAL_TX_SM(TCL_DATA_CMD_4, LMAC_ID, lmac_id);
 }
 
+/**
+ * hal_tx_init_cmd_credit_ring_8074v2() - Initialize command/credit SRNG
+ * @hal_soc_hdl: Handle to HAL SoC structure
+ * @hal_srng: Handle to HAL SRNG structure
+ *
+ * Return: none
+ */
+static inline void hal_tx_init_cmd_credit_ring_8074v2(hal_soc_handle_t hal_soc_hdl,
+						      hal_ring_handle_t hal_ring_hdl)
+{
+	uint8_t *desc_addr;
+	struct hal_srng_params srng_params;
+	uint32_t desc_size;
+	uint32_t num_desc;
+
+	hal_get_srng_params(hal_soc_hdl, hal_ring_hdl, &srng_params);
+
+	desc_addr = (uint8_t *)srng_params.ring_base_vaddr;
+	desc_size = sizeof(struct tcl_data_cmd);
+	num_desc = srng_params.num_entries;
+
+	while (num_desc) {
+		/* using CMD/CREDIT Ring to send DATA CMD tag */
+		HAL_TX_DESC_SET_TLV_HDR(desc_addr, WIFITCL_DATA_CMD_E,
+					desc_size);
+		desc_addr += (desc_size + sizeof(struct tlv_32_hdr));
+		num_desc--;
+	}
+}

+ 4 - 2
hal/wifi3.0/qcn9000/hal_9000.c

@@ -1412,6 +1412,7 @@ struct hal_hw_txrx_ops qcn9000_hal_hw_txrx_ops = {
 	hal_tx_comp_get_release_reason_generic,
 	hal_get_wbm_internal_error_generic,
 	hal_tx_desc_set_mesh_en_9000,
+	hal_tx_init_cmd_credit_ring_9000,
 
 	/* rx */
 	hal_rx_msdu_start_nss_get_9000,
@@ -1622,11 +1623,12 @@ struct hal_hw_srng_config hw_srng_table_9000[] = {
 			HWIO_TCL_R0_SW2TCL1_RING_BASE_MSB_RING_SIZE_BMSK >>
 			HWIO_TCL_R0_SW2TCL1_RING_BASE_MSB_RING_SIZE_SHFT,
 	},
-	{ /* TCL_CMD */
+	{ /* TCL_CMD/CREDIT */
+	  /* qca8074v2 and qcn9000 uses this ring for data commands */
 		.start_ring_id = HAL_SRNG_SW2TCL_CMD,
 		.max_rings = 1,
 		.entry_size = (sizeof(struct tlv_32_hdr) +
-			sizeof(struct tcl_gse_cmd)) >> 2,
+			sizeof(struct tcl_data_cmd)) >> 2,
 		.lmac_ring =  FALSE,
 		.ring_dir = HAL_SRNG_SRC_RING,
 		.reg_start = {

+ 31 - 1
hal/wifi3.0/qcn9000/hal_9000_tx.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2020 The Linux Foundation. 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
@@ -207,3 +207,33 @@ static void hal_tx_desc_set_lmac_id_9000(void *desc, uint8_t lmac_id)
 	HAL_SET_FLD(desc, TCL_DATA_CMD_4, LMAC_ID) |=
 		HAL_TX_SM(TCL_DATA_CMD_4, LMAC_ID, lmac_id);
 }
+
+/**
+ * hal_tx_init_cmd_credit_ring_9000() - Initialize TCL command/credit SRNG
+ * @hal_soc_hdl: Handle to HAL SoC structure
+ * @hal_srng: Handle to HAL SRNG structure
+ *
+ * Return: none
+ */
+static inline void hal_tx_init_cmd_credit_ring_9000(hal_soc_handle_t hal_soc_hdl,
+						    hal_ring_handle_t hal_ring_hdl)
+{
+	uint8_t *desc_addr;
+	struct hal_srng_params srng_params;
+	uint32_t desc_size;
+	uint32_t num_desc;
+
+	hal_get_srng_params(hal_soc_hdl, hal_ring_hdl, &srng_params);
+
+	desc_addr = (uint8_t *)srng_params.ring_base_vaddr;
+	desc_size = sizeof(struct tcl_data_cmd);
+	num_desc = srng_params.num_entries;
+
+	while (num_desc) {
+		/* using CMD/CREDIT Ring to send DATA CMD tag */
+		HAL_TX_DESC_SET_TLV_HDR(desc_addr, WIFITCL_DATA_CMD_E,
+					desc_size);
+		desc_addr += (desc_size + sizeof(struct tlv_32_hdr));
+		num_desc--;
+	}
+}