All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] qcom: wcnss: Allow overriding firmware form DT
@ 2021-03-12  0:33 Bjorn Andersson
  2021-03-12  0:33 ` [PATCH 1/5] dt-bindings: soc: qcom: wcnss: Add firmware-name property Bjorn Andersson
                   ` (6 more replies)
  0 siblings, 7 replies; 24+ messages in thread
From: Bjorn Andersson @ 2021-03-12  0:33 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Rob Herring, Kalle Valo,
	David S. Miller, Jakub Kicinski, Bryan O'Donoghue
  Cc: linux-arm-msm, devicetree, linux-kernel, wcn36xx, linux-wireless, netdev

The wireless subsystem found in Qualcomm MSM8974 and MSM8916 among others needs
platform-, and perhaps even board-, specific firmware. Add support for
providing this in devicetree.

Bjorn Andersson (5):
  dt-bindings: soc: qcom: wcnss: Add firmware-name property
  wcn36xx: Allow firmware name to be overridden by DT
  soc: qcom: wcnss_ctrl: Introduce local variable "dev"
  soc: qcom: wcnss_ctrl: Allow reading firmware-name from DT
  arm64: dts: qcom: msm8916: Enable modem and WiFi

 .../devicetree/bindings/soc/qcom/qcom,wcnss.txt   |  7 +++++++
 arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi         | 12 ++++++++++++
 arch/arm64/boot/dts/qcom/msm8916.dtsi             |  2 +-
 drivers/net/wireless/ath/wcn36xx/main.c           |  7 +++++++
 drivers/net/wireless/ath/wcn36xx/smd.c            |  4 ++--
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h        |  1 +
 drivers/soc/qcom/wcnss_ctrl.c                     | 15 ++++++++++-----
 7 files changed, 40 insertions(+), 8 deletions(-)

-- 
2.29.2


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 1/5] dt-bindings: soc: qcom: wcnss: Add firmware-name property
  2021-03-12  0:33 [PATCH 0/5] qcom: wcnss: Allow overriding firmware form DT Bjorn Andersson
@ 2021-03-12  0:33 ` Bjorn Andersson
  2021-03-22 21:00   ` Anibal Limon
  2021-03-24 15:21   ` Rob Herring
  2021-03-12  0:33 ` [PATCH 2/5] wcn36xx: Allow firmware name to be overridden by DT Bjorn Andersson
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 24+ messages in thread
From: Bjorn Andersson @ 2021-03-12  0:33 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Rob Herring, Kalle Valo,
	David S. Miller, Jakub Kicinski, Bryan O'Donoghue
  Cc: linux-arm-msm, devicetree, linux-kernel, wcn36xx, linux-wireless, netdev

The WCNSS needs firmware which differs between platforms, and possibly
boards. Add a new property "firmware-name" to allow the DT to specify
the platform/board specific path to this firmware file.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt b/Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt
index 042a2e4159bd..1382b64e1381 100644
--- a/Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt
@@ -24,6 +24,13 @@ block and a BT, WiFi and FM radio block, all using SMD as command channels.
 		    "qcom,riva",
 		    "qcom,pronto"
 
+- firmware-name:
+	Usage: optional
+	Value type: <string>
+	Definition: specifies the relative firmware image path for the WLAN NV
+		    blob. Defaults to "wlan/prima/WCNSS_qcom_wlan_nv.bin" if
+		    not specified.
+
 = SUBNODES
 The subnodes of the wcnss node are optional and describe the individual blocks in
 the WCNSS.
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 2/5] wcn36xx: Allow firmware name to be overridden by DT
  2021-03-12  0:33 [PATCH 0/5] qcom: wcnss: Allow overriding firmware form DT Bjorn Andersson
  2021-03-12  0:33 ` [PATCH 1/5] dt-bindings: soc: qcom: wcnss: Add firmware-name property Bjorn Andersson
@ 2021-03-12  0:33 ` Bjorn Andersson
  2021-03-15 11:58   ` Bryan O'Donoghue
  2021-03-22 21:01   ` Anibal Limon
  2021-03-12  0:33 ` [PATCH 3/5] soc: qcom: wcnss_ctrl: Introduce local variable "dev" Bjorn Andersson
                   ` (4 subsequent siblings)
  6 siblings, 2 replies; 24+ messages in thread
From: Bjorn Andersson @ 2021-03-12  0:33 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Rob Herring, Kalle Valo,
	David S. Miller, Jakub Kicinski, Bryan O'Donoghue
  Cc: linux-arm-msm, devicetree, linux-kernel, wcn36xx, linux-wireless, netdev

The WLAN NV firmware blob differs between platforms, and possibly
devices, so add support in the wcn36xx driver for reading the path of
this file from DT in order to allow these files to live in a generic
file system (or linux-firmware).

For some reason the parent (wcnss_ctrl) also needs to upload this blob,
so rather than specifying the same information in both nodes wcn36xx
reads the string from the parent's of_node.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---

This patch can be applied independently of the others, but relates to the
acceptance of the addition to the DT binding (in patch 1/5). So my suggestion
is that this one goes through the ath tree and the others through the Qualcomm
SoC tree.

 drivers/net/wireless/ath/wcn36xx/main.c    | 7 +++++++
 drivers/net/wireless/ath/wcn36xx/smd.c     | 4 ++--
 drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 +
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index afb4877eaad8..87b5c0ff16c0 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -1407,6 +1407,13 @@ static int wcn36xx_probe(struct platform_device *pdev)
 		goto out_wq;
 	}
 
+	wcn->nv_file = WLAN_NV_FILE;
+	ret = of_property_read_string(wcn->dev->parent->of_node, "firmware-name", &wcn->nv_file);
+	if (ret < 0 && ret != -EINVAL) {
+		wcn36xx_err("failed to read \"firmware-name\" property\n");
+		goto out_wq;
+	}
+
 	wcn->smd_channel = qcom_wcnss_open_channel(wcnss, "WLAN_CTRL", wcn36xx_smd_rsp_process, hw);
 	if (IS_ERR(wcn->smd_channel)) {
 		wcn36xx_err("failed to open WLAN_CTRL channel\n");
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
index d0c3a1557e8d..7b928f988068 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -514,10 +514,10 @@ int wcn36xx_smd_load_nv(struct wcn36xx *wcn)
 	u16 fm_offset = 0;
 
 	if (!wcn->nv) {
-		ret = request_firmware(&wcn->nv, WLAN_NV_FILE, wcn->dev);
+		ret = request_firmware(&wcn->nv, wcn->nv_file, wcn->dev);
 		if (ret) {
 			wcn36xx_err("Failed to load nv file %s: %d\n",
-				      WLAN_NV_FILE, ret);
+				    wcn->nv_file, ret);
 			goto out;
 		}
 	}
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index 71fa9992b118..5977af2116e3 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -185,6 +185,7 @@ struct wcn36xx {
 	struct device		*dev;
 	struct list_head	vif_list;
 
+	const char		*nv_file;
 	const struct firmware	*nv;
 
 	u8			fw_revision;
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 3/5] soc: qcom: wcnss_ctrl: Introduce local variable "dev"
  2021-03-12  0:33 [PATCH 0/5] qcom: wcnss: Allow overriding firmware form DT Bjorn Andersson
  2021-03-12  0:33 ` [PATCH 1/5] dt-bindings: soc: qcom: wcnss: Add firmware-name property Bjorn Andersson
  2021-03-12  0:33 ` [PATCH 2/5] wcn36xx: Allow firmware name to be overridden by DT Bjorn Andersson
