Skip to contentSkip to conversation

net: wireless: wcn36xx: Add support for pronto-v3

PATCH In review Sireesh Kodali 3 participants 8 messages Mar 11, 2023 – Mar 15, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover net: wireless: wcn36xx: Add support for pronto-v3

Hi,

Pronto-v3 is a WiFi remoteproc found on MSM8953 and other Qualcomm platforms. Support for booting the remoteproc has already been merged, however, due to a slight change in the register map between v2 and v3, the wcn36xx driver does not work on pronot-v3. This patch updates the register definitions to make wcn36xx work on pronto-v3 as well.

Regards,
Sireesh Kodali

Vladimir Lypak (1):
net: wireless: ath: wcn36xx: add support for pronto-v3

 drivers/net/wireless/ath/wcn36xx/dxe.c     | 23 +++++++++++-----------
 drivers/net/wireless/ath/wcn36xx/dxe.h     |  4 ++--
 drivers/net/wireless/ath/wcn36xx/main.c    |  1 +
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h |  1 +
 4 files changed, 16 insertions(+), 13 deletions(-)
Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/1 net: wireless: ath: wcn36xx: add support for pronto-v3

From: Vladimir Lypak <[email protected]>

Pronto v3 has a different DXE address than prior Pronto versions. This patch changes the macro to return the correct register address based on the pronto version.

---
 drivers/net/wireless/ath/wcn36xx/dxe.c     | 23 +++++++++++-----------
 drivers/net/wireless/ath/wcn36xx/dxe.h     |  4 ++--
 drivers/net/wireless/ath/wcn36xx/main.c    |  1 +
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h |  1 +
 4 files changed, 16 insertions(+), 13 deletions(-)
drivers/net/wireless/ath/wcn36xx/dxe.c +12 -11
index 4e9e13941c8f..9013f056eecb 100644
@@ -112,8 +112,8 @@ int wcn36xx_dxe_alloc_ctl_blks(struct wcn36xx *wcn)
 	wcn->dxe_rx_l_ch.desc_num = WCN36XX_DXE_CH_DESC_NUMB_RX_L;
 	wcn->dxe_rx_h_ch.desc_num = WCN36XX_DXE_CH_DESC_NUMB_RX_H;
 
-	wcn->dxe_tx_l_ch.dxe_wq =  WCN36XX_DXE_WQ_TX_L;
-	wcn->dxe_tx_h_ch.dxe_wq =  WCN36XX_DXE_WQ_TX_H;
+	wcn->dxe_tx_l_ch.dxe_wq =  WCN36XX_DXE_WQ_TX_L(wcn);
+	wcn->dxe_tx_h_ch.dxe_wq =  WCN36XX_DXE_WQ_TX_H(wcn);
 
 	wcn->dxe_tx_l_ch.ctrl_bd = WCN36XX_DXE_CTRL_TX_L_BD;
 	wcn->dxe_tx_h_ch.ctrl_bd = WCN36XX_DXE_CTRL_TX_H_BD;
@@ -165,8 +165,9 @@ void wcn36xx_dxe_free_ctl_blks(struct wcn36xx *wcn)
 	wcn36xx_dxe_free_ctl_block(&wcn->dxe_rx_h_ch);
 }
 
