From 362fec004ceab98684972184a3993c1c48da253b Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 13 Aug 2024 20:48:51 +0200 Subject: [PATCH] wifi: mt76: mt7915: reset the device after MCU timeout On MT7915, MCU hangs do not trigger watchdog interrupts, so they can only be detected through MCU message timeouts. Ensure that the hardware gets restarted when that happens in order to prevent a permanent stuck state. Signed-off-by: Felix Fietkau --- mt7915/mcu.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mt7915/mcu.c b/mt7915/mcu.c index d4c70704..0d42ea52 100644 --- a/mt7915/mcu.c +++ b/mt7915/mcu.c @@ -157,12 +157,19 @@ static int mt7915_mcu_parse_response(struct mt76_dev *mdev, int cmd, struct sk_buff *skb, int seq) { + struct mt7915_dev *dev = container_of(mdev, struct mt7915_dev, mt76); struct mt76_connac2_mcu_rxd *rxd; int ret = 0; if (!skb) { dev_err(mdev->dev, "Message %08x (seq %d) timeout\n", cmd, seq); + dev->recovery.restart = true; + set_bit(MT76_MCU_RESET, &dev->mphy.state); + wake_up(&dev->mt76.mcu.wait); + queue_work(dev->mt76.wq, &dev->reset_work); + wake_up(&dev->reset_wait); + return -ETIMEDOUT; }