• Sean Wang's avatar
    mt76: mt7921e: fix possible probe failure after reboot · 602cc0c9
    Sean Wang authored
    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: bf3747ae ("mt76: mt7921: enable aspm by default")
    Reported-by: default avatarKai-Chuan Hsieh <kaichuan.hsieh@canonical.com>
    Co-developed-by: default avatarDeren Wu <deren.wu@mediatek.com>
    Signed-off-by: default avatarDeren Wu <deren.wu@mediatek.com>
    Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
    Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
    602cc0c9
mt7921.h 12.8 KB