117ccc090258ea534b1b1cbaab119256fdf3279b
[openwrt/staging/981213.git] /
1 From: Sujuan Chen <sujuan.chen@mediatek.com>
2 Date: Thu, 24 Nov 2022 11:18:14 +0800
3 Subject: [PATCH] net: ethernet: mtk_wed: add wcid overwritten support for wed
4 v1
5
6 All wed versions should enable the wcid overwritten feature,
7 since the wcid size is controlled by the wlan driver.
8
9 Tested-by: Sujuan Chen <sujuan.chen@mediatek.com>
10 Co-developed-by: Bo Jiao <bo.jiao@mediatek.com>
11 Signed-off-by: Bo Jiao <bo.jiao@mediatek.com>
12 Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
13 Signed-off-by: David S. Miller <davem@davemloft.net>
14 ---
15
16 --- a/drivers/net/ethernet/mediatek/mtk_wed.c
17 +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
18 @@ -526,9 +526,9 @@ mtk_wed_dma_disable(struct mtk_wed_devic
19 MTK_WED_WPDMA_RX_D_RX_DRV_EN);
20 wed_clr(dev, MTK_WED_WDMA_GLO_CFG,
21 MTK_WED_WDMA_GLO_CFG_TX_DDONE_CHK);
22 -
23 - mtk_wed_set_512_support(dev, false);
24 }
25 +
26 + mtk_wed_set_512_support(dev, false);
27 }
28
29 static void
30 @@ -1290,9 +1290,10 @@ mtk_wed_start(struct mtk_wed_device *dev
31 if (mtk_wed_rro_cfg(dev))
32 return;
33
34 - mtk_wed_set_512_support(dev, dev->wlan.wcid_512);
35 }
36
37 + mtk_wed_set_512_support(dev, dev->wlan.wcid_512);
38 +
39 mtk_wed_dma_enable(dev);
40 dev->running = true;
41 }
42 @@ -1358,11 +1359,13 @@ mtk_wed_attach(struct mtk_wed_device *de
43 }
44
45 mtk_wed_hw_init_early(dev);
46 - if (hw->version == 1)
47 + if (hw->version == 1) {
48 regmap_update_bits(hw->hifsys, HIFSYS_DMA_AG_MAP,
49 BIT(hw->index), 0);
50 - else
51 + } else {
52 + dev->rev_id = wed_r32(dev, MTK_WED_REV_ID);
53 ret = mtk_wed_wo_init(hw);
54 + }
55 out:
56 if (ret)
57 mtk_wed_detach(dev);
58 --- a/drivers/net/ethernet/mediatek/mtk_wed_regs.h
59 +++ b/drivers/net/ethernet/mediatek/mtk_wed_regs.h
60 @@ -20,6 +20,8 @@ struct mtk_wdma_desc {
61 __le32 info;
62 } __packed __aligned(4);
63
64 +#define MTK_WED_REV_ID 0x004
65 +
66 #define MTK_WED_RESET 0x008
67 #define MTK_WED_RESET_TX_BM BIT(0)
68 #define MTK_WED_RESET_TX_FREE_AGENT BIT(4)
69 --- a/include/linux/soc/mediatek/mtk_wed.h
70 +++ b/include/linux/soc/mediatek/mtk_wed.h
71 @@ -85,6 +85,9 @@ struct mtk_wed_device {
72 int irq;
73 u8 version;
74
75 + /* used by wlan driver */
76 + u32 rev_id;
77 +
78 struct mtk_wed_ring tx_ring[MTK_WED_TX_QUEUES];
79 struct mtk_wed_ring rx_ring[MTK_WED_RX_QUEUES];
80 struct mtk_wed_ring txfree_ring;