ipq806x: fix a nasty stmmac data corruption bug caused by faulty DMA initialization
[librecmc/librecmc.git] / target / linux / ipq806x / patches-3.18 / 710-stmmac-fix-ipq806x-DMA-configuration.patch
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,16 @@ 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  
15 +       dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
16 +                              GFP_KERNEL);
17 +
18 +       dma_cfg->pbl = 32;
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  
28 --- a/include/linux/stmmac.h
29 +++ b/include/linux/stmmac.h
30 @@ -73,6 +73,9 @@
31                         | DMA_AXI_BLEN_32 | DMA_AXI_BLEN_64 \
32                         | DMA_AXI_BLEN_128 | DMA_AXI_BLEN_256)
33  
34 +#define DMA_AXI_RD_OSR_LMT_SHIFT       16
35 +#define DMA_AXI_WR_OSR_LMT_SHIFT       20
36 +
37  /* Platfrom data for platform device structure's platform_data field */
38  
39  struct stmmac_mdio_bus_data {