@ 2021-03-12  0:33 ` Bjorn Andersson
  2021-03-22 21:01   ` Anibal Limon
  2021-03-12  0:33 ` [PATCH 4/5] soc: qcom: wcnss_ctrl: Allow reading firmware-name from DT Bjorn Andersson
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 24+ messages in thread
From: Bjorn Andersson @ 2021-03-12  0:33 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Rob Herring, Bryan O'Donoghue
  Cc: Kalle Valo, David S. Miller, Jakub Kicinski, linux-arm-msm,
	devicetree, linux-kernel, wcn36xx, linux-wireless, netdev

Introduce a local variable to carry the struct device *, to reduce the
line lengths in the next patch.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 drivers/soc/qcom/wcnss_ctrl.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/soc/qcom/wcnss_ctrl.c b/drivers/soc/qcom/wcnss_ctrl.c
index 32bed249f90e..358526b9de06 100644
--- a/drivers/soc/qcom/wcnss_ctrl.c
+++ b/drivers/soc/qcom/wcnss_ctrl.c
@@ -199,6 +199,7 @@ static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc)
 {
 	struct wcnss_download_nv_req *req;
 	const struct firmware *fw;
+	struct device *dev = wcnss->dev;
 	const void *data;
 	ssize_t left;
 	int ret;
@@ -207,9 +208,9 @@ static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc)
 	if (!req)
 		return -ENOMEM;
 
-	ret = request_firmware(&fw, NVBIN_FILE, wcnss->dev);
+	ret = request_firmware(&fw, NVBIN_FILE, dev);
 	if (ret < 0) {
-		dev_err(wcnss->dev, "Failed to load nv file %s: %d\n",
+		dev_err(dev, "Failed to load nv file %s: %d\n",
 			NVBIN_FILE, ret);
 		goto free_req;
 	}
@@ -235,7 +236,7 @@ static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc)
 
 		ret = rpmsg_send(wcnss->channel, req, req->hdr.len);
 		if (ret < 0) {
-			dev_err(wcnss->dev, "failed to send smd packet\n");
+			dev_err(dev, "failed to send smd packet\n");
 			goto release_fw;
 		}
 
@@ -248,7 +249,7 @@ static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc)
 
 	ret = wait_for_completion_timeout(&wcnss->ack, WCNSS_REQUEST_TIMEOUT);
 	if (!ret) {
-		dev_err(wcnss->dev, "timeout waiting for nv upload ack\n");
+		dev_err(dev, "timeout waiting for nv upload ack\n");
 		ret = -ETIMEDOUT;
 	} else {
 		*expect_cbc = wcnss->ack_status == WCNSS_ACK_COLD_BOOTING;
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 4/5] soc: qcom: wcnss_ctrl: Allow reading firmware-name from DT
  2021-03-12  0:33 [PATCH 0/5] qcom: wcnss: Allow overriding firmware form DT Bjorn Andersson
                   ` (2 preceding siblings ...)
  2021-03-12  0:33 ` [PATCH 3/5] soc: qcom: wcnss_ctrl: Introduce local variable "dev" Bjorn Andersson
@ 2021-03-12  0:33 ` Bjorn Andersson
  2021-03-15 11:57   ` Bryan O'Donoghue
  2021-03-22 21:02   ` Anibal Limon
  2021-03-12  0:33 ` [PATCH 5/5] arm64: dts: qcom: msm8916: Enable modem and WiFi Bjorn Andersson
                   ` (2 subsequent siblings)
  6 siblings, 2 replies; 24+ messages in thread
From: Bjorn Andersson @ 2021-03-12  0:33 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Rob Herring, Bryan O'Donoghue
  Cc: Kalle Valo, David S. Miller, Jakub Kicinski, linux-arm-msm,
	devicetree, linux-kernel, wcn36xx, linux-wireless, netdev

The WLAN NV firmware blob differs between platforms, and possibly
devices, so add support in the wcnss_ctrl driver for reading the path of
this file from DT in order to allow these files to live in a generic
file system (or linux-firmware).

The new property is optional and the code falls back to the old filename
if the property isn't specified.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 drivers/soc/qcom/wcnss_ctrl.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/soc/qcom/wcnss_ctrl.c b/drivers/soc/qcom/wcnss_ctrl.c
index 358526b9de06..2a06d631e415 100644
--- a/drivers/soc/qcom/wcnss_ctrl.c
+++ b/drivers/soc/qcom/wcnss_ctrl.c
@@ -200,6 +200,7 @@ static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc)
 	struct wcnss_download_nv_req *req;
 	const struct firmware *fw;
 	struct device *dev = wcnss->dev;
+	const char *nvbin = NVBIN_FILE;
 	const void *data;
 	ssize_t left;
 	int ret;
@@ -208,10 +209,13 @@ static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc)
 	if (!req)
 		return -ENOMEM;
 
-	ret = request_firmware(&fw, NVBIN_FILE, dev);
+	ret = of_property_read_string(dev->of_node, "firmware-name", &nvbin);
+	if (ret < 0 && ret != -EINVAL)
+		goto free_req;
+
+	ret = request_firmware(&fw, nvbin, dev);
 	if (ret < 0) {
-		dev_err(dev, "Failed to load nv file %s: %d\n",
-			NVBIN_FILE, ret);
+		dev_err(dev, "Failed to load nv file %s: %d\n", nvbin, ret);
 		goto free_req;
 	}
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 5/5] arm64: dts: qcom: msm8916: Enable modem and WiFi
  2021-03-12  0:33 [PATCH 0/5] qcom: wcnss: Allow overriding firmware form DT Bjorn Andersson
                   ` (3 preceding siblings ...)
  2021-03-12  0:33 ` [PATCH 4/5] soc: qcom: wcnss_ctrl: Allow reading firmware-name from DT Bjorn Andersson
