mt76: mt7921: set MT76_RESET during mac reset

Message ID 3bdd3cada045a2d31c18c80cc40da97b0cec1af9.1620914781.git.lorenzo@kernel.org
State New
Headers show
Series
  • mt76: mt7921: set MT76_RESET during mac reset
Related show

Commit Message

Lorenzo Bianconi May 13, 2021, 2:13 p.m.
Set MT76_RESET during mt7921_mac_reset in order to avoid packet
transmissions

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch

diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
index b0b59d5a1011..d8df2b9b94af 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
@@ -1255,6 +1255,7 @@  mt7921_mac_reset(struct mt7921_dev *dev)
 	mt76_wr(dev, MT_WFDMA0_HOST_INT_ENA, 0);
 	mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0x0);
 
+	set_bit(MT76_RESET, &dev->mphy.state);
 	set_bit(MT76_MCU_RESET, &dev->mphy.state);
 	wake_up(&dev->mt76.mcu.wait);
 	skb_queue_purge(&dev->mt76.mcu.res_q);
@@ -1274,6 +1275,9 @@  mt7921_mac_reset(struct mt7921_dev *dev)
 	if (err)
 		return err;
 
+	clear_bit(MT76_MCU_RESET, &dev->mphy.state);
+	clear_bit(MT76_RESET, &dev->mphy.state);
+
 	mt76_for_each_q_rx(&dev->mt76, i) {
 		napi_enable(&dev->mt76.napi[i]);
 		napi_schedule(&dev->mt76.napi[i]);
@@ -1283,8 +1287,6 @@  mt7921_mac_reset(struct mt7921_dev *dev)
 	napi_schedule(&dev->mt76.tx_napi);
 	mt76_worker_enable(&dev->mt76.tx_worker);
 
-	clear_bit(MT76_MCU_RESET, &dev->mphy.state);
-
 	mt76_wr(dev, MT_WFDMA0_HOST_INT_ENA,
 		MT_INT_RX_DONE_ALL | MT_INT_TX_DONE_ALL |
 		MT_INT_MCU_CMD);