2023-07-07 19:44:39

by Ajay Singh

[permalink] [raw]
Subject: [PATCH v2] wifi: wilc1000: change firmware path from 'atmel' to 'microchip/wilc'

From: Ajay Singh <[email protected]>

To inline 'linux-firmware' path with driver, the firmware path is changed
from 'atmel' to 'microchip/wilc'. The path change will be submitted to
'linux-firmware' repo.
For backward compatibility, when the updated kernel and older
linux-firmware that has firmware at 'atmel/' path are used, add a fallback
method to read firmware from 'atmel' path.

Signed-off-by: Ajay Singh <[email protected]>
---
changes since v1:
- load firmware from older path when firmware is missing at new path for
backward compatibility.

---
.../net/wireless/microchip/wilc1000/netdev.c | 33 ++++++++++++++-----
1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.c b/drivers/net/wireless/microchip/wilc1000/netdev.c
index e9f59de31b0b..c0dd7072decc 100644
--- a/drivers/net/wireless/microchip/wilc1000/netdev.c
+++ b/drivers/net/wireless/microchip/wilc1000/netdev.c
@@ -19,10 +19,13 @@
/* latest API version supported */
#define WILC1000_API_VER 1

-#define WILC1000_FW_PREFIX "atmel/wilc1000_wifi_firmware-"
+#define WILC1000_FW_PREFIX "wilc1000_wifi_firmware-"
#define __WILC1000_FW(api) WILC1000_FW_PREFIX #api ".bin"
#define WILC1000_FW(api) __WILC1000_FW(api)

+#define WILC1000_ATMEL_FW(api) "atmel/" WILC1000_FW(api)
+#define WILC1000_MICROCHIP_FW(api) "microchip/wilc/" WILC1000_FW(api)
+
static irqreturn_t isr_uh_routine(int irq, void *user_data)
{
struct wilc *wilc = user_data;
@@ -187,14 +190,27 @@ static int wilc_wlan_get_firmware(struct net_device *dev)
chip_id = wilc_get_chipid(wilc, false);

netdev_info(dev, "ChipID [%x] loading firmware [%s]\n", chip_id,
- WILC1000_FW(WILC1000_API_VER));
+ WILC1000_MICROCHIP_FW(WILC1000_API_VER));

- ret = request_firmware(&wilc_fw, WILC1000_FW(WILC1000_API_VER),
+ ret = request_firmware(&wilc_fw,
+ WILC1000_MICROCHIP_FW(WILC1000_API_VER),
wilc->dev);
- if (ret != 0) {
- netdev_err(dev, "%s - firmware not available\n",
- WILC1000_FW(WILC1000_API_VER));
- return -EINVAL;
+ if (ret == -ENOENT) {
+ netdev_info(dev, "firmware not found at[%s], try [%s]\n",
+ WILC1000_MICROCHIP_FW(WILC1000_API_VER),
+ WILC1000_ATMEL_FW(WILC1000_API_VER));
+ ret = request_firmware(&wilc_fw,
+ WILC1000_ATMEL_FW(WILC1000_API_VER),
+ wilc->dev);
+ if (ret) {
+ netdev_err(dev, "[%s] - request firmware failed %d\n",
+ WILC1000_ATMEL_FW(WILC1000_API_VER), ret);
+ return ret;
+ }
+ } else if (ret) {
+ netdev_err(dev, "[%s] - request firmware failed %d\n",
+ WILC1000_MICROCHIP_FW(WILC1000_API_VER), ret);
+ return ret;
}
wilc->firmware = wilc_fw;

@@ -1007,4 +1023,5 @@ struct wilc_vif *wilc_netdev_ifc_init(struct wilc *wl, const char *name,
}

MODULE_LICENSE("GPL");
-MODULE_FIRMWARE(WILC1000_FW(WILC1000_API_VER));
+MODULE_FIRMWARE(WILC1000_ATMEL_FW(WILC1000_API_VER));
+MODULE_FIRMWARE(WILC1000_MICROCHIP_FW(WILC1000_API_VER));
--
2.34.1


2023-07-25 15:08:27

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH v2] wifi: wilc1000: change firmware path from 'atmel' to 'microchip/wilc'

<[email protected]> wrote:

> From: Ajay Singh <[email protected]>
>
> To inline 'linux-firmware' path with driver, the firmware path is changed
> from 'atmel' to 'microchip/wilc'. The path change will be submitted to
> 'linux-firmware' repo.
> For backward compatibility, when the updated kernel and older
> linux-firmware that has firmware at 'atmel/' path are used, add a fallback
> method to read firmware from 'atmel' path.
>
> Signed-off-by: Ajay Singh <[email protected]>

Like discussed in the other thread, I'm dropping this.

Patch set to Changes Requested.

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

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