@ 2021-03-12  0:33 ` Bjorn Andersson
  2021-03-15 11:57   ` Bryan O'Donoghue
                     ` (2 more replies)
  2021-03-18 16:48 ` [PATCH 0/5] qcom: wcnss: Allow overriding firmware form DT Vinod Koul
  2021-03-18 16:56 ` Jeffrey Hugo
  6 siblings, 3 replies; 24+ messages in thread
From: Bjorn Andersson @ 2021-03-12  0:33 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Rob Herring, Bryan O'Donoghue
  Cc: Kalle Valo, David S. Miller, Jakub Kicinski, linux-arm-msm,
	devicetree, linux-kernel, wcn36xx, linux-wireless, netdev

Enable the modem and WiFi subsystems and specify msm8916 specific
firmware path for these and the WCNSS control service.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi | 12 ++++++++++++
 arch/arm64/boot/dts/qcom/msm8916.dtsi     |  2 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
index 6aef0c2e4f0a..448e3561ef63 100644
--- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
+++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
@@ -305,6 +305,12 @@ &mdss {
 	status = "okay";
 };
 
+&mpss {
+	status = "okay";
+
+	firmware-name = "qcom/msm8916/mba.mbn", "qcom/msm8916/modem.mbn";
+};
+
 &pm8916_resin {
 	status = "okay";
 	linux,code = <KEY_VOLUMEDOWN>;
@@ -312,6 +318,8 @@ &pm8916_resin {
 
 &pronto {
 	status = "okay";
+
+	firmware-name = "qcom/msm8916/wcnss.mbn";
 };
 
 &sdhc_1 {
@@ -394,6 +402,10 @@ &wcd_codec {
 	qcom,mbhc-vthreshold-high = <75 150 237 450 500>;
 };
 
+&wcnss_ctrl {
+	firmware-name = "qcom/msm8916/WCNSS_qcom_wlan_nv.bin";
+};
+
 /* Enable CoreSight */
 &cti0 { status = "okay"; };
 &cti1 { status = "okay"; };
diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi
index 5353da521974..1118836c15dd 100644
--- a/arch/arm64/boot/dts/qcom/msm8916.dtsi
+++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi
@@ -1738,7 +1738,7 @@ smd-edge {
 
 				label = "pronto";
 
-				wcnss {
+				wcnss_ctrl: wcnss {
 					compatible = "qcom,wcnss";
 					qcom,smd-channels = "WCNSS_CTRL";
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] arm64: dts: qcom: msm8916: Enable modem and WiFi
  2021-03-12  0:33 ` [PATCH 5/5] arm64: dts: qcom: msm8916: Enable modem and WiFi Bjorn Andersson
@ 2021-03-15 11:57   ` Bryan O'Donoghue
  2021-03-15 12:01   ` Bryan O'Donoghue
  2021-03-19 15:19   ` Stephan Gerhold
  2 siblings, 0 replies; 24+ messages in thread
From: Bryan O'Donoghue @ 2021-03-15 11:57 UTC (permalink / raw)
  To: Bjorn Andersson, Andy Gross, Rob Herring
  Cc: Kalle Valo, David S. Miller, Jakub Kicinski, linux-arm-msm,
	devicetree, linux-kernel, wcn36xx, linux-wireless, netdev

On 12/03/2021 00:33, Bjorn Andersson wrote:
> firmware-name = "qcom/msm8916/WCNSS_qcom_wlan_nv.bin";

On the Linaro debian build I have to do this

+       firmware-name = "wlan/prima/WCNSS_qcom_wlan_nv.bin";

---
bod

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 4/5] soc: qcom: wcnss_ctrl: Allow reading firmware-name from DT
  2021-03-12  0:33 ` [PATCH 4/5] soc: qcom: wcnss_ctrl: Allow reading firmware-name from DT Bjorn Andersson
@ 2021-03-15 11:57   ` Bryan O'Donoghue
  2021-03-22 21:02   ` Anibal Limon
  1 sibling, 0 replies; 24+ messages in thread
From: Bryan O'Donoghue @ 2021-03-15 11:57 UTC (permalink / raw)
  To: Bjorn Andersson, Andy Gross, Rob Herring
  Cc: Kalle Valo, David S. Miller, Jakub Kicinski, linux-arm-msm,
	devicetree, linux-kernel, wcn36xx, linux-wireless, netdev

On 12/03/2021 00:33, Bjorn Andersson wrote:
> The WLAN NV firmware blob differs between platforms, and possibly
> devices, so add support in the wcnss_ctrl driver for reading the path of
> this file from DT in order to allow these files to live in a generic
> file system (or linux-firmware).
> 
> The new property is optional and the code falls back to the old filename
> if the property isn't specified.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
>   drivers/soc/qcom/wcnss_ctrl.c | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/soc/qcom/wcnss_ctrl.c b/drivers/soc/qcom/wcnss_ctrl.c
> index 358526b9de06..2a06d631e415 100644
> --- a/drivers/soc/qcom/wcnss_ctrl.c
> +++ b/drivers/soc/qcom/wcnss_ctrl.c
> @@ -200,6 +200,7 @@ static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc)
>   	struct wcnss_download_nv_req *req;
>   	const struct firmware *fw;
>   	struct device *dev = wcnss->dev;
> +	const char *nvbin = NVBIN_FILE;
>   	const void *data;
>   	ssize_t left;
>   	int ret;
> @@ -208,10 +209,13 @@ static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc)
>   	if (!req)
>   		return -ENOMEM;
>   
> -	ret = request_firmware(&fw, NVBIN_FILE, dev);
> +	ret = of_property_read_string(dev->of_node, "firmware-name", &nvbin);
> +	if (ret < 0 && ret != -EINVAL)
> +		goto free_req;
> +
> +	ret = request_firmware(&fw, nvbin, dev);
>   	if (ret < 0) {
> -		dev_err(dev, "Failed to load nv file %s: %d\n",
> -			NVBIN_FILE, ret);
> +		dev_err(dev, "Failed to load nv file %s: %d\n", nvbin, ret);
>   		goto free_req;
>   	}
>   
> 

Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2/5] wcn36xx: Allow firmware name to be overridden by DT
  2021-03-12  0:33 ` [PATCH 2/5] wcn36xx: Allow firmware name to be overridden by DT Bjorn Andersson
@ 2021-03-15 11:58   ` Bryan O'Donoghue
  2021-03-22 21:01   ` Anibal Limon
  1 sibling, 0 replies; 24+ messages in thread
From: Bryan O'Donoghue @ 2021-03-15 11:58 UTC (permalink / raw)
  To: Bjorn Andersson, Andy Gross, Rob Herring, Kalle Valo,
	David S. Miller, Jakub Kicinski
  Cc: linux-arm-msm, devicetree, linux-kernel, wcn36xx, linux-wireless, netdev

On 12/03/2021 00:33, Bjorn Andersson wrote:
> The WLAN NV firmware blob differs between platforms, and possibly
> devices, so add support in the wcn36xx driver for reading the path of
> this file from DT in order to allow these files to live in a generic
> file system (or linux-firmware).
> 
> For some reason the parent (wcnss_ctrl) also needs to upload this blob,
> so rather than specifying the same information in both nodes wcn36xx
> reads the string from the parent's of_node.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
> 
> This patch can be applied independently of the others, but relates to the
> acceptance of the addition to the DT binding (in patch 1/5). So my suggestion
> is that this one goes through the ath tree and the others through the Qualcomm
> SoC tree.
> 
>   drivers/net/wireless/ath/wcn36xx/main.c    | 7 +++++++
>   drivers/net/wireless/ath/wcn36xx/smd.c     | 4 ++--
>   drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 +
>   3 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
> index afb4877eaad8..87b5c0ff16c0 100644
> --- a/drivers/net/wireless/ath/wcn36xx/main.c
> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
> @@ -1407,6 +1407,13 @@ static int wcn36xx_probe(struct platform_device *pdev)
>   		goto out_wq;
>   	}
>   
> +	wcn->nv_file = WLAN_NV_FILE;
> +	ret = of_property_read_string(wcn->dev->parent->of_node, "firmware-name", &wcn->nv_file);
> +	if (ret < 0 && ret != -EINVAL) {
> +		wcn36xx_err("failed to read \"firmware-name\" property\n");
> +		goto out_wq;
> +	}
> +
>   	wcn->smd_channel = qcom_wcnss_open_channel(wcnss, "WLAN_CTRL", wcn36xx_smd_rsp_process, hw);
>   	if (IS_ERR(wcn->smd_channel)) {
>   		wcn36xx_err("failed to open WLAN_CTRL channel\n");
> diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
> index d0c3a1557e8d..7b928f988068 100644
> --- a/drivers/net/wireless/ath/wcn36xx/smd.c
> +++ b/drivers/net/wireless/ath/wcn36xx/smd.c
> @@ -514,10 +514,10 @@ int wcn36xx_smd_load_nv(struct wcn36xx *wcn)
>   	u16 fm_offset = 0;
>   
>   	if (!wcn->nv) {
> -		ret = request_firmware(&wcn->nv, WLAN_NV_FILE, wcn->dev);
> +		ret = request_firmware(&wcn->nv, wcn->nv_file, wcn->dev);
>   		if (ret) {
>   			wcn36xx_err("Failed to load nv file %s: %d\n",
> -				      WLAN_NV_FILE, ret);
> +				    wcn->nv_file, ret);
>   			goto out;
>   		}
>   	}
> diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
> index 71fa9992b118..5977af2116e3 100644
> --- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
> +++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
> @@ -185,6 +185,7 @@ struct wcn36xx {
>   	struct device		*dev;
>   	struct list_head	vif_list;
>   
> +	const char		*nv_file;
>   	const struct firmware	*nv;
>   
>   	u8			fw_revision;
> 

Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] arm64: dts: qcom: msm8916: Enable modem and WiFi
  2021-03-12  0:33 ` [PATCH 5/5] arm64: dts: qcom: msm8916: Enable modem and WiFi Bjorn Andersson
  2021-03-15 11:57   ` Bryan O'Donoghue
@ 2021-03-15 12:01   ` Bryan O'Donoghue
  2021-03-18 14:50     ` Bjorn Andersson
  2021-03-19 15:19   ` Stephan Gerhold
  2 siblings, 1 reply; 24+ messages in thread
