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