10c1732c969a9bb9e04b8c59c0796adb35874c13
[openwrt/staging/xback.git] /
1 From: Lorenzo Bianconi <lorenzo@kernel.org>
2 Date: Thu, 24 Nov 2022 16:22:52 +0100
3 Subject: [PATCH] net: ethernet: mtk_wed: move MTK_WDMA_RESET_IDX_TX
4 configuration in mtk_wdma_tx_reset
5
6 Remove duplicated code. Increase poll timeout to 10ms in order to be
7 aligned with vendor sdk.
8 This is a preliminary patch to add Wireless Ethernet Dispatcher reset
9 support.
10
11 Co-developed-by: Sujuan Chen <sujuan.chen@mediatek.com>
12 Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
13 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
14 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
15 ---
16
17 --- a/drivers/net/ethernet/mediatek/mtk_wed.c
18 +++ b/drivers/net/ethernet/mediatek/mtk_wed.c
19 @@ -135,16 +135,15 @@ mtk_wdma_tx_reset(struct mtk_wed_device
20
21 wdma_clr(dev, MTK_WDMA_GLO_CFG, MTK_WDMA_GLO_CFG_TX_DMA_EN);
22 if (readx_poll_timeout(mtk_wdma_read_reset, dev, status,
23 - !(status & mask), 0, 1000))
24 + !(status & mask), 0, 10000))
25 dev_err(dev->hw->dev, "tx reset failed\n");
26
27 - for (i = 0; i < ARRAY_SIZE(dev->tx_wdma); i++) {
28 - if (dev->tx_wdma[i].desc)
29 - continue;
30 + wdma_w32(dev, MTK_WDMA_RESET_IDX, MTK_WDMA_RESET_IDX_TX);
31 + wdma_w32(dev, MTK_WDMA_RESET_IDX, 0);
32
33 + for (i = 0; i < ARRAY_SIZE(dev->tx_wdma); i++)
34 wdma_w32(dev,
35 MTK_WDMA_RING_TX(i) + MTK_WED_RING_OFS_CPU_IDX, 0);
36 - }
37 }
38
39 static void
40 @@ -573,12 +572,6 @@ mtk_wed_detach(struct mtk_wed_device *de
41
42 mtk_wdma_rx_reset(dev);
43 mtk_wed_reset(dev, MTK_WED_RESET_WED);
44 - if (mtk_wed_get_rx_capa(dev)) {
45 - wdma_clr(dev, MTK_WDMA_GLO_CFG, MTK_WDMA_GLO_CFG_TX_DMA_EN);
46 - wdma_w32(dev, MTK_WDMA_RESET_IDX, MTK_WDMA_RESET_IDX_TX);
47 - wdma_w32(dev, MTK_WDMA_RESET_IDX, 0);
48 - }
49 -
50 mtk_wed_free_tx_buffer(dev);
51 mtk_wed_free_tx_rings(dev);
52