From: Bryan O'Donoghue @ 2021-03-15 12:01 UTC (permalink / raw)
  To: Bjorn Andersson, Andy Gross, Rob Herring
  Cc: Kalle Valo, David S. Miller, Jakub Kicinski, linux-arm-msm,
	devicetree, linux-kernel, wcn36xx, linux-wireless, netdev

On 12/03/2021 00:33, Bjorn Andersson wrote:
> Enable the modem and WiFi subsystems and specify msm8916 specific
> firmware path for these and the WCNSS control service.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
>   arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi | 12 ++++++++++++
>   arch/arm64/boot/dts/qcom/msm8916.dtsi     |  2 +-
>   2 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
> index 6aef0c2e4f0a..448e3561ef63 100644
> --- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
> +++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
> @@ -305,6 +305,12 @@ &mdss {
>   	status = "okay";
>   };
>   
> +&mpss {
> +	status = "okay";
> +
> +	firmware-name = "qcom/msm8916/mba.mbn", "qcom/msm8916/modem.mbn";
> +};
> +
>   &pm8916_resin {
>   	status = "okay";
>   	linux,code = <KEY_VOLUMEDOWN>;
> @@ -312,6 +318,8 @@ &pm8916_resin {
>   
>   &pronto {
>   	status = "okay";
> +
> +	firmware-name = "qcom/msm8916/wcnss.mbn";
>   };

On Debian I have to do this


index 2a6a23cb14ca..597cdc8f51cc 100644
--- a/drivers/remoteproc/qcom_wcnss.c
+++ b/drivers/remoteproc/qcom_wcnss.c
@@ -33,7 +33,7 @@
  #include "qcom_wcnss.h"

  #define WCNSS_CRASH_REASON_SMEM                422
-#define WCNSS_FIRMWARE_NAME            "wcnss.mdt"
+#define WCNSS_FIRMWARE_NAME            "qcom/msm8916/wcnss.mdt"

so I guess wcnss_probe() -> rproc_alloc() wants this fix too.

---
bod

^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] arm64: dts: qcom: msm8916: Enable modem and WiFi
  2021-03-15 12:01   ` Bryan O'Donoghue
@ 2021-03-18 14:50     ` Bjorn Andersson
  2021-03-19 14:41       ` Bryan O'Donoghue
  0 siblings, 1 reply; 24+ messages in thread
From: Bjorn Andersson @ 2021-03-18 14:50 UTC (permalink / raw)
  To: Bryan O'Donoghue
  Cc: Andy Gross, Rob Herring, Kalle Valo, David S. Miller,
	Jakub Kicinski, linux-arm-msm, devicetree, linux-kernel, wcn36xx,
	linux-wireless, netdev

On Mon 15 Mar 07:01 CDT 2021, Bryan O'Donoghue wrote:

> On 12/03/2021 00:33, Bjorn Andersson wrote:
> > Enable the modem and WiFi subsystems and specify msm8916 specific
> > firmware path for these and the WCNSS control service.
> > 
> > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> > ---
> >   arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi | 12 ++++++++++++
> >   arch/arm64/boot/dts/qcom/msm8916.dtsi     |  2 +-
> >   2 files changed, 13 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
> > index 6aef0c2e4f0a..448e3561ef63 100644
> > --- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
> > +++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
> > @@ -305,6 +305,12 @@ &mdss {
> >   	status = "okay";
> >   };
> > +&mpss {
> > +	status = "okay";
> > +
> > +	firmware-name = "qcom/msm8916/mba.mbn", "qcom/msm8916/modem.mbn";
> > +};
> > +
> >   &pm8916_resin {
> >   	status = "okay";
> >   	linux,code = <KEY_VOLUMEDOWN>;
> > @@ -312,6 +318,8 @@ &pm8916_resin {
> >   &pronto {
> >   	status = "okay";
> > +
> > +	firmware-name = "qcom/msm8916/wcnss.mbn";
> >   };
> 
> On Debian I have to do this
> 
> 
> index 2a6a23cb14ca..597cdc8f51cc 100644
> --- a/drivers/remoteproc/qcom_wcnss.c
> +++ b/drivers/remoteproc/qcom_wcnss.c
> @@ -33,7 +33,7 @@
>  #include "qcom_wcnss.h"
> 
>  #define WCNSS_CRASH_REASON_SMEM                422
> -#define WCNSS_FIRMWARE_NAME            "wcnss.mdt"
> +#define WCNSS_FIRMWARE_NAME            "qcom/msm8916/wcnss.mdt"
> 
> so I guess wcnss_probe() -> rproc_alloc() wants this fix too.
> 

Can you confirm that you're saying that you want below patch, which I
just merged?

https://lore.kernel.org/linux-remoteproc/20210312002441.3273183-1-bjorn.andersson@linaro.org/

(Which makes it possible to specify firmware name per platform/board)

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 0/5] qcom: wcnss: Allow overriding firmware form DT
  2021-03-12  0:33 [PATCH 0/5] qcom: wcnss: Allow overriding firmware form DT Bjorn Andersson
                   ` (4 preceding siblings ...)
  2021-03-12  0:33 ` [PATCH 5/5] arm64: dts: qcom: msm8916: Enable modem and WiFi Bjorn Andersson
@ 2021-03-18 16:48 ` Vinod Koul
  2021-03-18 16:56 ` Jeffrey Hugo
  6 siblings, 0 replies; 24+ messages in thread
From: Vinod Koul @ 2021-03-18 16:48 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Rob Herring, Kalle Valo, David S. Miller,
	Jakub Kicinski, Bryan O'Donoghue, linux-arm-msm, devicetree,
	linux-kernel, wcn36xx, linux-wireless, netdev

On 11-03-21, 16:33, Bjorn Andersson wrote:
> The wireless subsystem found in Qualcomm MSM8974 and MSM8916 among others needs
> platform-, and perhaps even board-, specific firmware. Add support for
> providing this in devicetree.

Reviewed-by: Vinod Koul <vkoul@kernel.org>

-- 
~Vinod

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 0/5] qcom: wcnss: Allow overriding firmware form DT
  2021-03-12  0:33 [PATCH 0/5] qcom: wcnss: Allow overriding firmware form DT Bjorn Andersson
                   ` (5 preceding siblings ...)
  2021-03-18 16:48 ` [PATCH 0/5] qcom: wcnss: Allow overriding firmware form DT Vinod Koul
@ 2021-03-18 16:56 ` Jeffrey Hugo
  2021-03-18 17:06   ` Bjorn Andersson
  6 siblings, 1 reply; 24+ messages in thread
From: Jeffrey Hugo @ 2021-03-18 16:56 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Rob Herring, Kalle Valo, David S. Miller,
	Jakub Kicinski, Bryan O'Donoghue, MSM, DTML, lkml, wcn36xx,
	open list:NETWORKING DRIVERS (WIRELESS),
	open list:NETWORKING DRIVERS

form -> from in the subject?

On Thu, Mar 11, 2021 at 5:34 PM Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
>
> The wireless subsystem found in Qualcomm MSM8974 and MSM8916 among others needs
> platform-, and perhaps even board-, specific firmware. Add support for
> providing this in devicetree.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 0/5] qcom: wcnss: Allow overriding firmware form DT
  2021-03-18 16:56 ` Jeffrey Hugo
@ 2021-03-18 17:06   ` Bjorn Andersson
  2021-03-18 18:12     ` Jeffrey Hugo
  0 siblings, 1 reply; 24+ messages in thread
From: Bjorn Andersson @ 2021-03-18 17:06 UTC (permalink / raw)
  To: Jeffrey Hugo
  Cc: Andy Gross, Rob Herring, Kalle Valo, David S. Miller,
	Jakub Kicinski, Bryan O'Donoghue, MSM, DTML, lkml, wcn36xx,
	open list:NETWORKING DRIVERS (WIRELESS),
	open list:NETWORKING DRIVERS

On Thu 18 Mar 11:56 CDT 2021, Jeffrey Hugo wrote:

> form -> from in the subject?
> 

Seems like I only failed in the cover letter, right?

Regards,
Bjorn

> On Thu, Mar 11, 2021 at 5:34 PM Bjorn Andersson
> <bjorn.andersson@linaro.org> wrote:
> >
> > The wireless subsystem found in Qualcomm MSM8974 and MSM8916 among others needs
> > platform-, and perhaps even board-, specific firmware. Add support for
> > providing this in devicetree.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 0/5] qcom: wcnss: Allow overriding firmware form DT
  2021-03-18 17:06   ` Bjorn Andersson
@ 2021-03-18 18:12     ` Jeffrey Hugo
  0 siblings, 0 replies; 24+ messages in thread
