Skip to contentSkip to conversation

wifi: wilc1000: change firmware path from 'atmel' to 'microchip/wilc'

PATCH In review [email protected] 2 participants 2 messages Jul 7, 2023 – Jul 25, 2023 Microchip WILC1000 wifi driver

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH v2 1/1 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.

---
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(-)
drivers/net/wireless/microchip/wilc1000/netdev.c +25 -8
index e9f59de31b0b..c0dd7072decc 100644
@@ -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

#1 lore raw
Quoted 10 lines · <[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.

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

Patch set to Changes Requested.

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

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