diff options
author | Felix Fietkau <nbd@nbd.name> | 2022-06-16 19:18:11 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2022-06-18 10:33:30 +0200 |
commit | 7676808434233aeeeecce6a560ccd7846805b107 (patch) | |
tree | b46276eecc460bce38d0d16f547a8c83edcba6b7 /target/linux/generic/backport-5.15/702-v5.19-20-net-ethernet-mtk_eth_soc-rely-on-txd_size-in-mtk_tx_.patch | |
parent | 0e0058a8709f2c465ec958bb4fb50551514ea8b2 (diff) | |
download | upstream-7676808434233aeeeecce6a560ccd7846805b107.tar.gz upstream-7676808434233aeeeecce6a560ccd7846805b107.tar.bz2 upstream-7676808434233aeeeecce6a560ccd7846805b107.zip |
kernel: backport upstream mtk_eth_soc patches
Includes MT7986 ethernet support
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'target/linux/generic/backport-5.15/702-v5.19-20-net-ethernet-mtk_eth_soc-rely-on-txd_size-in-mtk_tx_.patch')
-rw-r--r-- | target/linux/generic/backport-5.15/702-v5.19-20-net-ethernet-mtk_eth_soc-rely-on-txd_size-in-mtk_tx_.patch | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/target/linux/generic/backport-5.15/702-v5.19-20-net-ethernet-mtk_eth_soc-rely-on-txd_size-in-mtk_tx_.patch b/target/linux/generic/backport-5.15/702-v5.19-20-net-ethernet-mtk_eth_soc-rely-on-txd_size-in-mtk_tx_.patch new file mode 100644 index 0000000000..13f1300d55 --- /dev/null +++ b/target/linux/generic/backport-5.15/702-v5.19-20-net-ethernet-mtk_eth_soc-rely-on-txd_size-in-mtk_tx_.patch @@ -0,0 +1,78 @@ +From: Lorenzo Bianconi <lorenzo@kernel.org> +Date: Fri, 20 May 2022 20:11:29 +0200 +Subject: [PATCH] net: ethernet: mtk_eth_soc: rely on txd_size in + mtk_tx_alloc/mtk_tx_clean + +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 +@@ -1610,8 +1610,10 @@ static int mtk_napi_rx(struct napi_struc + + static int mtk_tx_alloc(struct mtk_eth *eth) + { ++ const struct mtk_soc_data *soc = eth->soc; + struct mtk_tx_ring *ring = ð->tx_ring; +- int i, sz = sizeof(*ring->dma); ++ int i, sz = soc->txrx.txd_size; ++ struct mtk_tx_dma *txd; + + ring->buf = kcalloc(MTK_DMA_SIZE, sizeof(*ring->buf), + GFP_KERNEL); +@@ -1627,8 +1629,10 @@ static int mtk_tx_alloc(struct mtk_eth * + int next = (i + 1) % MTK_DMA_SIZE; + u32 next_ptr = ring->phys + next * sz; + +- ring->dma[i].txd2 = next_ptr; +- ring->dma[i].txd3 = TX_DMA_LS0 | TX_DMA_OWNER_CPU; ++ txd = (void *)ring->dma + i * sz; ++ txd->txd2 = next_ptr; ++ txd->txd3 = TX_DMA_LS0 | TX_DMA_OWNER_CPU; ++ txd->txd4 = 0; + } + + /* On MT7688 (PDMA only) this driver uses the ring->dma structs +@@ -1650,7 +1654,7 @@ static int mtk_tx_alloc(struct mtk_eth * + ring->dma_size = MTK_DMA_SIZE; + atomic_set(&ring->free_count, MTK_DMA_SIZE - 2); + ring->next_free = &ring->dma[0]; +- ring->last_free = &ring->dma[MTK_DMA_SIZE - 1]; ++ ring->last_free = (void *)txd; + ring->last_free_ptr = (u32)(ring->phys + ((MTK_DMA_SIZE - 1) * sz)); + ring->thresh = MAX_SKB_FRAGS; + +@@ -1683,6 +1687,7 @@ no_tx_mem: + + static void mtk_tx_clean(struct mtk_eth *eth) + { ++ const struct mtk_soc_data *soc = eth->soc; + struct mtk_tx_ring *ring = ð->tx_ring; + int i; + +@@ -1695,17 +1700,15 @@ static void mtk_tx_clean(struct mtk_eth + + if (ring->dma) { + dma_free_coherent(eth->dma_dev, +- MTK_DMA_SIZE * sizeof(*ring->dma), +- ring->dma, +- ring->phys); ++ MTK_DMA_SIZE * soc->txrx.txd_size, ++ ring->dma, ring->phys); + ring->dma = NULL; + } + + if (ring->dma_pdma) { + dma_free_coherent(eth->dma_dev, +- MTK_DMA_SIZE * sizeof(*ring->dma_pdma), +- ring->dma_pdma, +- ring->phys_pdma); ++ MTK_DMA_SIZE * soc->txrx.txd_size, ++ ring->dma_pdma, ring->phys_pdma); + ring->dma_pdma = NULL; + } + } |