diff options
author | Felix Fietkau <nbd@nbd.name> | 2019-02-27 19:42:39 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2019-03-07 12:50:23 +0100 |
commit | 004960423fe17dfff93753017b7081dab36c7180 (patch) | |
tree | f7f0aadb89dbeda7e9d734683747e4dea751c5b1 /drivers/net/wireless/mediatek/mt76/mt76x2/pci_mcu.c | |
parent | de3c2af15fce23c42407ad0a868ac47df2e7279a (diff) |
mt76: mt76x2: implement full device restart on watchdog reset
Restart the firmware and re-initialize the MAC to be able to recover
from more kinds of hang states
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt76x2/pci_mcu.c')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt76x2/pci_mcu.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_mcu.c index 03e24ae7f66c..605dc66ae83b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x2/pci_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x2/pci_mcu.c @@ -165,9 +165,30 @@ error: return -ENOENT; } +static int +mt76pci_mcu_restart(struct mt76_dev *mdev) +{ + struct mt76x02_dev *dev; + int ret; + + dev = container_of(mdev, struct mt76x02_dev, mt76); + + mt76x02_mcu_cleanup(dev); + mt76x2_mac_reset(dev, true); + + ret = mt76pci_load_firmware(dev); + if (ret) + return ret; + + mt76_wr(dev, MT_WPDMA_RST_IDX, ~0); + + return 0; +} + int mt76x2_mcu_init(struct mt76x02_dev *dev) { static const struct mt76_mcu_ops mt76x2_mcu_ops = { + .mcu_restart = mt76pci_mcu_restart, .mcu_send_msg = mt76x02_mcu_msg_send, }; int ret; |