Skip to contentSkip to conversation

wifi: mt76: mt792x: consolidate rx interrupt masks into all_complete_mask

PATCH New JB Tsai 3 participants 7 messages Jun 12 – Aug 13

Subsystems (3)
lore
Share & tools
lore

JB Tsai

author
#0 lore raw

PATCH 1/20 wifi: mt76: mt792x: consolidate rx interrupt masks into all_complete_mask

From: Emery Hsin <[email protected]>

Add all_complete_mask to irq_map rx sub-struct and use it in mt792x_irq_tasklet() and mt792x_dma_enable() to replace individual per-ring mask OR expressions.

This is a preparation patch before enabling MT7928 PCIe support.

---
 drivers/net/wireless/mediatek/mt76/mt792x.h     | 1 +
 drivers/net/wireless/mediatek/mt76/mt792x_dma.c | 8 ++------
 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/net/wireless/mediatek/mt76/mt792x.h +1 -0
index 70073b43af54..83c729f8bb76 100644
@@ -200,6 +200,7 @@ struct mt792x_irq_map {
 		u32 mcu_complete_mask;
 	} tx;
 	struct {
+		u32 all_complete_mask;
 		u32 data_complete_mask;
 		u32 wm_complete_mask;
 		u32 wm2_complete_mask;
drivers/net/wireless/mediatek/mt76/mt792x_dma.c +2 -6
index fc326447c792..946ff6d58954 100644
@@ -39,9 +39,7 @@ void mt792x_irq_tasklet(unsigned long data)
 
 	trace_dev_irq(&dev->mt76, intr, dev->mt76.mmio.irqmask);
 
-	mask |= intr & (irq_map->rx.data_complete_mask |
-			irq_map->rx.wm_complete_mask |
-			irq_map->rx.wm2_complete_mask);
+	mask |= intr & irq_map->rx.all_complete_mask;
 	if (intr & dev->irq_map->tx.mcu_complete_mask)
 		mask |= dev->irq_map->tx.mcu_complete_mask;
 
@@ -276,9 +274,7 @@ int mt792x_dma_enable(struct mt792x_dev *dev)
 	/* enable interrupts for TX/RX rings */
 	mt76_connac_irq_enable(&dev->mt76,
 			       dev->irq_map->tx.all_complete_mask |
-			       dev->irq_map->rx.data_complete_mask |
-			       dev->irq_map->rx.wm2_complete_mask |
-			       dev->irq_map->rx.wm_complete_mask |
+			       dev->irq_map->rx.all_complete_mask |
 			       MT_INT_MCU_CMD);
 	mt76_set(dev, MT_MCU2HOST_SW_INT_ENA, MT_MCU_CMD_WAKE_RX_PCIE);
 
Signature · 1 line
2.45.2
author
#1 lore raw

PATCH 2/20 wifi: mt76: connac2: apply new rx all_complete_mask

From: Emery Hsin <[email protected]>

Populate all_complete_mask in MT7921 irq_map and update pci_resume() and mac_reset() to use irq_map->rx.all_complete_mask instead of the hardcoded MT_INT_RX_DONE_ALL macro.

This is a preparation patch before enabling MT7928 PCIe support.

---
 drivers/net/wireless/mediatek/mt76/mt7921/pci.c     | 4 +++-
 drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/pci.c +3 -1
index 49a37185f056..067f6b4142b6 100644
@@ -292,6 +292,7 @@ static int mt7921_pci_probe(struct pci_dev *pdev,
 			.mcu_complete_mask = MT_INT_TX_DONE_MCU,
 		},
 		.rx = {
+			.all_complete_mask = MT_INT_RX_DONE_ALL,
 			.data_complete_mask = MT_INT_RX_DONE_DATA,
 			.wm_complete_mask = MT_INT_RX_DONE_WM,
 			.wm2_complete_mask = MT_INT_RX_DONE_WM2,
@@ -559,7 +560,8 @@ static int mt7921_pci_resume(struct device *device)
 	mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0xff);
 	mt76_connac_irq_enable(&dev->mt76,
 			       dev->irq_map->tx.all_complete_mask |
-			       MT_INT_RX_DONE_ALL | MT_INT_MCU_CMD);
+			       dev->irq_map->rx.all_complete_mask |
+			       MT_INT_MCU_CMD);
 	mt76_set(dev, MT_MCU2HOST_SW_INT_ENA, MT_MCU_CMD_WAKE_RX_PCIE);
 
 	/* put dma enabled */
drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c +2 -1
index 0db7acb3a637..98b3469ac597 100644
@@ -96,7 +96,8 @@ int mt7921e_mac_reset(struct mt792x_dev *dev)
 
 	mt76_wr(dev, dev->irq_map->host_irq_enable,
 		dev->irq_map->tx.all_complete_mask |
-		MT_INT_RX_DONE_ALL | MT_INT_MCU_CMD);
+		dev->irq_map->rx.all_complete_mask |
+		MT_INT_MCU_CMD);
 	mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0xff);
 
 	err = mt7921e_driver_own(dev);
Signature · 1 line
2.45.2
author
#2 lore raw

PATCH 3/20 wifi: mt76: mt7925: replace shared rx irq masks with per-chip definitions

In reply to JB Tsai

From: Emery Hsin <[email protected]>

Replace shared MT_INT_RX_DONE_* macros with chip-specific MT7925_INT_RX_DONE_{DATA,WM,WM2,ALL} and populate all_complete_mask in mt7925_irq_map. Update resume and mac_reset paths accordingly.

This is a preparation patch before enabling MT7928 PCIe support.

---
 .../net/wireless/mediatek/mt76/mt7925/pci.c   | 33 ++++++++++---------
 .../wireless/mediatek/mt76/mt7925/pci_mac.c   |  4 +--
 .../net/wireless/mediatek/mt76/mt7925/regs.h  |  9 ++---
 3 files changed, 23 insertions(+), 23 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/pci.c +17 -16
index ea64303283ed..95a0bd615167 100644
@@ -298,6 +298,20 @@ static int mt7925_dma_init(struct mt792x_dev *dev)
 	return mt792x_dma_enable(dev);
 }
 
+static const struct mt792x_irq_map mt7925_irq_map = {
+	.host_irq_enable = MT_WFDMA0_HOST_INT_ENA,
+	.tx = {
+		.all_complete_mask = MT_INT_TX_DONE_ALL,
+		.mcu_complete_mask = MT_INT_TX_DONE_MCU,
+	},
+	.rx = {
+		.all_complete_mask = MT7925_INT_RX_DONE_ALL,
+		.data_complete_mask = MT7925_INT_RX_DONE_DATA,
+		.wm_complete_mask = MT7925_INT_RX_DONE_WM,
+		.wm2_complete_mask = MT_INT_RX_DONE_WM2,
+	},
+};
+
 static const struct mt792x_irq_map mt7927_irq_map = {
 	.host_irq_enable = MT_WFDMA0_HOST_INT_ENA,
 	.tx = {
@@ -339,17 +353,6 @@ static int mt7925_pci_probe(struct pci_dev *pdev,
 		.drv_own = mt792xe_mcu_drv_pmctrl,
 		.fw_own = mt792xe_mcu_fw_pmctrl,
 	};
-	static const struct mt792x_irq_map irq_map = {
-		.host_irq_enable = MT_WFDMA0_HOST_INT_ENA,
-		.tx = {
-			.all_complete_mask = MT_INT_TX_DONE_ALL,
-			.mcu_complete_mask = MT_INT_TX_DONE_MCU,
-		},
-		.rx = {
-			.data_complete_mask = HOST_RX_DONE_INT_ENA2,
-			.wm_complete_mask = HOST_RX_DONE_INT_ENA0,
-		},
-	};
 	struct ieee80211_ops *ops;
 	struct mt76_bus_ops *bus_ops;
 	struct mt792x_dev *dev;
@@ -407,7 +410,7 @@ static int mt7925_pci_probe(struct pci_dev *pdev,
 	dev = container_of(mdev, struct mt792x_dev, mt76);
 	dev->fw_features = features;
 	dev->hif_ops = &mt7925_pcie_ops;
-	dev->irq_map = is_mt7927_hw ? &mt7927_irq_map : &irq_map;
+	dev->irq_map = is_mt7927_hw ? &mt7927_irq_map : &mt7925_irq_map;
 	mt76_mmio_init(&dev->mt76, pcim_iomap_table(pdev)[0]);
 	tasklet_init(&mdev->irq_tasklet, mt792x_irq_tasklet, (unsigned long)dev);
 
@@ -456,7 +459,7 @@ static int mt7925_pci_probe(struct pci_dev *pdev,
 	if (ret)
 		goto err_free_dev;
 
-	mt76_wr(dev, irq_map.host_irq_enable, 0);
+	mt76_wr(dev, dev->irq_map->host_irq_enable, 0);
 
 	mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0xff);
 
@@ -613,9 +616,7 @@ static int _mt7925_pci_resume(struct device *device, bool restore)
 	mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0xff);
 	mt76_connac_irq_enable(&dev->mt76,
 			       dev->irq_map->tx.all_complete_mask |
-			       dev->irq_map->rx.data_complete_mask |
-			       dev->irq_map->rx.wm_complete_mask |
-			       dev->irq_map->rx.wm2_complete_mask |
+			       dev->irq_map->rx.all_complete_mask |
 			       MT_INT_MCU_CMD);
 	mt76_set(dev, MT_MCU2HOST_SW_INT_ENA, MT_MCU_CMD_WAKE_RX_PCIE);
 
drivers/net/wireless/mediatek/mt76/mt7925/pci_mac.c +1 -3
index 97683949a305..d288739e1307 100644
@@ -119,9 +119,7 @@ int mt7925e_mac_reset(struct mt792x_dev *dev)
 
 	mt76_wr(dev, dev->irq_map->host_irq_enable,
 		dev->irq_map->tx.all_complete_mask |
-		dev->irq_map->rx.data_complete_mask |
-		dev->irq_map->rx.wm_complete_mask |
-		dev->irq_map->rx.wm2_complete_mask |
+		dev->irq_map->rx.all_complete_mask |
 		MT_INT_MCU_CMD);
 	mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0xff);
 
drivers/net/wireless/mediatek/mt76/mt7925/regs.h +5 -4
index 24985bba1b90..aed90cc82858 100644
@@ -43,11 +43,12 @@
 #define HOST_TX_DONE_INT_ENA17		BIT(27)
 
 /* WFDMA interrupt */
-#define MT_INT_RX_DONE_DATA		HOST_RX_DONE_INT_ENA2
-#define MT_INT_RX_DONE_WM		HOST_RX_DONE_INT_ENA0
 #define MT_INT_RX_DONE_WM2		HOST_RX_DONE_INT_ENA1
-#define MT_INT_RX_DONE_ALL		(MT_INT_RX_DONE_DATA | \
-					 MT_INT_RX_DONE_WM | \
+
+#define MT7925_INT_RX_DONE_DATA		HOST_RX_DONE_INT_ENA2
+#define MT7925_INT_RX_DONE_WM		HOST_RX_DONE_INT_ENA0
+#define MT7925_INT_RX_DONE_ALL		(MT7925_INT_RX_DONE_DATA | \
+					 MT7925_INT_RX_DONE_WM | \
 					 MT_INT_RX_DONE_WM2)
 
 #define MT_INT_TX_DONE_MCU_WM		(HOST_TX_DONE_INT_ENA15 | \
Signature · 1 line
2.45.2
#3 lore raw

PATCH 1/1 wifi: mt76: mt7925: remove wm2_complete_mask from mt7925_irq_map

Commit
c4edf9e3e0e5 ("wifi: mt76: mt7925: replace shared rx irq masks with per-chip definitions") introduces a non-NULL wm2_complete_mask element to mt7925_irq_map. This gives a NULL pointer dereference error when resuming from hibernate:

[ T2001] BUG: kernel NULL pointer dereference, address: 0000000000000a98
[ T2001] #PF: supervisor write access in kernel mode
[ T2001] #PF: error_code(0x0002) - not-present page
[ T2001] PGD 0 P4D 0
[ T2001] Oops: Oops: 0002 [#1] SMP NOPTI
[ T2001] CPU: 5 UID: 0 PID: 2001 Comm: kworker/u128:4 Tainted: G W 7.2.0-rc4-bisect-00876-gc4edf9e3e0e5-dirty #746 PREEMPT_RT
[ T2001] Tainted: [W]=WARN
[ T2001] Hardware name: ASUS System Product Name/ROG STRIX B850-F GAMING WIFI, BIOS 1627 02/05/2026
[ T2001] Workqueue: mt76 mt7925_mac_reset_work [mt7925_common]
[ T2001] RIP: 0010:mutex_lock+0xe/0x30
[ T2001] Code: 75 07 31 c0 c3 cc cc cc cc be 01 00 00 00 e9 79 fe ff ff 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 65 48 8b 15 94 13 83 00 31 c0 <f0> 48 0f b1 57 18 75 05 c3 cc cc cc cc be 02 00 00 00 e9 4b fe ff [ T2001] RSP: 0018:ffffa53dc250fdc8 EFLAGS: 00010246
[ T2001] RAX: 0000000000000000 RBX: ffff951e8d0e3420 RCX: 0000000000000000
[ T2001] RDX: ffff951f64f145c0 RSI: 0000000000000002 RDI: 0000000000000a80
[ T2001] RBP: 0000000000000000 R08: 0000000000000004 R09: 0000000000000001
[ T2001] R10: 0000000000000000 R11: 0000000000000004 R12: ffff951e8d0e3020
[ T2001] R13: ffff951e8d0e2680 R14: ffff951e8d0e0aa0 R15: 0000000000000000
[ T2001] FS: 0000000000000000(0000) GS:ffff952ccc8b3000(0000) knlGS:0000000000000000
[ T2001] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ T2001] CR2: 0000000000000a98 CR3: 000000050641e000 CR4: 0000000000f50ef0
[ T2001] PKRU: 55555554
[ T2001] Call Trace:

[ T2001]  <TASK>
[ T2001]  ? napi_disable+0x18/0x40
[ T2001]  ? mt7925e_mac_reset+0x2f8/0x390 [mt7925e]
[ T2001]  ? mt7925_mac_reset_work+0x98/0x1c0 [mt7925_common]
[ T2001]  ? drm_sched_run_job_work+0x1c/0x2d0 [gpu_sched]
[ T2001]  ? pwq_dec_nr_in_flight+0x29a/0x3a0
[ T2001]  ? process_one_work+0x199/0x2a0
[ T2001]  ? worker_thread+0x1a0/0x2f0
[ T2001]  ? rescuer_thread+0x550/0x550
[ T2001]  ? kthread+0xd1/0x110
[ T2001]  ? kthread_affine_node+0x100/0x100
[ T2001]  ? ret_from_fork+0x1f9/0x2b0
[ T2001]  ? kthread_affine_node+0x100/0x100
[ T2001]  ? kthread_affine_node+0x100/0x100
[ T2001]  ? ret_from_fork_asm+0x11/0x20
[ T2001]  </TASK>

Remove wm2_complete_mask from mt7925_irq_map to fix the issue.

Fixes c4edf9e3e0e5 ("wifi: mt76: mt7925: replace shared rx irq masks with per-chip definitions")
---
 drivers/net/wireless/mediatek/mt76/mt7925/pci.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7925/pci.c +0 -1
index 02ef09dd797d..d2c0a78ae9f2 100644
@@ -493,7 +493,6 @@ static const struct mt792x_irq_map mt7925_irq_map = {
 		.all_complete_mask = MT7925_INT_RX_DONE_ALL,
 		.data_complete_mask = MT7925_INT_RX_DONE_DATA,
 		.wm_complete_mask = MT7925_INT_RX_DONE_WM,
-		.wm2_complete_mask = MT_INT_RX_DONE_WM2,
 	},
 };
 
Signature · 12 lines
2.55.0

I noticed that my debian sid system running linux next-20260812 would
resume from hibernation either displaying a frozen GUI or show the
mentioned backtrace in dmesg and freezing seconds after that. I bisected
the issue to commit 
c4edf9e3e0e5 ("wifi: mt76: mt7925: replace shared rx irq masks with per-chip definitions")
which introduces a non-NULL wm2_complete_mask to mt7925_irq_map.
Removing wm2_complete_mask from mt7925_irq_map fixes the issue in
next-20260812.

Bert Karwatzki
#4 lore raw

RE: [PATCH] wifi: mt76: mt7925: remove wm2_complete_mask from mt7925_irq_map

Hi Bert,

Thanks for your feedback. Actually, we encountered the same issue during our internal testing and have already submitted a fix. The solution is basically the same.
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

Sorry for any bother with this issue.

BRs,
Emery

-----Original Message-----
From: Bert Karwatzki <[email protected]>
Sent: Thursday, August 13, 2026 10:58 PM
To: Emery Hsin (辛承宣) <[email protected]>
Cc: Bert Karwatzki <[email protected]>; Felix Fietkau <[email protected]>; [email protected]; [email protected]; [email protected]; JB Tsai (蔡志彬) <[email protected]>; Deren Wu (武德仁) <[email protected]>; Leon Yen (顏良儒) <[email protected]>; Quan Zhou (周全) <[email protected]>; Ryder Lee <[email protected]>; Sean Wang <[email protected]>; [email protected]; Litien Chang (張立典) <[email protected]>; [email protected]
Subject: [PATCH] wifi: mt76: mt7925: remove wm2_complete_mask from mt7925_irq_map

Commit
c4edf9e3e0e5 ("wifi: mt76: mt7925: replace shared rx irq masks with per-chip definitions") introduces a non-NULL wm2_complete_mask element to mt7925_irq_map. This gives a NULL pointer dereference error when resuming from hibernate:

[ T2001] BUG: kernel NULL pointer dereference, address: 0000000000000a98 [ T2001] #PF: supervisor write access in kernel mode [ T2001] #PF: error_code(0x0002) - not-present page [ T2001] PGD 0 P4D 0 [ T2001] Oops: Oops: 0002 [#1] SMP NOPTI
[ T2001] CPU: 5 UID: 0 PID: 2001 Comm: kworker/u128:4 Tainted: G W 7.2.0-rc4-bisect-00876-gc4edf9e3e0e5-dirty #746 PREEMPT_RT
[ T2001] Tainted: [W]=WARN
[ T2001] Hardware name: ASUS System Product Name/ROG STRIX B850-F GAMING WIFI, BIOS 1627 02/05/2026 [ T2001] Workqueue: mt76 mt7925_mac_reset_work [mt7925_common] [ T2001] RIP: 0010:mutex_lock+0xe/0x30 [ T2001] Code: 75 07 31 c0 c3 cc cc cc cc be 01 00 00 00 e9 79 fe ff ff 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 65 48 8b 15 94 13 83 00 31 c0 <f0> 48 0f b1 57 18 75 05 c3 cc cc cc cc be 02 00 00 00 e9 4b fe ff [ T2001] RSP: 0018:ffffa53dc250fdc8 EFLAGS: 00010246 [ T2001] RAX: 0000000000000000 RBX: ffff951e8d0e3420 RCX: 0000000000000000 [ T2001] RDX: ffff951f64f145c0 RSI: 0000000000000002 RDI: 0000000000000a80 [ T2001] RBP: 0000000000000000 R08: 0000000000000004 R09: 0000000000000001 [ T2001] R10: 0000000000000000 R11: 0000000000000004 R12: ffff951e8d0e3020 [ T2001] R13: ffff951e8d0e2680 R14: ffff951e8d0e0aa0 R15: 0000000000000000 [ T2001] FS: 0000000000000000(0000) GS:ffff952ccc8b3000(0000) knlGS:0000000000000000 [ T2001] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ T2001] CR2: 0000000000000a98 CR3: 000000050641e000 CR4: 0000000000f50ef0 [ T2001] PKRU: 55555554 [ T2001] Call Trace:

[ T2001]  <TASK>
[ T2001]  ? napi_disable+0x18/0x40
[ T2001]  ? mt7925e_mac_reset+0x2f8/0x390 [mt7925e] [ T2001]  ? mt7925_mac_reset_work+0x98/0x1c0 [mt7925_common] [ T2001]  ? drm_sched_run_job_work+0x1c/0x2d0 [gpu_sched] [ T2001]  ? pwq_dec_nr_in_flight+0x29a/0x3a0 [ T2001]  ? process_one_work+0x199/0x2a0 [ T2001]  ? worker_thread+0x1a0/0x2f0 [ T2001]  ? rescuer_thread+0x550/0x550 [ T2001]  ? kthread+0xd1/0x110 [ T2001]  ? kthread_affine_node+0x100/0x100 [ T2001]  ? ret_from_fork+0x1f9/0x2b0 [ T2001]  ? kthread_affine_node+0x100/0x100 [ T2001]  ? kthread_affine_node+0x100/0x100 [ T2001]  ? ret_from_fork_asm+0x11/0x20 [ T2001]  </TASK>

Remove wm2_complete_mask from mt7925_irq_map to fix the issue.

Fixes c4edf9e3e0e5 ("wifi: mt76: mt7925: replace shared rx irq masks with per-chip definitions")
---
 drivers/net/wireless/mediatek/mt76/mt7925/pci.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7925/pci.c +0 -1
index 02ef09dd797d..d2c0a78ae9f2 100644
@@ -493,7 +493,6 @@ static const struct mt792x_irq_map mt7925_irq_map = {
 		.all_complete_mask = MT7925_INT_RX_DONE_ALL,
 		.data_complete_mask = MT7925_INT_RX_DONE_DATA,
 		.wm_complete_mask = MT7925_INT_RX_DONE_WM,
-		.wm2_complete_mask = MT_INT_RX_DONE_WM2,
 	},
 };
 

--
2.55.0

I noticed that my debian sid system running linux next-20260812 would resume from hibernation either displaying a frozen GUI or show the mentioned backtrace in dmesg and freezing seconds after that. I bisected the issue to commit c4edf9e3e0e5 ("wifi: mt76: mt7925: replace shared rx irq masks with per-chip definitions") which introduces a non-NULL wm2_complete_mask to mt7925_irq_map.
Removing wm2_complete_mask from mt7925_irq_map fixes the issue in next-20260812.

Bert Karwatzki

author
#5 lore raw

PATCH 4/20 wifi: mt76: mt7925: add MT7927 per-chip rx irq definitions

In reply to JB Tsai

From: Emery Hsin <[email protected]>

Add MT7927_INT_RX_DONE_{DATA,WM,WM2,ALL} macros and populate all_complete_mask in mt7927_irq_map. MT7927 maps RX_DONE_DATA to ENA4 and RX_DONE_WM to ENA6, differing from MT7925.

This is a preparation patch before enabling MT7928 PCIe support.

---
 drivers/net/wireless/mediatek/mt76/mt7925/pci.c  | 8 +++++---
 drivers/net/wireless/mediatek/mt76/mt7925/regs.h | 7 +++++++
 2 files changed, 12 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/pci.c +5 -3
index 95a0bd615167..8a4fb53c718f 100644
@@ -319,11 +319,13 @@ static const struct mt792x_irq_map mt7927_irq_map = {
 		.mcu_complete_mask = MT_INT_TX_DONE_MCU,
 	},
 	.rx = {
-		.data_complete_mask = MT7927_RX_DONE_INT_ENA4,
-		.wm_complete_mask = MT7927_RX_DONE_INT_ENA6,
-		.wm2_complete_mask = MT7927_RX_DONE_INT_ENA7,
+		.all_complete_mask = MT7927_INT_RX_DONE_ALL,
+		.data_complete_mask = MT7927_INT_RX_DONE_DATA,
+		.wm_complete_mask = MT7927_INT_RX_DONE_WM,
+		.wm2_complete_mask = MT7927_INT_RX_DONE_WM2,
 	},
 };
+
 static int mt7925_pci_probe(struct pci_dev *pdev,
 			    const struct pci_device_id *id)
 {
drivers/net/wireless/mediatek/mt76/mt7925/regs.h +7 -0
index aed90cc82858..bb5969689337 100644
@@ -51,6 +51,13 @@
 					 MT7925_INT_RX_DONE_WM | \
 					 MT_INT_RX_DONE_WM2)
 
