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 @@ -1775,7 +1775,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 @@ -1833,9 +1833,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 @@ -3403,6 +3402,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 @@ -3414,6 +3414,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 @@ -3426,6 +3427,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 @@ -3437,6 +3439,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 @@ -3448,6 +3451,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 @@ -3458,6 +3462,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 @@ -864,6 +864,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 @@ -874,6 +875,7 @@ struct mtk_soc_data {
96 netdev_features_t hw_features;