-static int wcn36xx_dxe_init_descs(struct device *dev, struct wcn36xx_dxe_ch *wcn_ch)
+static int wcn36xx_dxe_init_descs(struct wcn36xx *wcn, struct wcn36xx_dxe_ch *wcn_ch)
 {
+	struct device *dev = wcn->dev;
 	struct wcn36xx_dxe_desc *cur_dxe = NULL;
 	struct wcn36xx_dxe_desc *prev_dxe = NULL;
 	struct wcn36xx_dxe_ctl *cur_ctl = NULL;
@@ -190,11 +191,11 @@ static int wcn36xx_dxe_init_descs(struct device *dev, struct wcn36xx_dxe_ch *wcn
 		switch (wcn_ch->ch_type) {
 		case WCN36XX_DXE_CH_TX_L:
 			cur_dxe->ctrl = WCN36XX_DXE_CTRL_TX_L;
-			cur_dxe->dst_addr_l = WCN36XX_DXE_WQ_TX_L;
+			cur_dxe->dst_addr_l = WCN36XX_DXE_WQ_TX_L(wcn);
 			break;
 		case WCN36XX_DXE_CH_TX_H:
 			cur_dxe->ctrl = WCN36XX_DXE_CTRL_TX_H;
-			cur_dxe->dst_addr_l = WCN36XX_DXE_WQ_TX_H;
+			cur_dxe->dst_addr_l = WCN36XX_DXE_WQ_TX_H(wcn);
 			break;
 		case WCN36XX_DXE_CH_RX_L:
 			cur_dxe->ctrl = WCN36XX_DXE_CTRL_RX_L;
@@ -914,7 +915,7 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn)
 	/***************************************/
 	/* Init descriptors for TX LOW channel */
 	/***************************************/
-	ret = wcn36xx_dxe_init_descs(wcn->dev, &wcn->dxe_tx_l_ch);
+	ret = wcn36xx_dxe_init_descs(wcn, &wcn->dxe_tx_l_ch);
 	if (ret) {
 		dev_err(wcn->dev, "Error allocating descriptor\n");
 		return ret;
@@ -928,14 +929,14 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn)
 	/* Program DMA destination addr for TX LOW */
 	wcn36xx_dxe_write_register(wcn,
 		WCN36XX_DXE_CH_DEST_ADDR_TX_L,
-		WCN36XX_DXE_WQ_TX_L);
+		WCN36XX_DXE_WQ_TX_L(wcn));
 
 	wcn36xx_dxe_read_register(wcn, WCN36XX_DXE_REG_CH_EN, &reg_data);
 
 	/***************************************/
 	/* Init descriptors for TX HIGH channel */
 	/***************************************/
-	ret = wcn36xx_dxe_init_descs(wcn->dev, &wcn->dxe_tx_h_ch);
+	ret = wcn36xx_dxe_init_descs(wcn, &wcn->dxe_tx_h_ch);
 	if (ret) {
 		dev_err(wcn->dev, "Error allocating descriptor\n");
 		goto out_err_txh_ch;
@@ -950,14 +951,14 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn)
 	/* Program DMA destination addr for TX HIGH */
 	wcn36xx_dxe_write_register(wcn,
 		WCN36XX_DXE_CH_DEST_ADDR_TX_H,
-		WCN36XX_DXE_WQ_TX_H);
+		WCN36XX_DXE_WQ_TX_H(wcn));
 
 	wcn36xx_dxe_read_register(wcn, WCN36XX_DXE_REG_CH_EN, &reg_data);
 
 	/***************************************/
 	/* Init descriptors for RX LOW channel */
 	/***************************************/
