2021-03-12 00:35:15

by Bjorn Andersson

[permalink] [raw]
Subject: [PATCH 0/5] qcom: wcnss: Allow overriding firmware form DT

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


2021-03-12 00:37:22

by Bjorn Andersson

[permalink] [raw]
Subject: [PATCH 2/5] wcn36xx: Allow firmware name to be overridden by DT

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 <[email protected]>
---

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

2021-03-12 00:37:24

by Bjorn Andersson

[permalink] [raw]
Subject: [PATCH 4/5] soc: qcom: wcnss_ctrl: Allow reading firmware-name from DT

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 <[email protected]>
---
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

2021-03-15 11:58:05

by Bryan O'Donoghue

[permalink] [raw]
Subject: Re: [PATCH 4/5] soc: qcom: wcnss_ctrl: Allow reading firmware-name from DT

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 <[email protected]>
> ---
> 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 <[email protected]>

2021-03-15 12:01:09

by Bryan O'Donoghue

[permalink] [raw]
Subject: Re: [PATCH 2/5] wcn36xx: Allow firmware name to be overridden by DT

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 <[email protected]>
> ---
>
> 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 <[email protected]>

2021-03-18 18:14:27

by Jeffrey Hugo

[permalink] [raw]
Subject: Re: [PATCH 0/5] qcom: wcnss: Allow overriding firmware form DT

On Thu, Mar 18, 2021 at 11:06 AM Bjorn Andersson
<[email protected]> 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.