6a58334c328ece304d240b2489f3e181b88ddc3f
[openwrt/staging/xback.git] /
1 From 0dcbe607cec32ccae23b02a641b8bd6191a328ae Mon Sep 17 00:00:00 2001
2 Message-Id: <0dcbe607cec32ccae23b02a641b8bd6191a328ae.1662243796.git.lorenzo@kernel.org>
3 In-Reply-To: <43a21841ce0175d29f23c34a65ceaaf9dd7eb8b7.1662243796.git.lorenzo@kernel.org>
4 References: <43a21841ce0175d29f23c34a65ceaaf9dd7eb8b7.1662243796.git.lorenzo@kernel.org>
5 From: Lorenzo Bianconi <lorenzo@kernel.org>
6 Date: Tue, 23 Aug 2022 23:09:05 +0200
7 Subject: [PATCH net-next 2/4] net: ethernet: mtk_eth_soc: move wdma_base
8 definitions in mtk register map
9
10 This is a preliminary patch to introduce mt7986 wed support.
11
12 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
13 ---
14 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 16 ++++++++++------
15 drivers/net/ethernet/mediatek/mtk_eth_soc.h | 4 +---
16 2 files changed, 11 insertions(+), 9 deletions(-)
17
18 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
19 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
20 @@ -75,6 +75,10 @@ static const struct mtk_reg_map mtk_reg_
21 .gdm1_cnt = 0x2400,
22 .gdma_to_ppe0 = 0x4444,
23 .ppe_base = 0x0c00,
24 + .wdma_base = {
25 + [0] = 0x2800,
26 + [1] = 0x2c00,
27 + },
28 };
29
30 static const struct mtk_reg_map mt7628_reg_map = {
31 @@ -130,6 +134,10 @@ static const struct mtk_reg_map mt7986_r
32 .gdm1_cnt = 0x1c00,
33 .gdma_to_ppe0 = 0x3333,
34 .ppe_base = 0x2000,
35 + .wdma_base = {
36 + [0] = 0x4800,
37 + [1] = 0x4c00,
38 + },
39 };
40
41 /* strings used by ethtool */
42 @@ -3965,16 +3973,12 @@ static int mtk_probe(struct platform_dev
43 for (i = 0;; i++) {
44 struct device_node *np = of_parse_phandle(pdev->dev.of_node,
45 "mediatek,wed", i);
46 - static const u32 wdma_regs[] = {
47 - MTK_WDMA0_BASE,
48 - MTK_WDMA1_BASE
49 - };
50 void __iomem *wdma;
51
52 - if (!np || i >= ARRAY_SIZE(wdma_regs))
53 + if (!np || i >= ARRAY_SIZE(eth->soc->reg_map->wdma_base))
54 break;
55
56 - wdma = eth->base + wdma_regs[i];
57 + wdma = eth->base + eth->soc->reg_map->wdma_base[i];
58 mtk_wed_add_hw(np, eth, wdma, i);
59 }
60
61 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
62 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
63 @@ -268,9 +268,6 @@
64 #define TX_DMA_FPORT_MASK_V2 0xf
65 #define TX_DMA_SWC_V2 BIT(30)
66
67 -#define MTK_WDMA0_BASE 0x2800
68 -#define MTK_WDMA1_BASE 0x2c00
69 -
70 /* QDMA descriptor txd4 */
71 #define TX_DMA_CHKSUM (0x7 << 29)
72 #define TX_DMA_TSO BIT(28)
73 @@ -954,6 +951,7 @@ struct mtk_reg_map {
74 u32 gdm1_cnt;
75 u32 gdma_to_ppe0;
76 u32 ppe_base;
77 + u32 wdma_base[2];
78 };
79
80 /* struct mtk_eth_data - This is the structure holding all differences