Skip to contentSkip to conversation

wifi: mt76: introduce WED TX support for mt7986 SoC

PATCH In review Lorenzo Bianconi 3 participants 11 messages Sep 28, 2022 – Oct 13, 2022

Subsystems (2)
lore
Share & tools
lore

Lorenzo Bianconi

author maintainer
#0 lore raw

cover wifi: mt76: introduce WED TX support for mt7986 SoC

Enable WED TX support for mt7915 and mt7986-wmac drivers running on MT7986 SoC. This is series is based on the following net-next series not merged yet in wireless-next tree:
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=377c17c6757ccf43e97f681a6ac5163d3735ab0a

Lorenzo Bianconi (3):
wifi: mt76: mt7915: move wed init routines in mmio.c
wifi: mt76: mt7915: enable wed for mt7986 chipset
wifi: mt76: mt7915: enable wed for mt7986-wmac chipset

 .../net/wireless/mediatek/mt76/mt7915/dma.c   |  75 +++++++---
 .../net/wireless/mediatek/mt76/mt7915/main.c  |   2 +-
 .../net/wireless/mediatek/mt76/mt7915/mcu.c   |   2 +-
 .../net/wireless/mediatek/mt76/mt7915/mmio.c  | 135 +++++++++++++++++-
 .../wireless/mediatek/mt76/mt7915/mt7915.h    |   2 +
 .../net/wireless/mediatek/mt76/mt7915/pci.c   |  93 +-----------
 .../net/wireless/mediatek/mt76/mt7915/regs.h  |  13 ++
 .../net/wireless/mediatek/mt76/mt7915/soc.c   |  21 ++-
 8 files changed, 222 insertions(+), 121 deletions(-)
Signature · 1 line
2.37.3
author maintainer
#1 lore raw

PATCH 1/3 wifi: mt76: mt7915: move wed init routines in mmio.c

This is a preliminary patch to enable wed support for mt7986-wmac chipset.

---
 .../net/wireless/mediatek/mt76/mt7915/mmio.c  | 91 ++++++++++++++++++
 .../wireless/mediatek/mt76/mt7915/mt7915.h    |  2 +
 .../net/wireless/mediatek/mt76/mt7915/pci.c   | 93 +------------------
 3 files changed, 94 insertions(+), 92 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mmio.c +91 -0
index 7bd5f6725d7b..e75f2229b6a1 100644
@@ -10,6 +10,9 @@
 #include "mac.h"
 #include "../trace.h"
 
+static bool wed_enable;
+module_param(wed_enable, bool, 0644);
+
 static const u32 mt7915_reg[] = {
 	[INT_SOURCE_CSR]	= 0xd7010,
 	[INT_MASK_CSR]		= 0xd7014,
@@ -472,6 +475,94 @@ static u32 mt7915_rmw(struct mt76_dev *mdev, u32 offset, u32 mask, u32 val)
 	return dev->bus_ops->rmw(mdev, addr, mask, val);
 }
 
+#ifdef CONFIG_NET_MEDIATEK_SOC_WED
+static int mt7915_mmio_wed_offload_enable(struct mtk_wed_device *wed)
+{
+	struct mt7915_dev *dev;
+	struct mt7915_phy *phy;
+	int ret;
+
+	dev = container_of(wed, struct mt7915_dev, mt76.mmio.wed);
+
+	spin_lock_bh(&dev->mt76.token_lock);
+	dev->mt76.token_size = wed->wlan.token_start;
+	spin_unlock_bh(&dev->mt76.token_lock);
+
+	ret = wait_event_timeout(dev->mt76.tx_wait,
+				 !dev->mt76.wed_token_count, HZ);
+	if (!ret)
+		return -EAGAIN;
+
+	phy = &dev->phy;
+	mt76_set(dev, MT_AGG_ACR4(phy->band_idx), MT_AGG_ACR_PPDU_TXS2H);
+
+	phy = dev->mt76.phys[MT_BAND1] ? dev->mt76.phys[MT_BAND1]->priv : NULL;
+	if (phy)
+		mt76_set(dev, MT_AGG_ACR4(phy->band_idx),
+			 MT_AGG_ACR_PPDU_TXS2H);
+
+	return 0;
+}
+
+static void mt7915_mmio_wed_offload_disable(struct mtk_wed_device *wed)
+{
+	struct mt7915_dev *dev;
+	struct mt7915_phy *phy;
+
+	dev = container_of(wed, struct mt7915_dev, mt76.mmio.wed);
+
+	spin_lock_bh(&dev->mt76.token_lock);
+	dev->mt76.token_size = MT7915_TOKEN_SIZE;
+	spin_unlock_bh(&dev->mt76.token_lock);
+
+	/* MT_TXD5_TX_STATUS_HOST (MPDU format) has higher priority than
+	 * MT_AGG_ACR_PPDU_TXS2H (PPDU format) even though ACR bit is set.
+	 */
+	phy = &dev->phy;
+	mt76_clear(dev, MT_AGG_ACR4(phy->band_idx), MT_AGG_ACR_PPDU_TXS2H);
+
+	phy = dev->mt76.phys[MT_BAND1] ? dev->mt76.phys[MT_BAND1]->priv : NULL;
+	if (phy)
+		mt76_clear(dev, MT_AGG_ACR4(phy->band_idx),
+			   MT_AGG_ACR_PPDU_TXS2H);
+}
+#endif
+
+int mt7915_mmio_wed_init(struct mt7915_dev *dev, struct pci_dev *pdev,
+			 int *irq)
+{
+#ifdef CONFIG_NET_MEDIATEK_SOC_WED
+	struct mtk_wed_device *wed = &dev->mt76.mmio.wed;
+	int ret;
+
+	if (!wed_enable)
+		return 0;
+
+	wed->wlan.pci_dev = pdev;
+	wed->wlan.wpdma_phys = pci_resource_start(pdev, 0) +
+			       MT_WFDMA_EXT_CSR_BASE;
+	wed->wlan.nbuf = 4096;
+	wed->wlan.token_start = MT7915_TOKEN_SIZE - wed->wlan.nbuf;
+	wed->wlan.init_buf = mt7915_wed_init_buf;
+	wed->wlan.offload_enable = mt7915_mmio_wed_offload_enable;
+	wed->wlan.offload_disable = mt7915_mmio_wed_offload_disable;
+
+	if (mtk_wed_device_attach(wed) != 0)
+		return 0;
+
+	*irq = wed->irq;
+	dev->mt76.dma_dev = wed->dev;
+
+	ret = dma_set_mask(wed->dev, DMA_BIT_MASK(32));
+	if (ret)
+		return ret;
+
+	return 1;
+#else
+	return 0;
+#endif
+}
+
 static int mt7915_mmio_init(struct mt76_dev *mdev,
 			    void __iomem *mem_base,
 			    u32 device_id)
drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +2 -0
index 1eb11617a625..93999d633b75 100644
@@ -590,5 +590,7 @@ bool mt7915_debugfs_rx_log(struct mt7915_dev *dev, const void *data, int len);
 void mt7915_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 			    struct ieee80211_sta *sta, struct dentry *dir);
 #endif
+int mt7915_mmio_wed_init(struct mt7915_dev *dev, struct pci_dev *pdev,
+			 int *irq);
 
 #endif
drivers/net/wireless/mediatek/mt76/mt7915/pci.c +1 -92

111 lines not on this page · raw message

Signature · 1 line
2.37.3
author maintainer
#2 lore raw

PATCH 2/3 wifi: mt76: mt7915: enable wed for mt7986 chipset

In reply to Lorenzo Bianconi

Introduce wed tx support for MT7986 chipset

---
 drivers/net/wireless/mediatek/mt76/mt7915/dma.c  |  1 +
 drivers/net/wireless/mediatek/mt76/mt7915/mmio.c | 11 +++++++++++
 drivers/net/wireless/mediatek/mt76/mt7915/regs.h |  8 ++++++++
 3 files changed, 20 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7915/dma.c +1 -0
index 00aafc2422f3..90a89cf493a9 100644
@@ -324,6 +324,7 @@ static int mt7915_dma_enable(struct mt7915_dev *dev)
 
 		wed_irq_mask |= MT_INT_TX_DONE_BAND0 | MT_INT_TX_DONE_BAND1;
 		mt76_wr(dev, MT_INT_WED_MASK_CSR, wed_irq_mask);
+		mt76_wr(dev, MT_INT_MASK_CSR, wed_irq_mask);
 		mtk_wed_device_start(&dev->mt76.mmio.wed, wed_irq_mask);
 	}
 
