Commit 670ff7da authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by David S. Miller

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: default avatarSam Shih <sam.shih@mediatek.com>
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e70a5634
...@@ -1740,7 +1740,7 @@ static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag) ...@@ -1740,7 +1740,7 @@ static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag)
} }
ring->dma = dma_alloc_coherent(eth->dma_dev, 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); &ring->phys, GFP_KERNEL);
if (!ring->dma) if (!ring->dma)
return -ENOMEM; return -ENOMEM;
...@@ -1798,9 +1798,8 @@ static void mtk_rx_clean(struct mtk_eth *eth, struct mtk_rx_ring *ring) ...@@ -1798,9 +1798,8 @@ static void mtk_rx_clean(struct mtk_eth *eth, struct mtk_rx_ring *ring)
if (ring->dma) { if (ring->dma) {
dma_free_coherent(eth->dma_dev, dma_free_coherent(eth->dma_dev,
ring->dma_size * sizeof(*ring->dma), ring->dma_size * eth->soc->txrx.rxd_size,
ring->dma, ring->dma, ring->phys);
ring->phys);
ring->dma = NULL; ring->dma = NULL;
} }
} }
...@@ -3388,6 +3387,7 @@ static const struct mtk_soc_data mt2701_data = { ...@@ -3388,6 +3387,7 @@ static const struct mtk_soc_data mt2701_data = {
.required_pctl = true, .required_pctl = true,
.txrx = { .txrx = {
.txd_size = sizeof(struct mtk_tx_dma), .txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma),
}, },
}; };
...@@ -3399,6 +3399,7 @@ static const struct mtk_soc_data mt7621_data = { ...@@ -3399,6 +3399,7 @@ static const struct mtk_soc_data mt7621_data = {
.offload_version = 2, .offload_version = 2,
.txrx = { .txrx = {
.txd_size = sizeof(struct mtk_tx_dma), .txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma),
}, },
}; };
...@@ -3411,6 +3412,7 @@ static const struct mtk_soc_data mt7622_data = { ...@@ -3411,6 +3412,7 @@ static const struct mtk_soc_data mt7622_data = {
.offload_version = 2, .offload_version = 2,
.txrx = { .txrx = {
.txd_size = sizeof(struct mtk_tx_dma), .txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma),
}, },
}; };
...@@ -3422,6 +3424,7 @@ static const struct mtk_soc_data mt7623_data = { ...@@ -3422,6 +3424,7 @@ static const struct mtk_soc_data mt7623_data = {
.offload_version = 2, .offload_version = 2,
.txrx = { .txrx = {
.txd_size = sizeof(struct mtk_tx_dma), .txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma),
}, },
}; };
...@@ -3433,6 +3436,7 @@ static const struct mtk_soc_data mt7629_data = { ...@@ -3433,6 +3436,7 @@ static const struct mtk_soc_data mt7629_data = {
.required_pctl = false, .required_pctl = false,
.txrx = { .txrx = {
.txd_size = sizeof(struct mtk_tx_dma), .txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma),
}, },
}; };
...@@ -3443,6 +3447,7 @@ static const struct mtk_soc_data rt5350_data = { ...@@ -3443,6 +3447,7 @@ static const struct mtk_soc_data rt5350_data = {
.required_pctl = false, .required_pctl = false,
.txrx = { .txrx = {
.txd_size = sizeof(struct mtk_tx_dma), .txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma),
}, },
}; };
......
...@@ -868,6 +868,7 @@ struct mtk_tx_dma_desc_info { ...@@ -868,6 +868,7 @@ struct mtk_tx_dma_desc_info {
* @required_pctl A bool value to show whether the SoC requires * @required_pctl A bool value to show whether the SoC requires
* the extra setup for those pins used by GMAC. * the extra setup for those pins used by GMAC.
* @txd_size Tx DMA descriptor size. * @txd_size Tx DMA descriptor size.
* @rxd_size Rx DMA descriptor size.
*/ */
struct mtk_soc_data { struct mtk_soc_data {
u32 ana_rgc3; u32 ana_rgc3;
...@@ -878,6 +879,7 @@ struct mtk_soc_data { ...@@ -878,6 +879,7 @@ struct mtk_soc_data {
netdev_features_t hw_features; netdev_features_t hw_features;
struct { struct {
u32 txd_size; u32 txd_size;
u32 rxd_size;
} txrx; } txrx;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment