public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] mt76: mt7615: cleanup mcu tx queue in mt7615_dma_reset()
@ 2021-03-25 18:28 Ryder Lee
  2021-03-25 18:28 ` [PATCH v2 2/2] mt76: mt7915: cleanup mcu tx queue in mt7915_dma_reset() Ryder Lee
  2021-03-25 22:41 ` [PATCH v2 1/2] mt76: mt7615: cleanup mcu tx queue in mt7615_dma_reset() Felix Fietkau
  0 siblings, 2 replies; 4+ messages in thread
From: Ryder Lee @ 2021-03-25 18:28 UTC (permalink / raw)
  To: Felix Fietkau, Lorenzo Bianconi
  Cc: Shayne Chen, linux-wireless, linux-mediatek, Ryder Lee

Cleanup ext_phy and mcu tx queue so that mt7615_mac_reset_work() can
recover mt7615 normally.

Fixes: mt76: e637763b606 ("move mcu queues to mt76_dev q_mcu array")
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
change since v2 - cleanup mphy_ext->q_tx
---
 drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
index bb3f93d90f4e..4e41c12d08eb 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
@@ -2013,20 +2013,26 @@ mt7615_update_beacons(struct mt7615_dev *dev)
 
 void mt7615_dma_reset(struct mt7615_dev *dev)
 {
+	struct mt76_phy *mphy_ext = dev->mt76.phy2;
 	int i;
 
 	mt76_clear(dev, MT_WPDMA_GLO_CFG,
 		   MT_WPDMA_GLO_CFG_RX_DMA_EN | MT_WPDMA_GLO_CFG_TX_DMA_EN |
 		   MT_WPDMA_GLO_CFG_TX_WRITEBACK_DONE);
+
 	usleep_range(1000, 2000);
 
-	mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_WM], true);
-	for (i = 0; i < __MT_TXQ_MAX; i++)
+	for (i = 0; i < __MT_TXQ_MAX; i++) {
 		mt76_queue_tx_cleanup(dev, dev->mphy.q_tx[i], true);
+		if (mphy_ext)
+			mt76_queue_tx_cleanup(dev, mphy_ext->q_tx[i], true);
+	}
 
-	mt76_for_each_q_rx(&dev->mt76, i) {
+	for (i = 0; i < __MT_MCUQ_MAX; i++)
+		mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[i], true);
+
+	mt76_for_each_q_rx(&dev->mt76, i)
 		mt76_queue_rx_reset(dev, i);
-	}
 
 	mt76_set(dev, MT_WPDMA_GLO_CFG,
 		 MT_WPDMA_GLO_CFG_RX_DMA_EN | MT_WPDMA_GLO_CFG_TX_DMA_EN |
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] mt76: mt7915: cleanup mcu tx queue in mt7915_dma_reset()
  2021-03-25 18:28 [PATCH v2 1/2] mt76: mt7615: cleanup mcu tx queue in mt7615_dma_reset() Ryder Lee
@ 2021-03-25 18:28 ` Ryder Lee
  2021-03-25 22:41 ` [PATCH v2 1/2] mt76: mt7615: cleanup mcu tx queue in mt7615_dma_reset() Felix Fietkau
  1 sibling, 0 replies; 4+ messages in thread
From: Ryder Lee @ 2021-03-25 18:28 UTC (permalink / raw)
  To: Felix Fietkau, Lorenzo Bianconi
  Cc: Shayne Chen, linux-wireless, linux-mediatek, Ryder Lee

Cleanup mcu queues in mt7915_mac_reset_work().

Fixes: mt76: e637763b606 ("move mcu queues to mt76_dev q_mcu array")
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
index d3a6312c058c..0924ae074db2 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c
@@ -1515,9 +1515,8 @@ mt7915_update_beacons(struct mt7915_dev *dev)
 }
 
 static void
-mt7915_dma_reset(struct mt7915_phy *phy)
+mt7915_dma_reset(struct mt7915_dev *dev)
 {
-	struct mt7915_dev *dev = phy->dev;
 	struct mt76_phy *mphy_ext = dev->mt76.phy2;
 	u32 hif1_ofs = MT_WFDMA1_PCIE1_BASE - MT_WFDMA1_BASE;
 	int i;
@@ -1534,18 +1533,20 @@ mt7915_dma_reset(struct mt7915_phy *phy)
 			   (MT_WFDMA1_GLO_CFG_TX_DMA_EN |
 			    MT_WFDMA1_GLO_CFG_RX_DMA_EN));
 	}
+
 	usleep_range(1000, 2000);
 
