Mediatek MT7921e wifi driver issue

I have the same wireless adapter: mt7921e aka AMD RZ608
Thanks, @Mirdarthos! The 60s trick worked:

  1. Shut down the laptop
  2. Hold power button for 60s (probably less than that)
  3. Release power button
  4. Laptop boots
  5. Wi-fi module works again (internal memory cleaned)

It was recognized after that. (Resetting BIOS to default didn’t help the wi-fi card).

What’s the deal with it?

The OEM mt7921e has had kernel support for much longer than the AMD rebrand of the same card. The reason why 5.15 recognizes Bluetooth but not Wifi is that the rebrand’s PCI-ID is not known to the kernel. To make the existing driver work in older kernels you must register its PCI-ID to the driver (see answer for a persistent solution):

root# modprobe mt7921e
# echo 14c3 0608 > /sys/bus/pci/drivers/mt7921e/new_id

inxi -Fza before/after loading:

Before:
Network:
  Device-1: MEDIATEK driver: N/A pcie: gen: 2 speed: 5 GT/s lanes: 1
	port: N/A bus-ID: 04:00.0 chip-ID: 14c3:0608 class-ID: 0280
  Device-2: <LAN>
  IF: enp5s0 state: down mac: <filter>
Bluetooth:
  Device-1: MediaTek Wireless_Device type: USB driver: btusb v: 0.8
	bus-ID: 3-3:2 chip-ID: 0e8d:0608 class-ID: e001 serial: <filter>
  Report: rfkill ID: hci0 rfk-id: 0 state: up address: see --recommends

After:
Network:
  Device-1: MEDIATEK driver: mt7921e v: kernel pcie: gen: 2 speed: 5 GT/s
	lanes: 1 port: N/A bus-ID: 04:00.0 chip-ID: 14c3:0608 class-ID: 0280
  IF: wlp4s0 state: down mac: <filter>
  Device-2: <LAN>
  IF: enp5s0 state: down mac: <filter>
Bluetooth:
  Device-1: MediaTek Wireless_Device type: USB driver: btusb v: 0.8
	bus-ID: 3-3:2 chip-ID: 0e8d:0608 class-ID: e001 serial: <filter>
  Report: rfkill ID: hci0 rfk-id: 0 state: up address: see --recommends
  1. You can see the PCI-ID under chip-ID
  2. You can see there’s now a wlp4s0 network interface

This hotloading works fine for a Live boot on 5.15 kernel. I needed a newer kernel so I installed Manjaro’s 5.17.1-3 and rebooted: BOOM. Kernel panic at boot, pointing at the wireless module. The log looked very similar to this, but I didn’t take a photo.
I rebooted: same 5.17 kernel booted fine but without wi-fi! Loading the driver per above and echo’ing the line returned an error: echo" write error: File exists - i.e. the card+ID is already known to kernel, but it’s not recognized. Rebooting thereafter, 5.17 or 5.15 DOES NOT RESTORE WIFI FUNCTIONALITY. Bluetooth continues to work fine.

The issue must be the driver that’s buggy.

Kernel 5.17.3: last commit is “mt76: mt7921e: fix possible probe failure after reboot” - that’s a big patch

Linux next / Kernel 5.18-rc2: “mt76: mt7921: move mt7921_init_hw in a dedicated work”

Judging by the changelog - the former patch was only added in 5.17.2 and Manjaro only distributes 5.17.1 for now - Manjaro’s kernels don’t have these latest patches. I’m either going to continue with the manual method or try to compile a 5.18/5.17.3 kernel.


OK, putting up your own kernel isn’t hard at all.

Offtopic: 5.18 Manjaro kernel compilation

Manjaro’s 5.18 kernel link. You’ll need packages make patch flex bison if you don’t already. 22GB free space as of today. Then follow the instruction from above:

  1. git clone https://gitlab.manjaro.org/packages/core/linux518
  2. cd linux518
  3. makepkg -s - if anything fails during compilation, you must delete the src folder: rm -rf ./src
  4. sudo pacman -U ./linux-518....tar.zst ./linux-headers-518.....tar.zst

This last step will normally install the kernel and update the boot manager (e.g. grub)

2 Likes