kernel: bump 5.15 to 5.15.47
[openwrt/openwrt.git] / target / linux / generic / backport-5.15 / 702-v5.19-23-net-ethernet-mtk_eth_soc-add-rxd_size-to-mtk_soc_dat.patch
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
4
5 Similar to tx counterpart, introduce rxd_size in mtk_soc_data data
6 structure.
7 This is a preliminary patch to add mt7986 ethernet support.
8
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>
12 ---
13
14 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
15 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
16 @@ -1758,7 +1758,7 @@ static int mtk_rx_alloc(struct mtk_eth *
17 }
18
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);
23 if (!ring->dma)
24 return -ENOMEM;
25 @@ -1816,9 +1816,8 @@ static void mtk_rx_clean(struct mtk_eth
26
27 if (ring->dma) {
28 dma_free_coherent(eth->dma_dev,
29 - ring->dma_size * sizeof(*ring->dma),
30 - ring->dma,
31 - ring->phys);
32 + ring->dma_size * eth->soc->txrx.rxd_size,
33 + ring->dma, ring->phys);
34 ring->dma = NULL;
35 }
36 }
37 @@ -3386,6 +3385,7 @@ static const struct mtk_soc_data mt2701_
38 .required_pctl = true,
39 .txrx = {
40 .txd_size = sizeof(struct mtk_tx_dma),
41 + .rxd_size = sizeof(struct mtk_rx_dma),
42 },
43 };
44
45 @@ -3397,6 +3397,7 @@ static const struct mtk_soc_data mt7621_
46 .offload_version = 2,
47 .txrx = {
48 .txd_size = sizeof(struct mtk_tx_dma),
49 + .rxd_size = sizeof(struct mtk_rx_dma),
50 },
51 };
52
53 @@ -3409,6 +3410,7 @@ static const struct mtk_soc_data mt7622_
54 .offload_version = 2,
55 .txrx = {
56 .txd_size = sizeof(struct mtk_tx_dma),
57 + .rxd_size = sizeof(struct mtk_rx_dma),
58 },
59 };
60
61 @@ -3420,6 +3422,7 @@ static const struct mtk_soc_data mt7623_
62 .offload_version = 2,
63 .txrx = {
64 .txd_size = sizeof(struct mtk_tx_dma),
65 + .rxd_size = sizeof(struct mtk_rx_dma),
66 },
67 };
68
69 @@ -3431,6 +3434,7 @@ static const struct mtk_soc_data mt7629_
70 .required_pctl = false,
71 .txrx = {
72 .txd_size = sizeof(struct mtk_tx_dma),
73 + .rxd_size = sizeof(struct mtk_rx_dma),
74 },
75 };
76
77 @@ -3441,6 +3445,7 @@ static const struct mtk_soc_data rt5350_
78 .required_pctl = false,
79 .txrx = {
80 .txd_size = sizeof(struct mtk_tx_dma),
81 + .rxd_size = sizeof(struct mtk_rx_dma),
82 },
83 };
84
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.
92 */
93 struct mtk_soc_data {
94 u32 ana_rgc3;
95 @@ -874,6 +875,7 @@ struct mtk_soc_data {
96 netdev_features_t hw_features;
97 struct {
98 u32 txd_size;
99 + u32 rxd_size;
100 } txrx;
101 };
102