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 @@ -1776,7 +1776,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 @@ -1834,9 +1834,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 @@ -3406,6 +3405,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 @@ -3417,6 +3417,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 @@ -3429,6 +3430,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 @@ -3440,6 +3442,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 @@ -3451,6 +3454,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 @@ -3461,6 +3465,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;