From 417ab779a0b9c49c065da717cbdaa074b6fcf72c Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 5 Dec 2018 15:31:42 +0100 Subject: [PATCH] mt7603: improve recovery from PSE reset failure Only clear reset status and switch to DMA reset after 3 tries. Signed-off-by: Felix Fietkau --- mt7603/mac.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mt7603/mac.c b/mt7603/mac.c index 5f272173..cd4cda45 100644 --- a/mt7603/mac.c +++ b/mt7603/mac.c @@ -1197,20 +1197,27 @@ wait_for_wpdma(struct mt7603_dev *dev) static void mt7603_pse_reset(struct mt7603_dev *dev) { + /* Clear previous reset result */ + if (!dev->reset_cause[RESET_CAUSE_RESET_FAILED]) + mt76_clear(dev, MT_MCU_DEBUG_RESET, MT_MCU_DEBUG_RESET_PSE_S); + /* Reset PSE */ - mt76_clear(dev, MT_MCU_DEBUG_RESET, MT_MCU_DEBUG_RESET_PSE_S); mt76_set(dev, MT_MCU_DEBUG_RESET, MT_MCU_DEBUG_RESET_PSE); if (!mt76_poll_msec(dev, MT_MCU_DEBUG_RESET, MT_MCU_DEBUG_RESET_PSE_S, MT_MCU_DEBUG_RESET_PSE_S, 500)) { - mt76_clear(dev, MT_MCU_DEBUG_RESET, MT_MCU_DEBUG_RESET_PSE); dev->reset_cause[RESET_CAUSE_RESET_FAILED]++; } else { dev->reset_cause[RESET_CAUSE_RESET_FAILED] = 0; } mt76_clear(dev, MT_MCU_DEBUG_RESET, MT_MCU_DEBUG_RESET_QUEUES); + + if (dev->reset_cause[RESET_CAUSE_RESET_FAILED] >= 3) { + dev->reset_cause[RESET_CAUSE_RESET_FAILED] = 0; + mt76_clear(dev, MT_MCU_DEBUG_RESET, MT_MCU_DEBUG_RESET_PSE); + } } void mt7603_mac_dma_start(struct mt7603_dev *dev)