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
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
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>
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
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");
27 - for (i = 0; i < ARRAY_SIZE(dev->tx_wdma); i++) {
28 - if (dev->tx_wdma[i].desc)
30 + wdma_w32(dev, MTK_WDMA_RESET_IDX, MTK_WDMA_RESET_IDX_TX);
31 + wdma_w32(dev, MTK_WDMA_RESET_IDX, 0);
33 + for (i = 0; i < ARRAY_SIZE(dev->tx_wdma); i++)
35 MTK_WDMA_RING_TX(i) + MTK_WED_RING_OFS_CPU_IDX, 0);
40 @@ -573,12 +572,6 @@ mtk_wed_detach(struct mtk_wed_device *de
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);
50 mtk_wed_free_tx_buffer(dev);
51 mtk_wed_free_tx_rings(dev);