103 lines
2.8 KiB
Diff
103 lines
2.8 KiB
Diff
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Date: Fri, 20 May 2022 20:11:32 +0200
|
|
Subject: [PATCH] net: ethernet: mtk_eth_soc: add rxd_size to mtk_soc_data
|
|
|
|
Similar to tx counterpart, introduce rxd_size in mtk_soc_data data
|
|
structure.
|
|
This is a preliminary patch to add mt7986 ethernet support.
|
|
|
|
Tested-by: Sam Shih <sam.shih@mediatek.com>
|
|
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
---
|
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
|
|
@@ -1776,7 +1776,7 @@ static int mtk_rx_alloc(struct mtk_eth *
|
|
}
|
|
|
|
ring->dma = dma_alloc_coherent(eth->dma_dev,
|
|
- rx_dma_size * sizeof(*ring->dma),
|
|
+ rx_dma_size * eth->soc->txrx.rxd_size,
|
|
&ring->phys, GFP_KERNEL);
|
|
if (!ring->dma)
|
|
return -ENOMEM;
|
|
@@ -1834,9 +1834,8 @@ static void mtk_rx_clean(struct mtk_eth
|
|
|
|
if (ring->dma) {
|
|
dma_free_coherent(eth->dma_dev,
|
|
- ring->dma_size * sizeof(*ring->dma),
|
|
- ring->dma,
|
|
- ring->phys);
|
|
+ ring->dma_size * eth->soc->txrx.rxd_size,
|
|
+ ring->dma, ring->phys);
|
|
ring->dma = NULL;
|
|
}
|
|
}
|
|
@@ -3399,6 +3398,7 @@ static const struct mtk_soc_data mt2701_
|
|
.required_pctl = true,
|
|
.txrx = {
|
|
.txd_size = sizeof(struct mtk_tx_dma),
|
|
+ .rxd_size = sizeof(struct mtk_rx_dma),
|
|
},
|
|
};
|
|
|
|
@@ -3410,6 +3410,7 @@ static const struct mtk_soc_data mt7621_
|
|
.offload_version = 2,
|
|
.txrx = {
|
|
.txd_size = sizeof(struct mtk_tx_dma),
|
|
+ .rxd_size = sizeof(struct mtk_rx_dma),
|
|
},
|
|
};
|
|
|
|
@@ -3422,6 +3423,7 @@ static const struct mtk_soc_data mt7622_
|
|
.offload_version = 2,
|
|
.txrx = {
|
|
.txd_size = sizeof(struct mtk_tx_dma),
|
|
+ .rxd_size = sizeof(struct mtk_rx_dma),
|
|
},
|
|
};
|
|
|
|
@@ -3433,6 +3435,7 @@ static const struct mtk_soc_data mt7623_
|
|
.offload_version = 2,
|
|
.txrx = {
|
|
.txd_size = sizeof(struct mtk_tx_dma),
|
|
+ .rxd_size = sizeof(struct mtk_rx_dma),
|
|
},
|
|
};
|
|
|
|
@@ -3444,6 +3447,7 @@ static const struct mtk_soc_data mt7629_
|
|
.required_pctl = false,
|
|
.txrx = {
|
|
.txd_size = sizeof(struct mtk_tx_dma),
|
|
+ .rxd_size = sizeof(struct mtk_rx_dma),
|
|
},
|
|
};
|
|
|
|
@@ -3454,6 +3458,7 @@ static const struct mtk_soc_data rt5350_
|
|
.required_pctl = false,
|
|
.txrx = {
|
|
.txd_size = sizeof(struct mtk_tx_dma),
|
|
+ .rxd_size = sizeof(struct mtk_rx_dma),
|
|
},
|
|
};
|
|
|
|
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
|
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
|
|
@@ -865,6 +865,7 @@ struct mtk_tx_dma_desc_info {
|
|
* @required_pctl A bool value to show whether the SoC requires
|
|
* the extra setup for those pins used by GMAC.
|
|
* @txd_size Tx DMA descriptor size.
|
|
+ * @rxd_size Rx DMA descriptor size.
|
|
*/
|
|
struct mtk_soc_data {
|
|
u32 ana_rgc3;
|
|
@@ -875,6 +876,7 @@ struct mtk_soc_data {
|
|
netdev_features_t hw_features;
|
|
struct {
|
|
u32 txd_size;
|
|
+ u32 rxd_size;
|
|
} txrx;
|
|
};
|
|
|