2021-08-24 17:50:51

by Bjorn Andersson

[permalink] [raw]
Subject: [RESEND PATCH] 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]>
Tested-by: Bryan O'Donoghue <[email protected]>
Tested-by: Aníbal Limón <[email protected]>
---

This was previously part of a series spanning multiple subsystems, picked up
tested-bys and resending alone in hope that it can be merged.

https://lore.kernel.org/linux-arm-msm/[email protected]/

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 d202f2128df2..2ccf7a8924a0 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -1500,6 +1500,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 0e3be17d8cea..57fa857b290b 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -504,10 +504,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 6121d8a5641a..a69cce883563 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -199,6 +199,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-08-27 12:53:40

by Kalle Valo

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

Bjorn Andersson <[email protected]> writes:

> 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]>
> Tested-by: Bryan O'Donoghue <[email protected]>
> Tested-by: Aníbal Limón <[email protected]>

[...]

> --- a/drivers/net/wireless/ath/wcn36xx/main.c
> +++ b/drivers/net/wireless/ath/wcn36xx/main.c
> @@ -1500,6 +1500,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");

I included the value of ret to the error print to ease debugging.
Modified patch is soon in the pending branch, please take a look.

--
https://patchwork.kernel.org/project/linux-wireless/list/

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

2021-08-29 07:12:38

by Kalle Valo

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

Bjorn Andersson <[email protected]> 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]>
> Tested-by: Bryan O'Donoghue <[email protected]>
> Tested-by: Aníbal Limón <[email protected]>
> Signed-off-by: Kalle Valo <[email protected]>

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

b7f96d5c79cd wcn36xx: Allow firmware name to be overridden by DT

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

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