From e2eedc9229dad9b9d653ad0abb4f3571d1676148 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 18 Apr 2018 11:53:13 +0200 Subject: [PATCH] mt7603: retry PSE reset calls PSE reset can fail and a subsequent reset could recover it again Signed-off-by: Felix Fietkau --- mt7603.h | 1 + mt7603_mac.c | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/mt7603.h b/mt7603.h index be80892b..9ec7c1f8 100644 --- a/mt7603.h +++ b/mt7603.h @@ -153,6 +153,7 @@ struct mt7603_dev { u8 tx_dma_check; u8 rx_dma_check; u8 rx_pse_check; + u8 pse_reset_failed; u16 tx_dma_idx[4]; u16 rx_dma_idx; diff --git a/mt7603_mac.c b/mt7603_mac.c index 7f5cc90d..fdc8af46 100644 --- a/mt7603_mac.c +++ b/mt7603_mac.c @@ -1178,9 +1178,14 @@ static void mt7603_pse_reset(struct mt7603_dev *dev) /* 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); - WARN_ON_ONCE(!mt76_poll_msec(dev, MT_MCU_DEBUG_RESET, - MT_MCU_DEBUG_RESET_PSE_S, - MT_MCU_DEBUG_RESET_PSE_S, 500)); + + if (!mt76_poll_msec(dev, MT_MCU_DEBUG_RESET, + MT_MCU_DEBUG_RESET_PSE_S, + MT_MCU_DEBUG_RESET_PSE_S, 500)) + dev->pse_reset_failed++; + else + dev->pse_reset_failed = 0; + mt76_clear(dev, MT_MCU_DEBUG_RESET, MT_MCU_DEBUG_RESET_QUEUES); } @@ -1393,7 +1398,8 @@ void mt7603_mac_work(struct work_struct *work) mt7603_rx_pse_busy) || mt7603_watchdog_check(dev, &dev->beacon_check, RESET_CAUSE_BEACON_STUCK, - NULL)) { + NULL) || + dev->pse_reset_failed) { dev->beacon_check = 0; dev->tx_dma_check = 0; dev->tx_hang_check = 0;