001-4.16-02-bcm63xx_enet-use-platform-data-for-dma-channel-numbe.patch 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. From b7d1d1f345bb3b25c360c1df812d98866e2ee7fb Mon Sep 17 00:00:00 2001
  2. From: Jonas Gorski <[email protected]>
  3. Date: Sat, 30 Sep 2017 13:50:03 +0200
  4. Subject: [PATCH 2/4] bcm63xx_enet: use platform data for dma channel numbers
  5. To reduce the reliance on device ids, pass the dma channel numbers to
  6. the enet devices as platform data.
  7. Signed-off-by: Jonas Gorski <[email protected]>
  8. ---
  9. arch/mips/bcm63xx/dev-enet.c | 8 ++++++++
  10. arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h | 4 ++++
  11. drivers/net/ethernet/broadcom/bcm63xx_enet.c | 11 ++---------
  12. 3 files changed, 14 insertions(+), 9 deletions(-)
  13. --- a/arch/mips/bcm63xx/dev-enet.c
  14. +++ b/arch/mips/bcm63xx/dev-enet.c
  15. @@ -265,6 +265,14 @@ int __init bcm63xx_enet_register(int uni
  16. dpd->dma_chan_width = ENETDMA_CHAN_WIDTH;
  17. }
  18. + if (unit == 0) {
  19. + dpd->rx_chan = 0;
  20. + dpd->tx_chan = 1;
  21. + } else {
  22. + dpd->rx_chan = 2;
  23. + dpd->tx_chan = 3;
  24. + }
  25. +
  26. ret = platform_device_register(pdev);
  27. if (ret)
  28. return ret;
  29. --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
  30. +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_enet.h
  31. @@ -54,6 +54,10 @@ struct bcm63xx_enet_platform_data {
  32. /* DMA descriptor shift */
  33. unsigned int dma_desc_shift;
  34. +
  35. + /* dma channel ids */
  36. + int rx_chan;
  37. + int tx_chan;
  38. };
  39. /*
  40. --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
  41. +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
  42. @@ -1772,15 +1772,6 @@ static int bcm_enet_probe(struct platfor
  43. priv->irq_tx = res_irq_tx->start;
  44. priv->mac_id = pdev->id;
  45. - /* get rx & tx dma channel id for this mac */
  46. - if (priv->mac_id == 0) {
  47. - priv->rx_chan = 0;
  48. - priv->tx_chan = 1;
  49. - } else {
  50. - priv->rx_chan = 2;
  51. - priv->tx_chan = 3;
  52. - }
  53. -
  54. priv->mac_clk = devm_clk_get(&pdev->dev, "enet");
  55. if (IS_ERR(priv->mac_clk)) {
  56. ret = PTR_ERR(priv->mac_clk);
  57. @@ -1812,6 +1803,8 @@ static int bcm_enet_probe(struct platfor
  58. priv->dma_chan_width = pd->dma_chan_width;
  59. priv->dma_has_sram = pd->dma_has_sram;
  60. priv->dma_desc_shift = pd->dma_desc_shift;
  61. + priv->rx_chan = pd->rx_chan;
  62. + priv->tx_chan = pd->tx_chan;
  63. }
  64. if (priv->mac_id == 0 && priv->has_phy && !priv->use_external_mii) {