1 From: Lorenzo Bianconi <lorenzo@kernel.org>
2 Date: Fri, 20 May 2022 20:11:32 +0200
3 Subject: [PATCH] net: ethernet: mtk_eth_soc: add rxd_size to mtk_soc_data
5 Similar to tx counterpart, introduce rxd_size in mtk_soc_data data
7 This is a preliminary patch to add mt7986 ethernet support.
9 Tested-by: Sam Shih <sam.shih@mediatek.com>
10 Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
11 Signed-off-by: David S. Miller <davem@davemloft.net>
14 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
15 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
16 @@ -1786,7 +1786,7 @@ static int mtk_rx_alloc(struct mtk_eth *
19 ring->dma = dma_alloc_coherent(eth->dma_dev,
20 - rx_dma_size * sizeof(*ring->dma),
21 + rx_dma_size * eth->soc->txrx.rxd_size,
22 &ring->phys, GFP_KERNEL);
25 @@ -1844,9 +1844,8 @@ static void mtk_rx_clean(struct mtk_eth
28 dma_free_coherent(eth->dma_dev,
29 - ring->dma_size * sizeof(*ring->dma),
32 + ring->dma_size * eth->soc->txrx.rxd_size,
33 + ring->dma, ring->phys);
37 @@ -3412,6 +3411,7 @@ static const struct mtk_soc_data mt2701_
38 .required_pctl = true,
40 .txd_size = sizeof(struct mtk_tx_dma),
41 + .rxd_size = sizeof(struct mtk_rx_dma),
45 @@ -3423,6 +3423,7 @@ static const struct mtk_soc_data mt7621_
48 .txd_size = sizeof(struct mtk_tx_dma),
49 + .rxd_size = sizeof(struct mtk_rx_dma),
53 @@ -3435,6 +3436,7 @@ static const struct mtk_soc_data mt7622_
56 .txd_size = sizeof(struct mtk_tx_dma),
57 + .rxd_size = sizeof(struct mtk_rx_dma),
61 @@ -3446,6 +3448,7 @@ static const struct mtk_soc_data mt7623_
64 .txd_size = sizeof(struct mtk_tx_dma),
65 + .rxd_size = sizeof(struct mtk_rx_dma),
69 @@ -3457,6 +3460,7 @@ static const struct mtk_soc_data mt7629_
70 .required_pctl = false,
72 .txd_size = sizeof(struct mtk_tx_dma),
73 + .rxd_size = sizeof(struct mtk_rx_dma),
77 @@ -3467,6 +3471,7 @@ static const struct mtk_soc_data rt5350_
78 .required_pctl = false,
80 .txd_size = sizeof(struct mtk_tx_dma),
81 + .rxd_size = sizeof(struct mtk_rx_dma),
85 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
86 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
87 @@ -865,6 +865,7 @@ struct mtk_tx_dma_desc_info {
88 * @required_pctl A bool value to show whether the SoC requires
89 * the extra setup for those pins used by GMAC.
90 * @txd_size Tx DMA descriptor size.
91 + * @rxd_size Rx DMA descriptor size.
95 @@ -875,6 +876,7 @@ struct mtk_soc_data {
96 netdev_features_t hw_features;