-	ret = wcn36xx_dxe_init_descs(wcn->dev, &wcn->dxe_rx_l_ch);
+	ret = wcn36xx_dxe_init_descs(wcn, &wcn->dxe_rx_l_ch);
 	if (ret) {
 		dev_err(wcn->dev, "Error allocating descriptor\n");
 		goto out_err_rxl_ch;
@@ -988,7 +989,7 @@ int wcn36xx_dxe_init(struct wcn36xx *wcn)
 	/***************************************/
 	/* Init descriptors for RX HIGH channel */
 	/***************************************/
-	ret = wcn36xx_dxe_init_descs(wcn->dev, &wcn->dxe_rx_h_ch);
+	ret = wcn36xx_dxe_init_descs(wcn, &wcn->dxe_rx_h_ch);
 	if (ret) {
 		dev_err(wcn->dev, "Error allocating descriptor\n");
 		goto out_err_rxh_ch;
drivers/net/wireless/ath/wcn36xx/dxe.h +2 -2
index 26a31edf52e9..dd8c684a3ba7 100644
@@ -135,8 +135,8 @@ H2H_TEST_RX_TX = DMA2
 	WCN36xx_DXE_CTRL_ENDIANNESS)
 
 /* TODO This must calculated properly but not hardcoded */
-#define WCN36XX_DXE_WQ_TX_L			0x17
-#define WCN36XX_DXE_WQ_TX_H			0x17
+#define WCN36XX_DXE_WQ_TX_L(wcn)    ((wcn)->is_pronto_v3 ? 0x6 : 0x17)
+#define WCN36XX_DXE_WQ_TX_H(wcn)    ((wcn)->is_pronto_v3 ? 0x6 : 0x17)
 #define WCN36XX_DXE_WQ_RX_L			0xB
 #define WCN36XX_DXE_WQ_RX_H			0x4
 
drivers/net/wireless/ath/wcn36xx/main.c +1 -0
index 3b79cc1c7c5b..8dbd115a393c 100644
@@ -1508,6 +1508,7 @@ static int wcn36xx_platform_get_resources(struct wcn36xx *wcn,
 	}
 
 	wcn->is_pronto = !!of_device_is_compatible(mmio_node, "qcom,pronto");
+	wcn->is_pronto_v3 = !!of_device_is_compatible(mmio_node, "qcom,pronto-v3-pil");
 
 	/* Map the CCU memory */
 	index = of_property_match_string(mmio_node, "reg-names", "ccu");
drivers/net/wireless/ath/wcn36xx/wcn36xx.h +1 -0
index 9aa08b636d08..ff4a8e5d7209 100644
@@ -217,6 +217,7 @@ struct wcn36xx {
 	u8			fw_major;
 	u32			fw_feat_caps[WCN36XX_HAL_CAPS_SIZE];
 	bool			is_pronto;
+	bool			is_pronto_v3;
 
 	/* extra byte for the NULL termination */
 	u8			crm_version[WCN36XX_HAL_VERSION_LENGTH + 1];
Signature · 1 line
2.39.2
#2 lore raw

Re: [PATCH 1/1] net: wireless: ath: wcn36xx: add support for pronto-v3

Quoted 6 lines · Sireesh Kodali

From: Vladimir Lypak <[email protected]>

Pronto v3 has a different DXE address than prior Pronto versions. This patch changes the macro to return the correct register address based on the pronto version.

Quoted 8 lines
---
 drivers/net/wireless/ath/wcn36xx/dxe.c     | 23 +++++++++++-----------
 drivers/net/wireless/ath/wcn36xx/dxe.h     |  4 ++--
 drivers/net/wireless/ath/wcn36xx/main.c    |  1 +
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h |  1 +
 4 files changed, 16 insertions(+), 13 deletions(-)

The title should be:

wifi: wcn36xx: add support for pronto-v3

I can fix that, no need to resend because of this.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#3 lore raw

Re: [PATCH 1/1] net: wireless: ath: wcn36xx: add support for pronto-v3

Quoted 17 lines · Kalle Valo
Quoted 6 lines · Sireesh Kodali

From: Vladimir Lypak <[email protected]>

Pronto v3 has a different DXE address than prior Pronto versions. This patch changes the macro to return the correct register address based on the pronto version.

Quoted 8 lines
---
 drivers/net/wireless/ath/wcn36xx/dxe.c     | 23 +++++++++++-----------
 drivers/net/wireless/ath/wcn36xx/dxe.h     |  4 ++--
 drivers/net/wireless/ath/wcn36xx/main.c    |  1 +
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h |  1 +
 4 files changed, 16 insertions(+), 13 deletions(-)
Quoted 10 lines

The title should be:

wifi: wcn36xx: add support for pronto-v3

I can fix that, no need to resend because of this.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

Thank you, I'll keep this in mind when submitting future patches

Acked-by on v1 1/1
#4 lore raw

Re: [PATCH 1/1] net: wireless: ath: wcn36xx: add support for pronto-v3

In reply to Sireesh Kodali
Quoted 9 lines · Sireesh Kodali

From: Vladimir Lypak <[email protected]>

Pronto v3 has a different DXE address than prior Pronto versions. This patch changes the macro to return the correct register address based on the pronto version.

Could you also submit a change for the new 'qcom,pronto-v3-pil' compatible in the related devicetree documentation ? (bindings/remoteproc/qcom,wcnss-pil.txt)

#5 lore raw

Re: [PATCH 1/1] net: wireless: ath: wcn36xx: add support for pronto-v3

Quoted 8 lines · Loic Poulain
Quoted 7 lines · Sireesh Kodali

From: Vladimir Lypak <[email protected]>

Pronto v3 has a different DXE address than prior Pronto versions. This patch changes the macro to return the correct register address based on the pronto version.

Quoted 8 lines
Quoted 2 lines

Could you also submit a change for the new 'qcom,pronto-v3-pil' compatible in the related devicetree documentation ? (bindings/remoteproc/qcom,wcnss-pil.txt)

The changes to the device tree were only recently merged LKML link: https://lkml.org/lkml/2022/9/30/1502

#6 lore raw

Re: [PATCH 1/1] net: wireless: ath: wcn36xx: add support for pronto-v3

Quoted 13 lines · Sireesh Kodali
Quoted 11 lines · Loic Poulain
Quoted 9 lines · Sireesh Kodali

From: Vladimir Lypak <[email protected]>

Pronto v3 has a different DXE address than prior Pronto versions. This patch changes the macro to return the correct register address based on the pronto version.

Quoted 8 lines
Quoted 5 lines

Could you also submit a change for the new 'qcom,pronto-v3-pil' compatible in the related devicetree documentation ? (bindings/remoteproc/qcom,wcnss-pil.txt)

The changes to the device tree were only recently merged LKML link: https://lkml.org/lkml/2022/9/30/1502

Perfect, thanks.

Loic

#7 lore raw

Re: [PATCH 1/1] net: wireless: ath: wcn36xx: add support for pronto-v3

In reply to Sireesh Kodali
Quoted 7 lines · Sireesh Kodali

Pronto v3 has a different DXE address than prior Pronto versions. This patch changes the macro to return the correct register address based on the pronto version.

Patch applied to ath-next branch of ath.git, thanks.

f94557154d9f wifi: wcn36xx: add support for pronto-v3

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches