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