+#define MT7927_INT_RX_DONE_DATA		MT7927_RX_DONE_INT_ENA4
+#define MT7927_INT_RX_DONE_WM		MT7927_RX_DONE_INT_ENA6
+#define MT7927_INT_RX_DONE_WM2		MT7927_RX_DONE_INT_ENA7
+#define MT7927_INT_RX_DONE_ALL		(MT7927_INT_RX_DONE_DATA | \
+					 MT7927_INT_RX_DONE_WM | \
+					 MT7927_INT_RX_DONE_WM2)
+
 #define MT_INT_TX_DONE_MCU_WM		(HOST_TX_DONE_INT_ENA15 | \
 					 HOST_TX_DONE_INT_ENA17)
 
Signature · 1 line
2.45.2
author
#6 lore raw

PATCH 5/20 wifi: mt76: mt792x: replace shared PCIe MAC macros with per-chip struct

In reply to JB Tsai

From: Emery Hsin <[email protected]>

Replace hardcoded MT_PCIE_MAC_INT_ENABLE and MT_PCIE_MAC_PM macros with a per-chip mt792x_pcie_reg struct. Remove the shared macros from mt792x_regs.h and update mt792x_wpdma_reinit_cond() to use dev->pcie_reg.

This is a preparation patch before enabling MT7928 PCIe support.

---
 drivers/net/wireless/mediatek/mt76/mt792x.h      | 6 ++++++
 drivers/net/wireless/mediatek/mt76/mt792x_dma.c  | 6 ++++--
 drivers/net/wireless/mediatek/mt76/mt792x_regs.h | 4 ----
 3 files changed, 10 insertions(+), 6 deletions(-)
drivers/net/wireless/mediatek/mt76/mt792x.h +6 -0
index 83c729f8bb76..eacee63e13f3 100644
@@ -238,6 +238,11 @@ struct mt792x_hif_ops {
 	int (*fw_own)(struct mt792x_dev *dev);
 };
 
+struct mt792x_pcie_reg {
+	u32 imask;
+	u32 pm;
+};
+
 struct mt792x_dev {
 	union { /* must be first */
 		struct mt76_dev mt76;
@@ -273,6 +278,7 @@ struct mt792x_dev {
 	struct mt76_connac_coredump coredump;
 	const struct mt792x_hif_ops *hif_ops;
 	const struct mt792x_irq_map *irq_map;
+	const struct mt792x_pcie_reg *pcie_reg;
 
 	struct work_struct ipv6_ns_work;
 	struct delayed_work mlo_pm_work;
drivers/net/wireless/mediatek/mt76/mt792x_dma.c +4 -2
index 946ff6d58954..2947504ef20b 100644
@@ -345,7 +345,8 @@ int mt792x_wpdma_reinit_cond(struct mt792x_dev *dev)
 	if (mt792x_dma_need_reinit(dev)) {
 		/* disable interrutpts */
 		mt76_wr(dev, dev->irq_map->host_irq_enable, 0);
-		mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0x0);
+		if (dev->pcie_reg)
+			mt76_wr(dev, dev->pcie_reg->imask, 0x0);
 
 		err = mt792x_wpdma_reset(dev, false);
 		if (err) {
@@ -354,7 +355,8 @@ int mt792x_wpdma_reinit_cond(struct mt792x_dev *dev)
 		}
 
 		/* enable interrutpts */
-		mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0xff);
+		if (dev->pcie_reg)
+			mt76_wr(dev, dev->pcie_reg->imask, 0xff);
 		pm->stats.lp_wake++;
 	}
 
drivers/net/wireless/mediatek/mt76/mt792x_regs.h +0 -4
index 4cd5b33b640e..6d174b158915 100644
@@ -415,10 +415,6 @@
 #define MT_HW_EMI_CTL			0x18011100
 #define MT_HW_EMI_CTL_SLPPROT_EN	BIT(1)
 
-#define MT_PCIE_MAC_BASE		0x10000
-#define MT_PCIE_MAC(ofs)		(MT_PCIE_MAC_BASE + (ofs))
-#define MT_PCIE_MAC_INT_ENABLE		MT_PCIE_MAC(0x188)
-#define MT_PCIE_MAC_PM			MT_PCIE_MAC(0x194)
 #define MT_PCIE_MAC_PM_L0S_DIS		BIT(8)
 
 #define MT_DMA_SHDL(ofs)		(0x7c026000 + (ofs))
Signature · 1 line
2.45.2