0006-net-macb-add-dma_burst_length-config.patch 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. From 8da0745b86fb9b9e36d964afda797b161407971f Mon Sep 17 00:00:00 2001
  2. From: Ramon Fried <rfried.dev@gmail.com>
  3. Date: Tue, 11 Jun 2019 18:19:29 +0300
  4. Subject: [PATCH 06/21] net: macb: add dma_burst_length config
  5. GEM support higher DMA burst writes/reads than the default (4).
  6. add configuration structure with dma burst length so it could be
  7. applied later to DMA configuration.
  8. Signed-off-by: Ramon Fried <rfried.dev@gmail.com>
  9. Upstream-Status: Submitted
  10. ---
  11. drivers/net/macb.c | 22 +++++++++++++++++++++-
  12. 1 file changed, 21 insertions(+), 1 deletion(-)
  13. diff --git a/drivers/net/macb.c b/drivers/net/macb.c
  14. index ae8937bbb1..fb42172520 100644
  15. --- a/drivers/net/macb.c
  16. +++ b/drivers/net/macb.c
  17. @@ -82,6 +82,7 @@ struct macb_dma_desc {
  18. struct macb_device {
  19. void *regs;
  20. + unsigned int dma_burst_length;
  21. unsigned int rx_tail;
  22. unsigned int tx_head;
  23. @@ -118,6 +119,11 @@ struct macb_device {
  24. phy_interface_t phy_interface;
  25. #endif
  26. };
  27. +
  28. +struct macb_config {
  29. + unsigned int dma_burst_length;
  30. +};
  31. +
  32. #ifndef CONFIG_DM_ETH
  33. #define to_macb(_nd) container_of(_nd, struct macb_device, netdev)
  34. #endif
  35. @@ -1133,8 +1139,13 @@ static int macb_enable_clk(struct udevice *dev)
  36. }
  37. #endif
  38. +static const struct macb_config default_gem_config = {
  39. + .dma_burst_length = 16,
  40. +};
  41. +
  42. static int macb_eth_probe(struct udevice *dev)
  43. {
  44. + const struct macb_config *macb_config;
  45. struct eth_pdata *pdata = dev_get_platdata(dev);
  46. struct macb_device *macb = dev_get_priv(dev);
  47. const char *phy_mode;
  48. @@ -1151,6 +1162,11 @@ static int macb_eth_probe(struct udevice *dev)
  49. macb->regs = (void *)pdata->iobase;
  50. + macb_config = (struct macb_config *)dev_get_driver_data(dev);
  51. + if (!macb_config)
  52. + macb_config = &default_gem_config;
  53. +
  54. + macb->dma_burst_length = macb_config->dma_burst_length;
  55. #ifdef CONFIG_CLK
  56. ret = macb_enable_clk(dev);
  57. if (ret)
  58. @@ -1211,12 +1227,16 @@ static int macb_eth_ofdata_to_platdata(struct udevice *dev)
  59. return macb_late_eth_ofdata_to_platdata(dev);
  60. }
  61. +static const struct macb_config sama5d4_config = {
  62. + .dma_burst_length = 4,
  63. +};
  64. +
  65. static const struct udevice_id macb_eth_ids[] = {
  66. { .compatible = "cdns,macb" },
  67. { .compatible = "cdns,at91sam9260-macb" },
  68. { .compatible = "atmel,sama5d2-gem" },
  69. { .compatible = "atmel,sama5d3-gem" },
  70. - { .compatible = "atmel,sama5d4-gem" },
  71. + { .compatible = "atmel,sama5d4-gem", .data = (ulong)&sama5d4_config },
  72. { .compatible = "cdns,zynq-gem" },
  73. { }
  74. };
  75. --
  76. 2.22.0