711-stmmac-fix-ipq806x-DMA-configuration.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
  2. +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
  3. @@ -259,6 +259,7 @@ static int ipq806x_gmac_probe(struct pla
  4. {
  5. struct plat_stmmacenet_data *plat_dat;
  6. struct stmmac_resources stmmac_res;
  7. + struct stmmac_dma_cfg *dma_cfg;
  8. struct device *dev = &pdev->dev;
  9. struct ipq806x_gmac *gmac;
  10. int val;
  11. @@ -348,6 +349,17 @@ static int ipq806x_gmac_probe(struct pla
  12. plat_dat->bsp_priv = gmac;
  13. plat_dat->fix_mac_speed = ipq806x_gmac_fix_mac_speed;
  14. + dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
  15. + GFP_KERNEL);
  16. +
  17. + dma_cfg->pbl = 32;
  18. + dma_cfg->aal = 1;
  19. + dma_cfg->burst_len = DMA_AXI_BLEN_16 |
  20. + (7 << DMA_AXI_RD_OSR_LMT_SHIFT) |
  21. + (7 << DMA_AXI_WR_OSR_LMT_SHIFT);
  22. +
  23. + plat_dat->dma_cfg = dma_cfg;
  24. +
  25. return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
  26. }
  27. --- a/include/linux/stmmac.h
  28. +++ b/include/linux/stmmac.h
  29. @@ -73,6 +73,9 @@
  30. | DMA_AXI_BLEN_32 | DMA_AXI_BLEN_64 \
  31. | DMA_AXI_BLEN_128 | DMA_AXI_BLEN_256)
  32. +#define DMA_AXI_RD_OSR_LMT_SHIFT 16
  33. +#define DMA_AXI_WR_OSR_LMT_SHIFT 20
  34. +
  35. /* Platfrom data for platform device structure's platform_data field */
  36. struct stmmac_mdio_bus_data {
  37. @@ -88,6 +91,7 @@ struct stmmac_mdio_bus_data {
  38. struct stmmac_dma_cfg {
  39. int pbl;
  40. + int aal;
  41. int fixed_burst;
  42. int mixed_burst;
  43. int burst_len;
  44. --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
  45. +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
  46. @@ -31,7 +31,8 @@
  47. #include "dwmac_dma.h"
  48. static int dwmac1000_dma_init(void __iomem *ioaddr, int pbl, int fb, int mb,
  49. - int burst_len, u32 dma_tx, u32 dma_rx, int atds)
  50. + int burst_len, u32 dma_tx, u32 dma_rx, int atds,
  51. + int aal)
  52. {
  53. u32 value = readl(ioaddr + DMA_BUS_MODE);
  54. int limit;
  55. @@ -62,6 +63,10 @@ static int dwmac1000_dma_init(void __iom
  56. value = DMA_BUS_MODE_PBL | ((pbl << DMA_BUS_MODE_PBL_SHIFT) |
  57. (pbl << DMA_BUS_MODE_RPBL_SHIFT));
  58. + /* Address Aligned Beats */
  59. + if (aal)
  60. + value |= DMA_BUS_MODE_AAL;
  61. +
  62. /* Set the Fixed burst mode */
  63. if (fb)
  64. value |= DMA_BUS_MODE_FB;
  65. --- a/drivers/net/ethernet/stmicro/stmmac/common.h
  66. +++ b/drivers/net/ethernet/stmicro/stmmac/common.h
  67. @@ -352,7 +352,7 @@ extern const struct stmmac_desc_ops ndes
  68. struct stmmac_dma_ops {
  69. /* DMA core initialization */
  70. int (*init) (void __iomem *ioaddr, int pbl, int fb, int mb,
  71. - int burst_len, u32 dma_tx, u32 dma_rx, int atds);
  72. + int burst_len, u32 dma_tx, u32 dma_rx, int atds, int aal);
  73. /* Dump DMA registers */
  74. void (*dump_regs) (void __iomem *ioaddr);
  75. /* Set tx/rx threshold in the csr6 register
  76. --- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
  77. +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
  78. @@ -33,7 +33,8 @@
  79. #include "dwmac_dma.h"
  80. static int dwmac100_dma_init(void __iomem *ioaddr, int pbl, int fb, int mb,
  81. - int burst_len, u32 dma_tx, u32 dma_rx, int atds)
  82. + int burst_len, u32 dma_tx, u32 dma_rx, int atds,
  83. + int aal)
  84. {
  85. u32 value = readl(ioaddr + DMA_BUS_MODE);
  86. int limit;
  87. --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
  88. +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
  89. @@ -1641,9 +1641,11 @@ static int stmmac_init_dma_engine(struct
  90. int pbl = DEFAULT_DMA_PBL, fixed_burst = 0, burst_len = 0;
  91. int mixed_burst = 0;
  92. int atds = 0;
  93. + int aal = 0;
  94. if (priv->plat->dma_cfg) {
  95. pbl = priv->plat->dma_cfg->pbl;
  96. + aal = priv->plat->dma_cfg->aal;
  97. fixed_burst = priv->plat->dma_cfg->fixed_burst;
  98. mixed_burst = priv->plat->dma_cfg->mixed_burst;
  99. burst_len = priv->plat->dma_cfg->burst_len;
  100. @@ -1654,7 +1656,7 @@ static int stmmac_init_dma_engine(struct
  101. return priv->hw->dma->init(priv->ioaddr, pbl, fixed_burst, mixed_burst,
  102. burst_len, priv->dma_tx_phy,
  103. - priv->dma_rx_phy, atds);
  104. + priv->dma_rx_phy, atds, aal);
  105. }
  106. /**