-	mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[MT_MCUQ_WA], true);
 	for (i = 0; i < __MT_TXQ_MAX; i++) {
-		mt76_queue_tx_cleanup(dev, phy->mt76->q_tx[i], true);
+		mt76_queue_tx_cleanup(dev, dev->mphy.q_tx[i], true);
 		if (mphy_ext)
 			mt76_queue_tx_cleanup(dev, mphy_ext->q_tx[i], true);
 	}
 
-	mt76_for_each_q_rx(&dev->mt76, i) {
+	for (i = 0; i < __MT_MCUQ_MAX; i++)
+		mt76_queue_tx_cleanup(dev, dev->mt76.q_mcu[i], true);
+
+	mt76_for_each_q_rx(&dev->mt76, i)
 		mt76_queue_rx_reset(dev, i);
-	}
 
 	/* re-init prefetch settings after reset */
 	mt7915_dma_prefetch(dev);
@@ -1630,7 +1631,7 @@ void mt7915_mac_reset_work(struct work_struct *work)
 	idr_init(&dev->token);
 
 	if (mt7915_wait_reset_state(dev, MT_MCU_CMD_RESET_DONE)) {
-		mt7915_dma_reset(&dev->phy);
+		mt7915_dma_reset(dev);
 
 		mt76_wr(dev, MT_MCU_INT_EVENT, MT_MCU_INT_EVENT_DMA_INIT);
 		mt7915_wait_reset_state(dev, MT_MCU_CMD_RECOVERY_DONE);
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] mt76: mt7615: cleanup mcu tx queue in mt7615_dma_reset()
  2021-03-25 18:28 [PATCH v2 1/2] mt76: mt7615: cleanup mcu tx queue in mt7615_dma_reset() Ryder Lee
  2021-03-25 18:28 ` [PATCH v2 2/2] mt76: mt7915: cleanup mcu tx queue in mt7915_dma_reset() Ryder Lee
@ 2021-03-25 22:41 ` Felix Fietkau
  2021-03-25 23:51   ` Ryder Lee
  1 sibling, 1 reply; 4+ messages in thread
From: Felix Fietkau @ 2021-03-25 22:41 UTC (permalink / raw)
  To: Ryder Lee, Lorenzo Bianconi; +Cc: Shayne Chen, linux-wireless, linux-mediatek


On 2021-03-25 19:28, Ryder Lee wrote:
> Cleanup ext_phy and mcu tx queue so that mt7615_mac_reset_work() can
> recover mt7615 normally.
> 
> Fixes: mt76: e637763b606 ("move mcu queues to mt76_dev q_mcu array")
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> ---
> change since v2 - cleanup mphy_ext->q_tx
I like v1 better, since ext-phy tx queues are the same as primary phy tx
queues. Or am I missing something?

- Felix

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 1/2] mt76: mt7615: cleanup mcu tx queue in mt7615_dma_reset()
  2021-03-25 22:41 ` [PATCH v2 1/2] mt76: mt7615: cleanup mcu tx queue in mt7615_dma_reset() Felix Fietkau
@ 2021-03-25 23:51   ` Ryder Lee
  0 siblings, 0 replies; 4+ messages in thread
From: Ryder Lee @ 2021-03-25 23:51 UTC (permalink / raw)
  To: Felix Fietkau
  Cc: Lorenzo Bianconi, Shayne Chen, linux-wireless, linux-mediatek


> On 2021-03-25 19:28, Ryder Lee wrote:
> > Cleanup ext_phy and mcu tx queue so that mt7615_mac_reset_work() can
> > recover mt7615 normally.
> > 
> > Fixes: mt76: e637763b606 ("move mcu queues to mt76_dev q_mcu array")
> > Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> > ---
> > change since v2 - cleanup mphy_ext->q_tx
> I like v1 better, since ext-phy tx queues are the same as primary phy tx
> queues. Or am I missing something?
> 
> - Felix
right. i didn't notice mt7615 ext-phy shares the same tx queues with
primary phy. please drop this one.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-25 23:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-25 18:28 [PATCH v2 1/2] mt76: mt7615: cleanup mcu tx queue in mt7615_dma_reset() Ryder Lee
2021-03-25 18:28 ` [PATCH v2 2/2] mt76: mt7915: cleanup mcu tx queue in mt7915_dma_reset() Ryder Lee
2021-03-25 22:41 ` [PATCH v2 1/2] mt76: mt7615: cleanup mcu tx queue in mt7615_dma_reset() Felix Fietkau
2021-03-25 23:51   ` Ryder Lee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox