[PATCH] wifi: mt7601u: check multiple firmware paths

Christian Hewitt posted 1 patch 11 hours ago
drivers/net/wireless/mediatek/mt7601u/mcu.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
[PATCH] wifi: mt7601u: check multiple firmware paths
Posted by Christian Hewitt 11 hours ago
The linux-firmware repo moved mt7601u.bin from the root folder to
the mediatek sub-folder some time ago, but not all distros create
symlinks to the old location the driver checks. Update the driver
to check for firmware in both old and new locations.

With firmware in /usr/lib/firmware/mediatek/mt7601u.bin):

kernel: mt7601u 1-1.3:1.0: ASIC revision: 76010001 MAC revision: 76010500
kernel: mt7601u 1-1.3:1.0: Direct firmware load for mt7601u.bin failed with error -2
kernel: mt7601u 1-1.3:1.0: probe with driver mt7601u failed with error -2

And with the patch:

kernel: mt7601u 1-1.3:1.0: ASIC revision: 76010001 MAC revision: 76010500
kernel: mt7601u 1-1.3:1.0: Firmware Version: 0.1.00 Build: 7640 Build time: 201302052146
kernel: mt7601u 1-1.3:1.0: EEPROM ver:0c fae:00

Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
---
The firmware was moved in [0]. Changes were requested to a previous
patch [1] but I wasn't able to find a follow-up submission from the
original author. So here's my novice attempt at the improvement.

[0] https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/commit/?id=8451c2b1d529dc1a49328ac9235d3cf5bb8a8fcb
[1] https://patchwork.kernel.org/project/linux-wireless/patch/fefcbf36f13873ae0d97438a0156b87e7e1ae64e.1684191377.git.daniel@makrotopia.org/

 drivers/net/wireless/mediatek/mt7601u/mcu.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/mediatek/mt7601u/mcu.c b/drivers/net/wireless/mediatek/mt7601u/mcu.c
index 1b5cc271a9e1..c771bbf7952c 100644
--- a/drivers/net/wireless/mediatek/mt7601u/mcu.c
+++ b/drivers/net/wireless/mediatek/mt7601u/mcu.c
@@ -409,6 +409,11 @@ static int mt7601u_load_firmware(struct mt7601u_dev *dev)
 	const struct mt76_fw_header *hdr;
 	int len, ret;
 	u32 val;
+	const char *fw_paths[] = {
+		"mediatek/" MT7601U_FIRMWARE,
+		MT7601U_FIRMWARE,
+	};
+	int i;
 
 	mt7601u_wr(dev, MT_USB_DMA_CFG, (MT_USB_DMA_CFG_RX_BULK_EN |
 					 MT_USB_DMA_CFG_TX_BULK_EN));
@@ -416,7 +421,14 @@ static int mt7601u_load_firmware(struct mt7601u_dev *dev)
 	if (firmware_running(dev))
 		return firmware_request_cache(dev->dev, MT7601U_FIRMWARE);
 
-	ret = request_firmware(&fw, MT7601U_FIRMWARE, dev->dev);
+	/* Try loading firmware from multiple locations */
+	fw = NULL;
+	for (i = 0; i < ARRAY_SIZE(fw_paths); i++) {
+		ret = request_firmware(&fw, fw_paths[i], dev->dev);
+		if (ret == 0)
+			break;
+	}
+
 	if (ret)
 		return ret;
 
-- 
2.34.1
Re: [PATCH] wifi: mt7601u: check multiple firmware paths
Posted by Jakub Kicinski 2 hours ago
On Mon,  1 Dec 2025 09:03:36 +0000 Christian Hewitt wrote:
> The linux-firmware repo moved mt7601u.bin from the root folder to
> the mediatek sub-folder some time ago, but not all distros create
> symlinks to the old location the driver checks. Update the driver
> to check for firmware in both old and new locations.

IDK.. 2.5 years ago.. how long is too long to wait for the distros 
to update their linux-firmware?