Skip to content

mt76: mt7921e: fix possible probe failure after reboot

Íñigo Huguet requested to merge ihuguet-rh/kernel-cs9:mt76crash into main

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2065633
Tested: tested in a Lenovo Thinkpad T14 Gen 2 (AMD) affected by reboot failure

commit 602cc0c9618a819ab00ea3c9400742a0ca318380 Author: Sean Wang sean.wang@mediatek.com Date: Fri Jan 7 15:30:03 2022 +0800

mt76: mt7921e: fix possible probe failure after reboot

It doesn't guarantee the mt7921e gets started with ASPM L0 after each
machine reboot on every platform.

If mt7921e gets started with not ASPM L0, it would be possible that the
driver encounters time to time failure in mt7921_pci_probe, like a
weird chip identifier is read

[  215.514503] mt7921e 0000:05:00.0: ASIC revision: feed0000
[  216.604741] mt7921e: probe of 0000:05:00.0 failed with error -110

or failing to init hardware because the driver is not allowed to access the
register until the device is in ASPM L0 state. So, we call
__mt7921e_mcu_drv_pmctrl in early mt7921_pci_probe to force the device
to bring back to the L0 state for we can safely access registers in any
case.

In the patch, we move all functions from dma.c to pci.c and register mt76
bus operation earilier, that is the __mt7921e_mcu_drv_pmctrl depends on.

Fixes: bf3747ae2e25 ("mt76: mt7921: enable aspm by default")
Reported-by: Kai-Chuan Hsieh <kaichuan.hsieh@canonical.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>

Signed-off-by: Íñigo Huguet ihuguet@redhat.com

Merge request reports