Skip to content

Commit

Permalink
net: ethernet: mtk_eth_soc: add rxd_size to mtk_soc_data
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lorenzo Bianconi authored and David S. Miller committed May 22, 2022
1 parent e70a563 commit 670ff7d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 9 additions & 4 deletions drivers/net/ethernet/mediatek/mtk_eth_soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
rx_dma_size * sizeof(*ring->dma),
rx_dma_size * eth->soc->txrx.rxd_size,
&ring->phys, GFP_KERNEL);
if (!ring->dma)
return -ENOMEM;
Expand Down Expand Up @@ -1798,9 +1798,8 @@ static void mtk_rx_clean(struct mtk_eth *eth, struct mtk_rx_ring *ring)

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;
}
}
Expand Down Expand Up @@ -3388,6 +3387,7 @@ static const struct mtk_soc_data mt2701_data = {
.required_pctl = true,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma),
},
};

Expand All @@ -3399,6 +3399,7 @@ static const struct mtk_soc_data mt7621_data = {
.offload_version = 2,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma),
},
};

Expand All @@ -3411,6 +3412,7 @@ static const struct mtk_soc_data mt7622_data = {
.offload_version = 2,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma),
},
};

Expand All @@ -3422,6 +3424,7 @@ static const struct mtk_soc_data mt7623_data = {
.offload_version = 2,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma),
},
};

Expand All @@ -3433,6 +3436,7 @@ static const struct mtk_soc_data mt7629_data = {
.required_pctl = false,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma),
},
};

Expand All @@ -3443,6 +3447,7 @@ static const struct mtk_soc_data rt5350_data = {
.required_pctl = false,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
.rxd_size = sizeof(struct mtk_rx_dma),
},
};

Expand Down
2 changes: 2 additions & 0 deletions drivers/net/ethernet/mediatek/mtk_eth_soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,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;
Expand All @@ -878,6 +879,7 @@ struct mtk_soc_data {
netdev_features_t hw_features;
struct {
u32 txd_size;
u32 rxd_size;
} txrx;
};

Expand Down

0 comments on commit 670ff7d

Please sign in to comment.