drivers/net/wireless/mediatek/mt76/mt7915/mmio.c +11 -0
index e75f2229b6a1..5676d62933ad 100644
@@ -541,7 +541,18 @@ int mt7915_mmio_wed_init(struct mt7915_dev *dev, struct pci_dev *pdev,
 	wed->wlan.pci_dev = pdev;
 	wed->wlan.wpdma_phys = pci_resource_start(pdev, 0) +
 			       MT_WFDMA_EXT_CSR_BASE;
+	wed->wlan.wpdma_int = pci_resource_start(pdev, 0) +
+			      MT_INT_WED_SOURCE_CSR;
+	wed->wlan.wpdma_mask = pci_resource_start(pdev, 0) +
+			       MT_INT_WED_MASK_CSR;
+	wed->wlan.wpdma_tx = pci_resource_start(pdev, 0) +
+			     MT_TXQ_WED_RING_BASE;
+	wed->wlan.wpdma_txfree = pci_resource_start(pdev, 0) +
+				 MT_RXQ_WED_RING_BASE;
 	wed->wlan.nbuf = 4096;
+	wed->wlan.tx_tbit[0] = MT_WED_TX_DONE_BAND0;
+	wed->wlan.tx_tbit[1] = MT_WED_TX_DONE_BAND1;
+	wed->wlan.txfree_tbit = MT_WED_TX_FREE_DONE;
 	wed->wlan.token_start = MT7915_TOKEN_SIZE - wed->wlan.nbuf;
 	wed->wlan.init_buf = mt7915_wed_init_buf;
 	wed->wlan.offload_enable = mt7915_mmio_wed_offload_enable;
drivers/net/wireless/mediatek/mt76/mt7915/regs.h +8 -0
index 5920e705835a..d9642c5817e9 100644
@@ -596,6 +596,7 @@ enum offs_rev {
 #define MT_PCIE_RECOG_ID_MASK		GENMASK(30, 0)
 #define MT_PCIE_RECOG_ID_SEM		BIT(31)
 
+#define MT_INT_WED_SOURCE_CSR		MT_WFDMA_EXT_CSR(0x200)
 #define MT_INT_WED_MASK_CSR		MT_WFDMA_EXT_CSR(0x204)
 
 #define MT_WED_TX_RING_BASE		MT_WFDMA_EXT_CSR(0x300)
@@ -642,6 +643,13 @@ enum offs_rev {
 #define MT_TXQ_EXT_CTRL(q)		(MT_Q_BASE(__TXQ(q)) + 0x600 +	\
 					 MT_TXQ_ID(q)* 0x4)
 
+#define MT_TXQ_WED_RING_BASE		0xd7300
+#define MT_RXQ_WED_RING_BASE		0xd7410
+
+#define MT_WED_TX_DONE_BAND0		4
+#define MT_WED_TX_DONE_BAND1		5
+#define MT_WED_TX_FREE_DONE		1
+
 #define MT_INT_SOURCE_CSR		__REG(INT_SOURCE_CSR)
 #define MT_INT_MASK_CSR			__REG(INT_MASK_CSR)
 
Signature · 1 line
2.37.3
author maintainer
#3 lore raw

PATCH 3/3 wifi: mt76: mt7915: enable wed for mt7986-wmac chipset

In reply to Lorenzo Bianconi

Enable WED tx support for mt7986-wmac chipset available on mt7986 board.

---
 .../net/wireless/mediatek/mt76/mt7915/dma.c   | 74 ++++++++++++++-----
 .../net/wireless/mediatek/mt76/mt7915/main.c  |  2 +-
 .../net/wireless/mediatek/mt76/mt7915/mcu.c   |  2 +-
 .../net/wireless/mediatek/mt76/mt7915/mmio.c  | 67 ++++++++++++-----
 .../wireless/mediatek/mt76/mt7915/mt7915.h    |  4 +-
 .../net/wireless/mediatek/mt76/mt7915/pci.c   |  2 +-
 .../net/wireless/mediatek/mt76/mt7915/regs.h  | 17 +++--
 .../net/wireless/mediatek/mt76/mt7915/soc.c   | 21 ++++--
 8 files changed, 134 insertions(+), 55 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/dma.c +54 -20
index 90a89cf493a9..e4fa240834d8 100644
@@ -11,7 +11,11 @@ mt7915_init_tx_queues(struct mt7915_phy *phy, int idx, int n_desc, int ring_base
 	struct mt7915_dev *dev = phy->dev;
 
 	if (mtk_wed_device_active(&phy->dev->mt76.mmio.wed)) {
-		ring_base = MT_WED_TX_RING_BASE;
+		if (is_mt7986(&dev->mt76))
+			ring_base += MT_TXQ_ID(0) * MT_RING_SIZE;
+		else
+			ring_base = MT_WED_TX_RING_BASE;
+
 		idx -= MT_TXQ_ID(0);
 	}
 
@@ -58,17 +62,32 @@ static void mt7915_dma_config(struct mt7915_dev *dev)
 		MCUQ_CONFIG(MT_MCUQ_WA, WFDMA1, MT_INT_TX_DONE_MCU_WA, MT7915_TXQ_MCU_WA);
 		MCUQ_CONFIG(MT_MCUQ_FWDL, WFDMA1, MT_INT_TX_DONE_FWDL, MT7915_TXQ_FWDL);
 	} else {
-		RXQ_CONFIG(MT_RXQ_MAIN, WFDMA0, MT_INT_RX_DONE_BAND0_MT7916, MT7916_RXQ_BAND0);
 		RXQ_CONFIG(MT_RXQ_MCU, WFDMA0, MT_INT_RX_DONE_WM, MT7916_RXQ_MCU_WM);
-		RXQ_CONFIG(MT_RXQ_MCU_WA, WFDMA0, MT_INT_RX_DONE_WA, MT7916_RXQ_MCU_WA);
-		RXQ_CONFIG(MT_RXQ_BAND1, WFDMA0, MT_INT_RX_DONE_BAND1_MT7916, MT7916_RXQ_BAND1);
 		RXQ_CONFIG(MT_RXQ_BAND1_WA, WFDMA0, MT_INT_RX_DONE_WA_EXT_MT7916, MT7916_RXQ_MCU_WA_EXT);
-		RXQ_CONFIG(MT_RXQ_MAIN_WA, WFDMA0, MT_INT_RX_DONE_WA_MAIN_MT7916, MT7916_RXQ_MCU_WA_MAIN);
-		TXQ_CONFIG(0, WFDMA0, MT_INT_TX_DONE_BAND0, MT7915_TXQ_BAND0);
-		TXQ_CONFIG(1, WFDMA0, MT_INT_TX_DONE_BAND1, MT7915_TXQ_BAND1);
 		MCUQ_CONFIG(MT_MCUQ_WM, WFDMA0, MT_INT_TX_DONE_MCU_WM, MT7915_TXQ_MCU_WM);
 		MCUQ_CONFIG(MT_MCUQ_WA, WFDMA0, MT_INT_TX_DONE_MCU_WA_MT7916, MT7915_TXQ_MCU_WA);
 		MCUQ_CONFIG(MT_MCUQ_FWDL, WFDMA0, MT_INT_TX_DONE_FWDL, MT7915_TXQ_FWDL);
+
+		if (is_mt7916(&dev->mt76) && mtk_wed_device_active(&dev->mt76.mmio.wed)) {
+			RXQ_CONFIG(MT_RXQ_MAIN, WFDMA0, MT_INT_WED_RX_DONE_BAND0_MT7916,
+				   MT7916_RXQ_BAND0);
+			RXQ_CONFIG(MT_RXQ_MCU_WA, WFDMA0, MT_INT_WED_RX_DONE_WA_MT7916,
+				   MT7916_RXQ_MCU_WA);
+			RXQ_CONFIG(MT_RXQ_BAND1, WFDMA0, MT_INT_WED_RX_DONE_BAND1_MT7916,
+				   MT7916_RXQ_BAND1);
+			RXQ_CONFIG(MT_RXQ_MAIN_WA, WFDMA0, MT_INT_WED_RX_DONE_WA_MAIN_MT7916,
+				   MT7916_RXQ_MCU_WA_MAIN);
+			TXQ_CONFIG(0, WFDMA0, MT_INT_WED_TX_DONE_BAND0, MT7915_TXQ_BAND0);
+			TXQ_CONFIG(1, WFDMA0, MT_INT_WED_TX_DONE_BAND1, MT7915_TXQ_BAND1);
+		} else {
+			RXQ_CONFIG(MT_RXQ_MAIN, WFDMA0, MT_INT_RX_DONE_BAND0_MT7916, MT7916_RXQ_BAND0);
+			RXQ_CONFIG(MT_RXQ_MCU_WA, WFDMA0, MT_INT_RX_DONE_WA, MT7916_RXQ_MCU_WA);
+			RXQ_CONFIG(MT_RXQ_BAND1, WFDMA0, MT_INT_RX_DONE_BAND1_MT7916, MT7916_RXQ_BAND1);
+			RXQ_CONFIG(MT_RXQ_MAIN_WA, WFDMA0, MT_INT_RX_DONE_WA_MAIN_MT7916,
+				   MT7916_RXQ_MCU_WA_MAIN);
+			TXQ_CONFIG(0, WFDMA0, MT_INT_TX_DONE_BAND0, MT7915_TXQ_BAND0);
+			TXQ_CONFIG(1, WFDMA0, MT_INT_TX_DONE_BAND1, MT7915_TXQ_BAND1);
+		}
 	}
 }
 
@@ -323,7 +342,8 @@ static int mt7915_dma_enable(struct mt7915_dev *dev)
 		u32 wed_irq_mask = irq_mask;
 
 		wed_irq_mask |= MT_INT_TX_DONE_BAND0 | MT_INT_TX_DONE_BAND1;
-		mt76_wr(dev, MT_INT_WED_MASK_CSR, wed_irq_mask);
+		if (!is_mt7986(&dev->mt76))
+			mt76_wr(dev, MT_INT_WED_MASK_CSR, wed_irq_mask);
 		mt76_wr(dev, MT_INT_MASK_CSR, wed_irq_mask);
 		mtk_wed_device_start(&dev->mt76.mmio.wed, wed_irq_mask);
 	}
@@ -349,13 +369,18 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
 
 	mt7915_dma_disable(dev, true);
 
-	if (mtk_wed_device_active(&dev->mt76.mmio.wed)) {
-		mt76_set(dev, MT_WFDMA_HOST_CONFIG, MT_WFDMA_HOST_CONFIG_WED);
-
-		mt76_wr(dev, MT_WFDMA_WED_RING_CONTROL,
-			FIELD_PREP(MT_WFDMA_WED_RING_CONTROL_TX0, 18) |
-			FIELD_PREP(MT_WFDMA_WED_RING_CONTROL_TX1, 19) |
-			FIELD_PREP(MT_WFDMA_WED_RING_CONTROL_RX1, 1));
+	if (mtk_wed_device_active(&mdev->mmio.wed)) {
+		if (!is_mt7986(mdev)) {
+			u8 wed_control_rx1 = is_mt7915(mdev) ? 1 : 2;
+
+			mt76_set(dev, MT_WFDMA_HOST_CONFIG,
+				 MT_WFDMA_HOST_CONFIG_WED);
+			mt76_wr(dev, MT_WFDMA_WED_RING_CONTROL,
+				FIELD_PREP(MT_WFDMA_WED_RING_CONTROL_TX0, 18) |
+				FIELD_PREP(MT_WFDMA_WED_RING_CONTROL_TX1, 19) |
+				FIELD_PREP(MT_WFDMA_WED_RING_CONTROL_RX1,
+					   wed_control_rx1));
+		}
 	} else {
 		mt76_clear(dev, MT_WFDMA_HOST_CONFIG, MT_WFDMA_HOST_CONFIG_WED);
 	}
@@ -411,7 +436,7 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
 		return ret;
 
 	/* event from WA */
-	if (mtk_wed_device_active(&dev->mt76.mmio.wed)) {
+	if (mtk_wed_device_active(&mdev->mmio.wed) && is_mt7915(mdev)) {
 		wa_rx_base = MT_WED_RX_RING_BASE;
 		wa_rx_idx = MT7915_RXQ_MCU_WA;
 		dev->mt76.q_rx[MT_RXQ_MCU_WA].flags = MT_WED_Q_TXFREE;
@@ -438,11 +463,20 @@ int mt7915_dma_init(struct mt7915_dev *dev, struct mt7915_phy *phy2)
 
 	/* tx free notify event from WA for band0 */
 	if (!is_mt7915(mdev)) {
+		wa_rx_base = MT_RXQ_RING_BASE(MT_RXQ_MAIN_WA);
+		wa_rx_idx = MT_RXQ_ID(MT_RXQ_MAIN_WA);
+
+		if (mtk_wed_device_active(&mdev->mmio.wed)) {
+			mdev->q_rx[MT_RXQ_MAIN_WA].flags = MT_WED_Q_TXFREE;
+			if (is_mt7916(mdev)) {
+				wa_rx_base =  MT_WED_RX_RING_BASE;
+				wa_rx_idx = MT7915_RXQ_MCU_WA;
+			}
+		}
+
 		ret = mt76_queue_alloc(dev, &dev->mt76.q_rx[MT_RXQ_MAIN_WA],
-				       MT_RXQ_ID(MT_RXQ_MAIN_WA),
-				       MT7915_RX_MCU_RING_SIZE,
-				       MT_RX_BUF_SIZE,
-				       MT_RXQ_RING_BASE(MT_RXQ_MAIN_WA));
+				       wa_rx_idx, MT7915_RX_MCU_RING_SIZE,
+				       MT_RX_BUF_SIZE, wa_rx_base);
 		if (ret)
 			return ret;
 	}
drivers/net/wireless/mediatek/mt76/mt7915/main.c +1 -1
index 89b519cfd14c..7972760aec83 100644
@@ -1431,7 +1431,7 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw,
 	path->dev = ctx->dev;
 	path->mtk_wdma.wdma_idx = wed->wdma_idx;
 	path->mtk_wdma.bss = mvif->mt76.idx;
-	path->mtk_wdma.wcid = msta->wcid.idx;
+	path->mtk_wdma.wcid = is_mt7915(&dev->mt76) ? msta->wcid.idx : 0x3ff;
 	path->mtk_wdma.queue = phy != &dev->phy;
 
 	ctx->dev = NULL;
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +1 -1
index 8d297e4aa7d4..d56b6d6e99bf 100644
@@ -2274,7 +2274,7 @@ int mt7915_mcu_init(struct mt7915_dev *dev)
 	if (ret)
 		return ret;
 
-	if (mtk_wed_device_active(&dev->mt76.mmio.wed))
+	if (mtk_wed_device_active(&dev->mt76.mmio.wed) && is_mt7915(&dev->mt76))
 		mt7915_mcu_wa_cmd(dev, MCU_WA_PARAM_CMD(CAPABILITY), 0, 0, 0);
 
 	ret = mt7915_mcu_set_mwds(dev, 1);
drivers/net/wireless/mediatek/mt76/mt7915/mmio.c +49 -18

115 lines not on this page · raw message

drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +2 -2
index 93999d633b75..a1bf1d7e7734 100644
@@ -590,7 +590,7 @@ bool mt7915_debugfs_rx_log(struct mt7915_dev *dev, const void *data, int len);
 void mt7915_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 			    struct ieee80211_sta *sta, struct dentry *dir);
 #endif
-int mt7915_mmio_wed_init(struct mt7915_dev *dev, struct pci_dev *pdev,
-			 int *irq);
+int mt7915_mmio_wed_init(struct mt7915_dev *dev, void *pdev_ptr,
+			 bool pci, int *irq);
 
 #endif
drivers/net/wireless/mediatek/mt76/mt7915/pci.c +1 -1
index d73b78bba3e5..743f01f6eae9 100644
@@ -129,7 +129,7 @@ static int mt7915_pci_probe(struct pci_dev *pdev,
 	mt7915_wfsys_reset(dev);
 	hif2 = mt7915_pci_init_hif2(pdev);
 
-	ret = mt7915_mmio_wed_init(dev, pdev, &irq);
+	ret = mt7915_mmio_wed_init(dev, pdev, true, &irq);
 	if (ret < 0)
 		goto free_wed_or_irq_vector;
 
drivers/net/wireless/mediatek/mt76/mt7915/regs.h +11 -6
index d9642c5817e9..5180dd931835 100644
@@ -26,6 +26,8 @@ enum reg_rev {
 	INFRA_MCU_ADDR_END,
 	FW_EXCEPTION_ADDR,
 	SWDEF_BASE_ADDR,
+	TXQ_WED_RING_BASE,
+	RXQ_WED_RING_BASE,
 	__MT_REG_MAX,
 };
 
@@ -643,12 +645,8 @@ enum offs_rev {
 #define MT_TXQ_EXT_CTRL(q)		(MT_Q_BASE(__TXQ(q)) + 0x600 +	\
 					 MT_TXQ_ID(q)* 0x4)
 
-#define MT_TXQ_WED_RING_BASE		0xd7300
-#define MT_RXQ_WED_RING_BASE		0xd7410
-
-#define MT_WED_TX_DONE_BAND0		4
-#define MT_WED_TX_DONE_BAND1		5
-#define MT_WED_TX_FREE_DONE		1
+#define MT_TXQ_WED_RING_BASE		__REG(TXQ_WED_RING_BASE)
+#define MT_RXQ_WED_RING_BASE		__REG(RXQ_WED_RING_BASE)
 
 #define MT_INT_SOURCE_CSR		__REG(INT_SOURCE_CSR)
 #define MT_INT_MASK_CSR			__REG(INT_MASK_CSR)
@@ -668,6 +666,11 @@ enum offs_rev {
 #define MT_INT_RX_DONE_WA_MAIN_MT7916	BIT(2)
 #define MT_INT_RX_DONE_WA_EXT_MT7916	BIT(3)
 
+#define MT_INT_WED_RX_DONE_BAND0_MT7916		BIT(18)
+#define MT_INT_WED_RX_DONE_BAND1_MT7916		BIT(19)
+#define MT_INT_WED_RX_DONE_WA_MAIN_MT7916	BIT(1)
+#define MT_INT_WED_RX_DONE_WA_MT7916		BIT(17)
+
 #define MT_INT_RX(q)			(dev->q_int_mask[__RXQ(q)])
 #define MT_INT_TX_MCU(q)		(dev->q_int_mask[(q)])
 
@@ -691,6 +694,8 @@ enum offs_rev {
 #define MT_INT_TX_DONE_BAND0		BIT(30)
 #define MT_INT_TX_DONE_BAND1		BIT(31)
 #define MT_INT_TX_DONE_MCU_WA_MT7916	BIT(25)
+#define MT_INT_WED_TX_DONE_BAND0	BIT(4)
+#define MT_INT_WED_TX_DONE_BAND1	BIT(5)
 
 #define MT_INT_TX_DONE_MCU		(MT_INT_TX_MCU(MT_MCUQ_WA) |	\
 					 MT_INT_TX_MCU(MT_MCUQ_WM) |	\
drivers/net/wireless/mediatek/mt76/mt7915/soc.c +15 -6
index c74afa746251..c06c56a0270d 100644
@@ -1172,10 +1172,6 @@ static int mt7986_wmac_probe(struct platform_device *pdev)
 
 	chip_id = (uintptr_t)of_device_get_match_data(&pdev->dev);
 
-	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
-		return irq;
-
 	mem_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(mem_base)) {
 		dev_err(&pdev->dev, "Failed to get memory resource\n");
@@ -1187,6 +1183,18 @@ static int mt7986_wmac_probe(struct platform_device *pdev)
 		return PTR_ERR(dev);
 
 	mdev = &dev->mt76;
+	ret = mt7915_mmio_wed_init(dev, pdev, false, &irq);
+	if (ret < 0)
+		goto free_device;
+
+	if (!ret) {
+		irq = platform_get_irq(pdev, 0);
+		if (irq < 0) {
+			ret = irq;
+			goto free_device;
+		}
+	}
+
 	ret = devm_request_irq(mdev->dev, irq, mt7915_irq_handler,
 			       IRQF_SHARED, KBUILD_MODNAME, dev);
 	if (ret)
@@ -1206,9 +1214,10 @@ static int mt7986_wmac_probe(struct platform_device *pdev)
 
 free_irq:
 	devm_free_irq(mdev->dev, irq, dev);
-
 free_device:
-	mt76_free_device(&dev->mt76);
+	if (mtk_wed_device_active(&mdev->mmio.wed))
+		mtk_wed_device_detach(&mdev->mmio.wed);
+	mt76_free_device(mdev);
 
 	return ret;
 }
Signature · 1 line
2.37.3
#4 lore raw
In reply to Lorenzo Bianconi
Quoted 1 line · Lorenzo Bianconi

Enable WED TX support for mt7915 and mt7986-wmac drivers running on MT7986 SoC.

What's WED TX?

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
author maintainer
#5 lore raw
Quoted 5 lines
Quoted 1 line · Lorenzo Bianconi

Enable WED TX support for mt7915 and mt7986-wmac drivers running on MT7986 SoC.

What's WED TX?

It is the same as we did for MT7622. It is the capability to offload traffic from lan/wan to wlan. I specified "TX" since MT7986 supports even RX offloading (I am working on it at the moment).

Regards,
Lorenzo

Quoted 5 lines
Signature · 4 lines
-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#6 lore raw
Quoted 9 lines · Lorenzo Bianconi
Quoted 5 lines
Quoted 1 line · Lorenzo Bianconi

Enable WED TX support for mt7915 and mt7986-wmac drivers running on MT7986 SoC.

What's WED TX?

It is the same as we did for MT7622. It is the capability to offload traffic from lan/wan to wlan. I specified "TX" since MT7986 supports even RX offloading (I am working on it at the moment).

It would be nice to mention in the commit log that the feature is about offloading traffic from lan/wan to wlan. That way it's stored to to git history and people like me have some clue what the patch is about, otherwise we are totally in dark.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
author maintainer
#7 lore raw
Quoted 8 lines
Quoted 6 lines · Lorenzo Bianconi
Quoted 5 lines
Quoted 1 line · Lorenzo Bianconi

Enable WED TX support for mt7915 and mt7986-wmac drivers running on MT7986 SoC.

What's WED TX?

Quoted 8 lines
Quoted 3 lines

It is the same as we did for MT7622. It is the capability to offload traffic from lan/wan to wlan. I specified "TX" since MT7986 supports even RX offloading (I am working on it at the moment).

It would be nice to mention in the commit log that the feature is about offloading traffic from lan/wan to wlan. That way it's stored to to git history and people like me have some clue what the patch is about, otherwise we are totally in dark.

I think Felix has already applied them.
@Felix: are you taking care of it or do I need to repost?

Regards,
Lorenzo

Quoted 5 lines
Signature · 4 lines
-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
maintainer
#8 lore raw
Quoted 12 lines · Lorenzo Bianconi
Quoted 12 lines
Quoted 9 lines · Lorenzo Bianconi
Quoted 5 lines
Quoted 1 line · Lorenzo Bianconi

Enable WED TX support for mt7915 and mt7986-wmac drivers running on MT7986 SoC.

What's WED TX?

It is the same as we did for MT7622. It is the capability to offload traffic from lan/wan to wlan. I specified "TX" since MT7986 supports even RX offloading (I am working on it at the moment).

Quoted 7 lines
Quoted 4 lines

It would be nice to mention in the commit log that the feature is about offloading traffic from lan/wan to wlan. That way it's stored to to git history and people like me have some clue what the patch is about, otherwise we are totally in dark.

I think Felix has already applied them.
@Felix: are you taking care of it or do I need to repost?

No need to repost - just send me the description that you want to put in there, and I'll update the commit.

- Felix

#9 lore raw
Quoted 17 lines · Felix Fietkau
Quoted 16 lines · Lorenzo Bianconi
Quoted 15 lines
Quoted 2 lines · Lorenzo Bianconi
Quoted 2 lines
Quoted 1 line · Lorenzo Bianconi
Quoted 1 line
Quoted 1 line

Enable WED TX support for mt7915 and mt7986-wmac drivers

running on MT7986 SoC.

Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

What's WED TX?

It is the same as we did for MT7622. It is the capability to offload traffic from lan/wan to wlan. I specified "TX" since MT7986 supports even RX offloading (I am working on it at the moment).

It would be nice to mention in the commit log that the feature is about offloading traffic from lan/wan to wlan. That way it's stored to to git history and people like me have some clue what the patch is about, otherwise we are totally in dark.

Quoted 5 lines
Quoted 2 lines

I think Felix has already applied them.
@Felix: are you taking care of it or do I need to repost?

No need to repost - just send me the description that you want to put in there, and I'll update the commit.

Thanks. And if it's too much work to change it feel free to keep it as is. Just try to keep this mind in the future when using exotic acronyms :)

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
author maintainer
#10 lore raw
Quoted 19 lines
Quoted 17 lines · Felix Fietkau
Quoted 16 lines · Lorenzo Bianconi
Quoted 15 lines
Quoted 2 lines · Lorenzo Bianconi
Quoted 2 lines
Quoted 1 line · Lorenzo Bianconi
Quoted 1 line
Quoted 1 line

Enable WED TX support for mt7915 and mt7986-wmac drivers

running on MT7986 SoC.

Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

What's WED TX?

It is the same as we did for MT7622. It is the capability to offload traffic from lan/wan to wlan. I specified "TX" since MT7986 supports even RX offloading (I am working on it at the moment).

It would be nice to mention in the commit log that the feature is about offloading traffic from lan/wan to wlan. That way it's stored to to git history and people like me have some clue what the patch is about, otherwise we are totally in dark.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I think Felix has already applied them.
@Felix: are you taking care of it or do I need to repost?

No need to repost - just send me the description that you want to put in there, and I'll update the commit.

Thanks. And if it's too much work to change it feel free to keep it as is. Just try to keep this mind in the future when using exotic acronyms :)

ack, I will do for the rx counterpart :)

Regards,
Lorenzo

Quoted 5 lines
Signature · 4 lines
-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches