738-net-ethernet-mtk_eth_soc-set-coherent-mask-to-get-PP.patch 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. From dee3f591103910c8d8b2a6d57879ccd2a4be4b10 Mon Sep 17 00:00:00 2001
  2. Message-ID: <dee3f591103910c8d8b2a6d57879ccd2a4be4b10.1706067287.git.daniel@makrotopia.org>
  3. From: Daniel Golle <[email protected]>
  4. Date: Wed, 24 Jan 2024 03:19:49 +0000
  5. Subject: [PATCH net] net: ethernet: mtk_eth_soc: set coherent mask to get PPE
  6. working
  7. To: Felix Fietkau <[email protected]>,
  8. Sean Wang <[email protected]>,
  9. Mark Lee <[email protected]>,
  10. Lorenzo Bianconi <[email protected]>,
  11. David S. Miller <[email protected]>,
  12. Eric Dumazet <[email protected]>,
  13. Jakub Kicinski <[email protected]>,
  14. Paolo Abeni <[email protected]>,
  15. Matthias Brugger <[email protected]>,
  16. AngeloGioacchino Del Regno <[email protected]>,
  17. Daniel Golle <[email protected]>,
  18. [email protected],
  19. [email protected],
  20. [email protected],
  21. [email protected]
  22. Set DMA coherent mask to 32-bit which makes PPE offloading engine start
  23. working on BPi-R4 which got 4 GiB of RAM.
  24. Fixes: 2d75891ebc09 ("net: ethernet: mtk_eth_soc: support 36-bit DMA addressing on MT7988")
  25. Suggested-by: Elad Yifee <[email protected]>
  26. Signed-off-by: Daniel Golle <[email protected]>
  27. ---
  28. drivers/net/ethernet/mediatek/mtk_eth_soc.c | 5 ++++-
  29. 1 file changed, 4 insertions(+), 1 deletion(-)
  30. --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  31. +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  32. @@ -4885,7 +4885,10 @@ static int mtk_probe(struct platform_dev
  33. }
  34. if (MTK_HAS_CAPS(eth->soc->caps, MTK_36BIT_DMA)) {
  35. - err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(36));
  36. + err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(36));
  37. + if (!err)
  38. + err = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
  39. +
  40. if (err) {
  41. dev_err(&pdev->dev, "Wrong DMA config\n");
  42. return -EINVAL;