From: Jeffrey Hugo @ 2021-03-18 18:12 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Rob Herring, Kalle Valo, David S. Miller,
	Jakub Kicinski, Bryan O'Donoghue, MSM, DTML, lkml, wcn36xx,
	open list:NETWORKING DRIVERS (WIRELESS),
	open list:NETWORKING DRIVERS

On Thu, Mar 18, 2021 at 11:06 AM Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
>
> On Thu 18 Mar 11:56 CDT 2021, Jeffrey Hugo wrote:
>
> > form -> from in the subject?
> >
>
> Seems like I only failed in the cover letter, right?

Looks like.  I didn't even parse that this was the cover letter.

Nothing to see here.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] arm64: dts: qcom: msm8916: Enable modem and WiFi
  2021-03-18 14:50     ` Bjorn Andersson
@ 2021-03-19 14:41       ` Bryan O'Donoghue
  0 siblings, 0 replies; 24+ messages in thread
From: Bryan O'Donoghue @ 2021-03-19 14:41 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Rob Herring, Kalle Valo, David S. Miller,
	Jakub Kicinski, linux-arm-msm, devicetree, linux-kernel, wcn36xx,
	linux-wireless, netdev

On 18/03/2021 14:50, Bjorn Andersson wrote:
> On Mon 15 Mar 07:01 CDT 2021, Bryan O'Donoghue wrote:
> 
>> On 12/03/2021 00:33, Bjorn Andersson wrote:
>>> Enable the modem and WiFi subsystems and specify msm8916 specific
>>> firmware path for these and the WCNSS control service.
>>>
>>> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
>>> ---
>>>    arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi | 12 ++++++++++++
>>>    arch/arm64/boot/dts/qcom/msm8916.dtsi     |  2 +-
>>>    2 files changed, 13 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
>>> index 6aef0c2e4f0a..448e3561ef63 100644
>>> --- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
>>> +++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
>>> @@ -305,6 +305,12 @@ &mdss {
>>>    	status = "okay";
>>>    };
>>> +&mpss {
>>> +	status = "okay";
>>> +
>>> +	firmware-name = "qcom/msm8916/mba.mbn", "qcom/msm8916/modem.mbn";
>>> +};
>>> +
>>>    &pm8916_resin {
>>>    	status = "okay";
>>>    	linux,code = <KEY_VOLUMEDOWN>;
>>> @@ -312,6 +318,8 @@ &pm8916_resin {
>>>    &pronto {
>>>    	status = "okay";
>>> +
>>> +	firmware-name = "qcom/msm8916/wcnss.mbn";
>>>    };
>>
>> On Debian I have to do this
>>
>>
>> index 2a6a23cb14ca..597cdc8f51cc 100644
>> --- a/drivers/remoteproc/qcom_wcnss.c
>> +++ b/drivers/remoteproc/qcom_wcnss.c
>> @@ -33,7 +33,7 @@
>>   #include "qcom_wcnss.h"
>>
>>   #define WCNSS_CRASH_REASON_SMEM                422
>> -#define WCNSS_FIRMWARE_NAME            "wcnss.mdt"
>> +#define WCNSS_FIRMWARE_NAME            "qcom/msm8916/wcnss.mdt"
>>
>> so I guess wcnss_probe() -> rproc_alloc() wants this fix too.
>>
> 
> Can you confirm that you're saying that you want below patch, which I
> just merged?
> 
> https://lore.kernel.org/linux-remoteproc/20210312002441.3273183-1-bjorn.andersson@linaro.org/
> 
> (Which makes it possible to specify firmware name per platform/board)
> 
> Regards,
> Bjorn
> 

yep

Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] arm64: dts: qcom: msm8916: Enable modem and WiFi
  2021-03-12  0:33 ` [PATCH 5/5] arm64: dts: qcom: msm8916: Enable modem and WiFi Bjorn Andersson
  2021-03-15 11:57   ` Bryan O'Donoghue
  2021-03-15 12:01   ` Bryan O'Donoghue
@ 2021-03-19 15:19   ` Stephan Gerhold
  2021-03-22 21:03     ` Anibal Limon
  2021-05-31 16:33     ` Bjorn Andersson
  2 siblings, 2 replies; 24+ messages in thread
From: Stephan Gerhold @ 2021-03-19 15:19 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Rob Herring, Bryan O'Donoghue, Kalle Valo,
	David S. Miller, Jakub Kicinski, linux-arm-msm, devicetree,
	linux-kernel, wcn36xx, linux-wireless, netdev

Hi Bjorn,

On Thu, Mar 11, 2021 at 04:33:18PM -0800, Bjorn Andersson wrote:
> Enable the modem and WiFi subsystems and specify msm8916 specific
> firmware path for these and the WCNSS control service.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

The changes itself look good to me, but the commit message is really
misleading. It does not mention anywhere that the change actually just
enables "modem" on apq8016-sbc instead of "msm8916". :)

Also, WCNSS was actually enabled before already (with the default
firmware path). In my opinion, it would be clearer to change the
firmware-name for it in an extra patch.

> ---
>  arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi | 12 ++++++++++++
>  arch/arm64/boot/dts/qcom/msm8916.dtsi     |  2 +-
>  2 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
> index 6aef0c2e4f0a..448e3561ef63 100644
> --- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
> +++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
> @@ -305,6 +305,12 @@ &mdss {
>  	status = "okay";
>  };
>  
> +&mpss {
> +	status = "okay";
> +
> +	firmware-name = "qcom/msm8916/mba.mbn", "qcom/msm8916/modem.mbn";
> +};
> +
>  &pm8916_resin {
>  	status = "okay";
>  	linux,code = <KEY_VOLUMEDOWN>;
> @@ -312,6 +318,8 @@ &pm8916_resin {
>  
>  &pronto {
>  	status = "okay";
> +
> +	firmware-name = "qcom/msm8916/wcnss.mbn";
>  };
>  

How do I get a .mbn from the wcnss.{mdt,.b??} files provided in the
DB410c firmware package? I guess I should just run them through
https://github.com/andersson/pil-squasher?

Also, is the single file format (mbn) preferred now? Not sure if there
is any significant difference except having less files laying around.

Thanks,
Stephan

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 1/5] dt-bindings: soc: qcom: wcnss: Add firmware-name property
  2021-03-12  0:33 ` [PATCH 1/5] dt-bindings: soc: qcom: wcnss: Add firmware-name property Bjorn Andersson
@ 2021-03-22 21:00   ` Anibal Limon
  2021-03-24 15:21   ` Rob Herring
  1 sibling, 0 replies; 24+ messages in thread
From: Anibal Limon @ 2021-03-22 21:00 UTC (permalink / raw)
  To: linux-arm-msm



On 3/11/21 6:33 PM, Bjorn Andersson wrote:
> The WCNSS needs firmware which differs between platforms, and possibly
> boards. Add a new property "firmware-name" to allow the DT to specify
> the platform/board specific path to this firmware file.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Tested-by:  Aníbal Limón <anibal.limon@linaro.org>
> ---
>   Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt b/Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt
> index 042a2e4159bd..1382b64e1381 100644
> --- a/Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt
> +++ b/Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt
> @@ -24,6 +24,13 @@ block and a BT, WiFi and FM radio block, all using SMD as command channels.
>   		    "qcom,riva",
>   		    "qcom,pronto"
>   
> +- firmware-name:
> +	Usage: optional
> +	Value type: <string>
> +	Definition: specifies the relative firmware image path for the WLAN NV
> +		    blob. Defaults to "wlan/prima/WCNSS_qcom_wlan_nv.bin" if
> +		    not specified.
> +
>   = SUBNODES
>   The subnodes of the wcnss node are optional and describe the individual blocks in
>   the WCNSS.
> 

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 2/5] wcn36xx: Allow firmware name to be overridden by DT
  2021-03-12  0:33 ` [PATCH 2/5] wcn36xx: Allow firmware name to be overridden by DT Bjorn Andersson
  2021-03-15 11:58   ` Bryan O'Donoghue
@ 2021-03-22 21:01   ` Anibal Limon
  1 sibling, 0 replies; 24+ messages in thread
From: Anibal Limon @ 2021-03-22 21:01 UTC (permalink / raw)
  To: linux-arm-msm



On 3/11/21 6:33 PM, Bjorn Andersson wrote:
> The WLAN NV firmware blob differs between platforms, and possibly
> devices, so add support in the wcn36xx driver for reading the path of
> this file from DT in order to allow these files to live in a generic
> file system (or linux-firmware).
> 
> For some reason the parent (wcnss_ctrl) also needs to upload this blob,
> so rather than specifying the same information in both nodes wcn36xx
> reads the string from the parent's of_node.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Tested-by: Aníbal Limón <anibal.limon@linaro.org>
> ---
> 
> This patch can be applied independently of the others, but relates to the
> acceptance of the addition to the DT binding (in patch 1/5). So my suggestion
> is that this one goes through the ath tree and the others through the Qualcomm
> SoC tree.
> 
>   drivers/net/wireless/ath/wcn36xx/main.c    | 7 +++++++
>   drivers/net/wireless/ath/wcn36xx/smd.c     | 4 ++--
>   drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 +
>   3 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
> index afb4877eaad8..87b5c0ff16c0 100644
> --- a/drivers/net/wireless/ath/wcn36xx/main.c
> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
> @@ -1407,6 +1407,13 @@ static int wcn36xx_probe(struct platform_device *pdev)
>   		goto out_wq;
>   	}
>   
> +	wcn->nv_file = WLAN_NV_FILE;
> +	ret = of_property_read_string(wcn->dev->parent->of_node, "firmware-name", &wcn->nv_file);
> +	if (ret < 0 && ret != -EINVAL) {
> +		wcn36xx_err("failed to read \"firmware-name\" property\n");
> +		goto out_wq;
> +	}
> +
>   	wcn->smd_channel = qcom_wcnss_open_channel(wcnss, "WLAN_CTRL", wcn36xx_smd_rsp_process, hw);
>   	if (IS_ERR(wcn->smd_channel)) {
>   		wcn36xx_err("failed to open WLAN_CTRL channel\n");
> diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
> index d0c3a1557e8d..7b928f988068 100644
> --- a/drivers/net/wireless/ath/wcn36xx/smd.c
> +++ b/drivers/net/wireless/ath/wcn36xx/smd.c
> @@ -514,10 +514,10 @@ int wcn36xx_smd_load_nv(struct wcn36xx *wcn)
>   	u16 fm_offset = 0;
>   
>   	if (!wcn->nv) {
> -		ret = request_firmware(&wcn->nv, WLAN_NV_FILE, wcn->dev);
> +		ret = request_firmware(&wcn->nv, wcn->nv_file, wcn->dev);
>   		if (ret) {
>   			wcn36xx_err("Failed to load nv file %s: %d\n",
> -				      WLAN_NV_FILE, ret);
> +				    wcn->nv_file, ret);
>   			goto out;
>   		}
>   	}
> diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
> index 71fa9992b118..5977af2116e3 100644
> --- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
> +++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
> @@ -185,6 +185,7 @@ struct wcn36xx {
>   	struct device		*dev;
>   	struct list_head	vif_list;
>   
> +	const char		*nv_file;
>   	const struct firmware	*nv;
>   
>   	u8			fw_revision;
> 

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 3/5] soc: qcom: wcnss_ctrl: Introduce local variable "dev"
  2021-03-12  0:33 ` [PATCH 3/5] soc: qcom: wcnss_ctrl: Introduce local variable "dev" Bjorn Andersson
@ 2021-03-22 21:01   ` Anibal Limon
  0 siblings, 0 replies; 24+ messages in thread
