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
6 All wed versions should enable the wcid overwritten feature,
7 since the wcid size is controlled by the wlan driver.
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>
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);
23 - mtk_wed_set_512_support(dev, false);
26 + mtk_wed_set_512_support(dev, false);
30 @@ -1290,9 +1290,10 @@ mtk_wed_start(struct mtk_wed_device *dev
31 if (mtk_wed_rro_cfg(dev))
34 - mtk_wed_set_512_support(dev, dev->wlan.wcid_512);
37 + mtk_wed_set_512_support(dev, dev->wlan.wcid_512);
39 mtk_wed_dma_enable(dev);
42 @@ -1358,11 +1359,13 @@ mtk_wed_attach(struct mtk_wed_device *de
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,
52 + dev->rev_id = wed_r32(dev, MTK_WED_REV_ID);
53 ret = mtk_wed_wo_init(hw);
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 {
62 } __packed __aligned(4);
64 +#define MTK_WED_REV_ID 0x004
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 {
75 + /* used by wlan driver */
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;