blob: cb745f15dbd577e23e16ee91828054f5915add34 [file] [log] [blame]
developer9237f442024-06-14 17:13:04 +08001From 2342f41c5f878f7d419d20a46daa3b025c024b08 Mon Sep 17 00:00:00 2001
developer66e89bc2024-04-23 14:50:01 +08002From: "sujuan.chen" <sujuan.chen@mediatek.com>
3Date: Wed, 13 Sep 2023 17:35:43 +0800
developer9237f442024-06-14 17:13:04 +08004Subject: [PATCH 071/116] mtk: wifi: mt76: mt7992: wed: add 2pcie one wed
developer66e89bc2024-04-23 14:50:01 +08005 support
6
7Signed-off-by: sujuan.chen <sujuan.chen@mediatek.com>
8---
9 mt7996/dma.c | 13 +++++++++++--
10 mt7996/mmio.c | 7 +++----
11 mt7996/mtk_debug.h | 5 +++++
12 mt7996/mtk_debugfs.c | 25 ++++++++++++++++++-------
13 mt7996/regs.h | 2 ++
14 5 files changed, 39 insertions(+), 13 deletions(-)
15
16diff --git a/mt7996/dma.c b/mt7996/dma.c
developer9237f442024-06-14 17:13:04 +080017index d62dc8b..c23b0d6 100644
developer66e89bc2024-04-23 14:50:01 +080018--- a/mt7996/dma.c
19+++ b/mt7996/dma.c
20@@ -355,6 +355,13 @@ static void mt7996_dma_enable(struct mt7996_dev *dev, bool reset)
21 MT_WFDMA_HOST_CONFIG_PDMA_BAND |
22 MT_WFDMA_HOST_CONFIG_BAND2_PCIE1);
23
24+ if (mtk_wed_device_active(&dev->mt76.mmio.wed) &&
25+ is_mt7992(&dev->mt76)) {
26+ mt76_set(dev, MT_WFDMA_HOST_CONFIG,
27+ MT_WFDMA_HOST_CONFIG_PDMA_BAND |
28+ MT_WFDMA_HOST_CONFIG_BAND1_PCIE1);
29+ }
30+
31 /* AXI read outstanding number */
32 mt76_rmw(dev, MT_WFDMA_AXI_R2A_CTRL,
33 MT_WFDMA_AXI_R2A_CTRL_OUTSTAND_MASK, 0x14);
34@@ -374,7 +381,8 @@ static void mt7996_dma_enable(struct mt7996_dev *dev, bool reset)
35 dev->has_rro) {
36 u32 intr = is_mt7996(&dev->mt76) ?
37 MT_WFDMA0_RX_INT_SEL_RING6 :
38- MT_WFDMA0_RX_INT_SEL_RING9;
39+ MT_WFDMA0_RX_INT_SEL_RING9 |
40+ MT_WFDMA0_RX_INT_SEL_RING5;
41 mt76_set(dev, MT_WFDMA0_RX_INT_PCIE_SEL + hif1_ofs,
42 intr);
43 } else {
44@@ -630,10 +638,11 @@ int mt7996_dma_init(struct mt7996_dev *dev)
45 MT_RXQ_ID(MT_RXQ_RRO_BAND1),
46 MT7996_RX_RING_SIZE,
47 MT7996_RX_BUF_SIZE,
48- MT_RXQ_RING_BASE(MT_RXQ_RRO_BAND1));
49+ MT_RXQ_RING_BASE(MT_RXQ_RRO_BAND1) + hif1_ofs);
50 if (ret)
51 return ret;
52 } else {
53+ /* tx free notify event from WA for band0 */
54 dev->mt76.q_rx[MT_RXQ_TXFREE_BAND0].flags = MT_WED_Q_TXFREE;
55 dev->mt76.q_rx[MT_RXQ_TXFREE_BAND0].wed = wed;
56
57diff --git a/mt7996/mmio.c b/mt7996/mmio.c
developer9237f442024-06-14 17:13:04 +080058index 3f0692c..91567a0 100644
developer66e89bc2024-04-23 14:50:01 +080059--- a/mt7996/mmio.c
60+++ b/mt7996/mmio.c
61@@ -375,10 +375,10 @@ int mt7996_mmio_wed_init(struct mt7996_dev *dev, void *pdev_ptr,
62 MT_RXQ_RING_BASE(MT7996_RXQ_RRO_BAND2) +
63 MT7996_RXQ_RRO_BAND2 * MT_RING_SIZE;
64 } else {
65- wed->wlan.wpdma_rx_rro[1] = wed->wlan.phy_base +
66+ wed->wlan.wpdma_rx_rro[1] = wed->wlan.phy_base + hif1_ofs +
67 MT_RXQ_RING_BASE(MT7996_RXQ_RRO_BAND1) +
68 MT7996_RXQ_RRO_BAND1 * MT_RING_SIZE;
69- wed->wlan.wpdma_rx[1] = wed->wlan.phy_base +
70+ wed->wlan.wpdma_rx[1] = wed->wlan.phy_base + hif1_ofs +
71 MT_RXQ_RING_BASE(MT7996_RXQ_BAND1) +
72 MT7996_RXQ_BAND1 * MT_RING_SIZE;
73 }
74@@ -516,10 +516,9 @@ void mt7996_dual_hif_set_irq_mask(struct mt7996_dev *dev, bool write_reg,
75 if (mtk_wed_device_active(&mdev->mmio.wed)) {
76 mtk_wed_device_irq_set_mask(&mdev->mmio.wed,
77 mdev->mmio.irqmask);
78- if (mtk_wed_device_active(&mdev->mmio.wed_hif2)) {
79+ if (mtk_wed_device_active(&mdev->mmio.wed_hif2))
80 mtk_wed_device_irq_set_mask(&mdev->mmio.wed_hif2,
81 mdev->mmio.irqmask);
82- }
83 } else {
84 mt76_wr(dev, MT_INT_MASK_CSR, mdev->mmio.irqmask);
85 mt76_wr(dev, MT_INT1_MASK_CSR, mdev->mmio.irqmask);
86diff --git a/mt7996/mtk_debug.h b/mt7996/mtk_debug.h
developer9237f442024-06-14 17:13:04 +080087index 27d8f1c..da2a607 100644
developer66e89bc2024-04-23 14:50:01 +080088--- a/mt7996/mtk_debug.h
89+++ b/mt7996/mtk_debug.h
90@@ -561,6 +561,11 @@ struct queue_desc {
91 #define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING7_CTRL1_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x574) // 8574
92 #define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING7_CTRL2_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x578) // 8578
93 #define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING7_CTRL3_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x57c) // 857C
94+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING9_CTRL0_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x590) // 8590
95+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING9_CTRL1_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x594) // 8594
96+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING9_CTRL2_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x598) // 8598
97+#define WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING9_CTRL3_ADDR (WF_WFDMA_HOST_DMA0_PCIE1_BASE + 0x59c) // 859C
98+
99 //MCU DMA
100 //#define WF_WFDMA_MCU_DMA0_BASE 0x02000
101 #define WF_WFDMA_MCU_DMA0_BASE 0x54000000
102diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
developer9237f442024-06-14 17:13:04 +0800103index ff84d6f..70ff761 100644
developer66e89bc2024-04-23 14:50:01 +0800104--- a/mt7996/mtk_debugfs.c
105+++ b/mt7996/mtk_debugfs.c
106@@ -559,14 +559,22 @@ mt7996_show_dma_info(struct seq_file *s, struct mt7996_dev *dev)
107 WF_WFDMA_HOST_DMA0_WPDMA_RX_RING4_CTRL0_ADDR);
108 dump_dma_rx_ring_info(s, dev, "R5:Data1(MAC2H)", "Both",
109 WF_WFDMA_HOST_DMA0_WPDMA_RX_RING5_CTRL0_ADDR);
110- dump_dma_rx_ring_info(s, dev, "R6:BUF1(MAC2H)", "Both",
111- WF_WFDMA_HOST_DMA0_WPDMA_RX_RING6_CTRL0_ADDR);
112+ if (is_mt7996(&dev->mt76))
113+ dump_dma_rx_ring_info(s, dev, "R6:BUF1(MAC2H)", "Both",
114+ WF_WFDMA_HOST_DMA0_WPDMA_RX_RING6_CTRL0_ADDR);
115+ else
116+ dump_dma_rx_ring_info(s, dev, "R6:TxDone0(MAC2H)", "Both",
117+ WF_WFDMA_HOST_DMA0_WPDMA_RX_RING6_CTRL0_ADDR);
118 dump_dma_rx_ring_info(s, dev, "R7:TxDone1(MAC2H)", "Both",
119 WF_WFDMA_HOST_DMA0_WPDMA_RX_RING7_CTRL0_ADDR);
120 dump_dma_rx_ring_info(s, dev, "R8:BUF0(MAC2H)", "Both",
121 WF_WFDMA_HOST_DMA0_WPDMA_RX_RING8_CTRL0_ADDR);
122- dump_dma_rx_ring_info(s, dev, "R9:TxDone0(MAC2H)", "Both",
123- WF_WFDMA_HOST_DMA0_WPDMA_RX_RING9_CTRL0_ADDR);
124+ if (is_mt7996(&dev->mt76))
125+ dump_dma_rx_ring_info(s, dev, "R9:TxDone0(MAC2H)", "Both",
126+ WF_WFDMA_HOST_DMA0_WPDMA_RX_RING9_CTRL0_ADDR);
127+ else
128+ dump_dma_rx_ring_info(s, dev, "R9:BUF0(MAC2H)", "Both",
129+ WF_WFDMA_HOST_DMA0_WPDMA_RX_RING9_CTRL0_ADDR);
130 dump_dma_rx_ring_info(s, dev, "R10:MSDU_PG0(MAC2H)", "Both",
131 WF_WFDMA_HOST_DMA0_WPDMA_RX_RING10_CTRL0_ADDR);
132 dump_dma_rx_ring_info(s, dev, "R11:MSDU_PG1(MAC2H)", "Both",
133@@ -584,15 +592,18 @@ mt7996_show_dma_info(struct seq_file *s, struct mt7996_dev *dev)
134 WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_TX_RING21_CTRL0_ADDR);
135 dump_dma_tx_ring_info(s, dev, "T22:TXD?(H2WA)", "AP",
136 WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_TX_RING22_CTRL0_ADDR);
137-
138 dump_dma_rx_ring_info(s, dev, "R3:TxDone1(WA2H)", "AP",
139 WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING3_CTRL0_ADDR);
140 dump_dma_rx_ring_info(s, dev, "R5:Data1(MAC2H)", "Both",
141 WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING5_CTRL0_ADDR);
142- dump_dma_rx_ring_info(s, dev, "R6:BUF1(MAC2H)", "Both",
143- WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING6_CTRL0_ADDR);
144+ if (is_mt7996(&dev->mt76))
145+ dump_dma_rx_ring_info(s, dev, "R6:BUF1(MAC2H)", "Both",
146+ WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING6_CTRL0_ADDR);
147 dump_dma_rx_ring_info(s, dev, "R7:TxDone1(MAC2H)", "Both",
148 WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING7_CTRL0_ADDR);
149+ if (is_mt7992(&dev->mt76))
150+ dump_dma_rx_ring_info(s, dev, "R9:BUF1(MAC2H)", "Both",
151+ WF_WFDMA_HOST_DMA0_PCIE1_WPDMA_RX_RING9_CTRL0_ADDR);
152 }
153
154 /* MCU DMA information */
155diff --git a/mt7996/regs.h b/mt7996/regs.h
developer9237f442024-06-14 17:13:04 +0800156index e6427a3..cbd7170 100644
developer66e89bc2024-04-23 14:50:01 +0800157--- a/mt7996/regs.h
158+++ b/mt7996/regs.h
159@@ -411,6 +411,7 @@ enum offs_rev {
160
161 #define MT_WFDMA0_RX_INT_PCIE_SEL MT_WFDMA0(0x154)
162 #define MT_WFDMA0_RX_INT_SEL_RING3 BIT(3)
163+#define MT_WFDMA0_RX_INT_SEL_RING5 BIT(5)
164 #define MT_WFDMA0_RX_INT_SEL_RING6 BIT(6)
165 #define MT_WFDMA0_RX_INT_SEL_RING9 BIT(9)
166
167@@ -451,6 +452,7 @@ enum offs_rev {
168
169 #define MT_WFDMA_HOST_CONFIG MT_WFDMA_EXT_CSR(0x30)
170 #define MT_WFDMA_HOST_CONFIG_PDMA_BAND BIT(0)
171+#define MT_WFDMA_HOST_CONFIG_BAND1_PCIE1 BIT(21)
172 #define MT_WFDMA_HOST_CONFIG_BAND2_PCIE1 BIT(22)
173
174 #define MT_WFDMA_EXT_CSR_HIF_MISC MT_WFDMA_EXT_CSR(0x44)
175--
developer9237f442024-06-14 17:13:04 +08001762.18.0
developer66e89bc2024-04-23 14:50:01 +0800177