From: Anibal Limon @ 2021-03-22 21:01 UTC (permalink / raw)
  To: linux-arm-msm



On 3/11/21 6:33 PM, Bjorn Andersson wrote:
> Introduce a local variable to carry the struct device *, to reduce the
> line lengths in the next patch.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Tested-by: Aníbal Limón <anibal.limon@linaro.org>
> ---
>   drivers/soc/qcom/wcnss_ctrl.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/soc/qcom/wcnss_ctrl.c b/drivers/soc/qcom/wcnss_ctrl.c
> index 32bed249f90e..358526b9de06 100644
> --- a/drivers/soc/qcom/wcnss_ctrl.c
> +++ b/drivers/soc/qcom/wcnss_ctrl.c
> @@ -199,6 +199,7 @@ static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc)
>   {
>   	struct wcnss_download_nv_req *req;
>   	const struct firmware *fw;
> +	struct device *dev = wcnss->dev;
>   	const void *data;
>   	ssize_t left;
>   	int ret;
> @@ -207,9 +208,9 @@ static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc)
>   	if (!req)
>   		return -ENOMEM;
>   
> -	ret = request_firmware(&fw, NVBIN_FILE, wcnss->dev);
> +	ret = request_firmware(&fw, NVBIN_FILE, dev);
>   	if (ret < 0) {
> -		dev_err(wcnss->dev, "Failed to load nv file %s: %d\n",
> +		dev_err(dev, "Failed to load nv file %s: %d\n",
>   			NVBIN_FILE, ret);
>   		goto free_req;
>   	}
> @@ -235,7 +236,7 @@ static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc)
>   
>   		ret = rpmsg_send(wcnss->channel, req, req->hdr.len);
>   		if (ret < 0) {
> -			dev_err(wcnss->dev, "failed to send smd packet\n");
> +			dev_err(dev, "failed to send smd packet\n");
>   			goto release_fw;
>   		}
>   
> @@ -248,7 +249,7 @@ static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc)
>   
>   	ret = wait_for_completion_timeout(&wcnss->ack, WCNSS_REQUEST_TIMEOUT);
>   	if (!ret) {
> -		dev_err(wcnss->dev, "timeout waiting for nv upload ack\n");
> +		dev_err(dev, "timeout waiting for nv upload ack\n");
>   		ret = -ETIMEDOUT;
>   	} else {
>   		*expect_cbc = wcnss->ack_status == WCNSS_ACK_COLD_BOOTING;
> 

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 4/5] soc: qcom: wcnss_ctrl: Allow reading firmware-name from DT
  2021-03-12  0:33 ` [PATCH 4/5] soc: qcom: wcnss_ctrl: Allow reading firmware-name from DT Bjorn Andersson
  2021-03-15 11:57   ` Bryan O'Donoghue
@ 2021-03-22 21:02   ` Anibal Limon
  1 sibling, 0 replies; 24+ messages in thread
From: Anibal Limon @ 2021-03-22 21:02 UTC (permalink / raw)
  To: linux-arm-msm



On 3/11/21 6:33 PM, Bjorn Andersson wrote:
> The WLAN NV firmware blob differs between platforms, and possibly
> devices, so add support in the wcnss_ctrl driver for reading the path of
> this file from DT in order to allow these files to live in a generic
> file system (or linux-firmware).
> 
> The new property is optional and the code falls back to the old filename
> if the property isn't specified.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Tested-by: Aníbal Limón <anibal.limon@linaro.org>
> ---
>   drivers/soc/qcom/wcnss_ctrl.c | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/soc/qcom/wcnss_ctrl.c b/drivers/soc/qcom/wcnss_ctrl.c
> index 358526b9de06..2a06d631e415 100644
> --- a/drivers/soc/qcom/wcnss_ctrl.c
> +++ b/drivers/soc/qcom/wcnss_ctrl.c
> @@ -200,6 +200,7 @@ static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc)
>   	struct wcnss_download_nv_req *req;
>   	const struct firmware *fw;
>   	struct device *dev = wcnss->dev;
> +	const char *nvbin = NVBIN_FILE;
>   	const void *data;
>   	ssize_t left;
>   	int ret;
> @@ -208,10 +209,13 @@ static int wcnss_download_nv(struct wcnss_ctrl *wcnss, bool *expect_cbc)
>   	if (!req)
>   		return -ENOMEM;
>   
> -	ret = request_firmware(&fw, NVBIN_FILE, dev);
> +	ret = of_property_read_string(dev->of_node, "firmware-name", &nvbin);
> +	if (ret < 0 && ret != -EINVAL)
> +		goto free_req;
> +
> +	ret = request_firmware(&fw, nvbin, dev);
>   	if (ret < 0) {
> -		dev_err(dev, "Failed to load nv file %s: %d\n",
> -			NVBIN_FILE, ret);
> +		dev_err(dev, "Failed to load nv file %s: %d\n", nvbin, ret);
>   		goto free_req;
>   	}
>   
> 

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] arm64: dts: qcom: msm8916: Enable modem and WiFi
  2021-03-19 15:19   ` Stephan Gerhold
@ 2021-03-22 21:03     ` Anibal Limon
  2021-05-31 16:33     ` Bjorn Andersson
  1 sibling, 0 replies; 24+ messages in thread
From: Anibal Limon @ 2021-03-22 21:03 UTC (permalink / raw)
  To: linux-arm-msm



On 3/19/21 9:19 AM, Stephan Gerhold wrote:
> Hi Bjorn,
> 
> On Thu, Mar 11, 2021 at 04:33:18PM -0800, Bjorn Andersson wrote:
>> Enable the modem and WiFi subsystems and specify msm8916 specific
>> firmware path for these and the WCNSS control service.
>>
>> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> 
> The changes itself look good to me, but the commit message is really
> misleading. It does not mention anywhere that the change actually just
> enables "modem" on apq8016-sbc instead of "msm8916". :)
> 
> Also, WCNSS was actually enabled before already (with the default
> firmware path). In my opinion, it would be clearer to change the
> firmware-name for it in an extra patch.
> 
>> ---
>>   arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi | 12 ++++++++++++
>>   arch/arm64/boot/dts/qcom/msm8916.dtsi     |  2 +-
>>   2 files changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
>> index 6aef0c2e4f0a..448e3561ef63 100644
>> --- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
>> +++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
>> @@ -305,6 +305,12 @@ &mdss {
>>   	status = "okay";
>>   };
>>   
>> +&mpss {
>> +	status = "okay";
>> +
>> +	firmware-name = "qcom/msm8916/mba.mbn", "qcom/msm8916/modem.mbn";
>> +};
>> +
>>   &pm8916_resin {
>>   	status = "okay";
>>   	linux,code = <KEY_VOLUMEDOWN>;
>> @@ -312,6 +318,8 @@ &pm8916_resin {
>>   
>>   &pronto {
>>   	status = "okay";
>> +
>> +	firmware-name = "qcom/msm8916/wcnss.mbn";
>>   };
>>   
> 
> How do I get a .mbn from the wcnss.{mdt,.b??} files provided in the
> DB410c firmware package? I guess I should just run them through
> https://github.com/andersson/pil-squasher?
> 
> Also, is the single file format (mbn) preferred now? Not sure if there
> is any significant difference except having less files laying around.

Same issue here, where can I get mbn file?,

After change the file to use wcnss.mdt this patch works.

Regards,
Anibal
> 
> Thanks,
> Stephan
> 
> 

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 1/5] dt-bindings: soc: qcom: wcnss: Add firmware-name property
  2021-03-12  0:33 ` [PATCH 1/5] dt-bindings: soc: qcom: wcnss: Add firmware-name property Bjorn Andersson
  2021-03-22 21:00   ` Anibal Limon
@ 2021-03-24 15:21   ` Rob Herring
  1 sibling, 0 replies; 24+ messages in thread
From: Rob Herring @ 2021-03-24 15:21 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Kalle Valo, linux-kernel, devicetree, Bryan O'Donoghue,
	wcn36xx, linux-wireless, linux-arm-msm, Andy Gross, netdev,
	David S. Miller, Jakub Kicinski, Rob Herring

On Thu, 11 Mar 2021 16:33:14 -0800, Bjorn Andersson wrote:
> The WCNSS needs firmware which differs between platforms, and possibly
> boards. Add a new property "firmware-name" to allow the DT to specify
> the platform/board specific path to this firmware file.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
>  Documentation/devicetree/bindings/soc/qcom/qcom,wcnss.txt | 7 +++++++
>  1 file changed, 7 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 5/5] arm64: dts: qcom: msm8916: Enable modem and WiFi
  2021-03-19 15:19   ` Stephan Gerhold
  2021-03-22 21:03     ` Anibal Limon
@ 2021-05-31 16:33     ` Bjorn Andersson
  1 sibling, 0 replies; 24+ messages in thread
From: Bjorn Andersson @ 2021-05-31 16:33 UTC (permalink / raw)
  To: Stephan Gerhold
  Cc: Andy Gross, Rob Herring, Bryan O'Donoghue, Kalle Valo,
	David S. Miller, Jakub Kicinski, linux-arm-msm, devicetree,
	linux-kernel, wcn36xx, linux-wireless, netdev

On Fri 19 Mar 10:19 CDT 2021, Stephan Gerhold wrote:

> Hi Bjorn,
> 

Hi Stephan,

I thought I wrote you a reply, but I don't see it on lore or in my
mailbox...

> On Thu, Mar 11, 2021 at 04:33:18PM -0800, Bjorn Andersson wrote:
> > Enable the modem and WiFi subsystems and specify msm8916 specific
> > firmware path for these and the WCNSS control service.
> > 
> > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> 
> The changes itself look good to me, but the commit message is really
> misleading. It does not mention anywhere that the change actually just
> enables "modem" on apq8016-sbc instead of "msm8916". :)
> 
> Also, WCNSS was actually enabled before already (with the default
> firmware path). In my opinion, it would be clearer to change the
> firmware-name for it in an extra patch.
> 

You're right, I will rewrite the commit message.

> > ---
> >  arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi | 12 ++++++++++++
> >  arch/arm64/boot/dts/qcom/msm8916.dtsi     |  2 +-
> >  2 files changed, 13 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
> > index 6aef0c2e4f0a..448e3561ef63 100644
> > --- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
> > +++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dtsi
> > @@ -305,6 +305,12 @@ &mdss {
> >  	status = "okay";
> >  };
> >  
> > +&mpss {
> > +	status = "okay";
> > +
> > +	firmware-name = "qcom/msm8916/mba.mbn", "qcom/msm8916/modem.mbn";
> > +};
> > +
> >  &pm8916_resin {
> >  	status = "okay";
> >  	linux,code = <KEY_VOLUMEDOWN>;
> > @@ -312,6 +318,8 @@ &pm8916_resin {
> >  
> >  &pronto {
> >  	status = "okay";
> > +
> > +	firmware-name = "qcom/msm8916/wcnss.mbn";
> >  };
> >  
> 
> How do I get a .mbn from the wcnss.{mdt,.b??} files provided in the
> DB410c firmware package? I guess I should just run them through
> https://github.com/andersson/pil-squasher?
> 

Yes, .mdt + .bNN files can be put back together as a .mbn by running
them through the pil-squasher.

It's worth mentioning that the suffix doesn't matter for the loader, so
symlinking the .mdt to .mbn (in either way) will keep the kernel
happy - if that simplifies transitions in either way.

> Also, is the single file format (mbn) preferred now? Not sure if there
> is any significant difference except having less files laying around.
> 

We've had numerous cases where people has managed to mix the parts from
different versions of the firmware, sometimes with the nice result of
the loader complaining that some particular .bNN file is missing
other times just with the signature check (mysteriously) failing.

Lumping the parts into a single .mbn resolves all these issues and
hence I prefer this. It is however not a requirement.

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2021-05-31 17:32 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-12  0:33 [PATCH 0/5] qcom: wcnss: Allow overriding firmware form DT Bjorn Andersson
2021-03-12  0:33 ` [PATCH 1/5] dt-bindings: soc: qcom: wcnss: Add firmware-name property Bjorn Andersson
2021-03-22 21:00   ` Anibal Limon
2021-03-24 15:21   ` Rob Herring
2021-03-12  0:33 ` [PATCH 2/5] wcn36xx: Allow firmware name to be overridden by DT Bjorn Andersson
2021-03-15 11:58   ` Bryan O'Donoghue
2021-03-22 21:01   ` Anibal Limon
2021-03-12  0:33 ` [PATCH 3/5] soc: qcom: wcnss_ctrl: Introduce local variable "dev" Bjorn Andersson
2021-03-22 21:01   ` Anibal Limon
2021-03-12  0:33 ` [PATCH 4/5] soc: qcom: wcnss_ctrl: Allow reading firmware-name from DT Bjorn Andersson
2021-03-15 11:57   ` Bryan O'Donoghue
2021-03-22 21:02   ` Anibal Limon
2021-03-12  0:33 ` [PATCH 5/5] arm64: dts: qcom: msm8916: Enable modem and WiFi Bjorn Andersson
2021-03-15 11:57   ` Bryan O'Donoghue
2021-03-15 12:01   ` Bryan O'Donoghue
2021-03-18 14:50     ` Bjorn Andersson
2021-03-19 14:41       ` Bryan O'Donoghue
2021-03-19 15:19   ` Stephan Gerhold
2021-03-22 21:03     ` Anibal Limon
2021-05-31 16:33     ` Bjorn Andersson
2021-03-18 16:48 ` [PATCH 0/5] qcom: wcnss: Allow overriding firmware form DT Vinod Koul
2021-03-18 16:56 ` Jeffrey Hugo
2021-03-18 17:06   ` Bjorn Andersson
2021-03-18 18:12     ` Jeffrey Hugo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.