summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-11-22 19:07:00 +0000
committerFelix Fietkau <nbd@openwrt.org>2015-11-22 19:07:00 +0000
commita32f301b62a6f8b6fd8b09363b0e4e608c43f1b0 (patch)
treedfc1391b292695a6bd0792410424f109d54e078d /target
parent3789b1f5a0760bce2f56993685a3f7e7202d41d0 (diff)
downloadmtk-20170518-a32f301b62a6f8b6fd8b09363b0e4e608c43f1b0.zip
mtk-20170518-a32f301b62a6f8b6fd8b09363b0e4e608c43f1b0.tar.gz
mtk-20170518-a32f301b62a6f8b6fd8b09363b0e4e608c43f1b0.tar.bz2
ipq806x: fix a nasty stmmac data corruption bug caused by faulty DMA initialization
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 47594
Diffstat (limited to 'target')
-rw-r--r--target/linux/ipq806x/patches-3.18/710-stmmac-fix-ipq806x-DMA-configuration.patch39
-rw-r--r--target/linux/ipq806x/patches-4.1/710-stmmac-fix-ipq806x-DMA-configuration.patch39
2 files changed, 78 insertions, 0 deletions
diff --git a/target/linux/ipq806x/patches-3.18/710-stmmac-fix-ipq806x-DMA-configuration.patch b/target/linux/ipq806x/patches-3.18/710-stmmac-fix-ipq806x-DMA-configuration.patch
new file mode 100644
index 0000000..c09793f
--- /dev/null
+++ b/target/linux/ipq806x/patches-3.18/710-stmmac-fix-ipq806x-DMA-configuration.patch
@@ -0,0 +1,39 @@
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
+@@ -259,6 +259,7 @@ static int ipq806x_gmac_probe(struct pla
+ {
+ struct plat_stmmacenet_data *plat_dat;
+ struct stmmac_resources stmmac_res;
++ struct stmmac_dma_cfg *dma_cfg;
+ struct device *dev = &pdev->dev;
+ struct ipq806x_gmac *gmac;
+ int val;
+@@ -348,6 +349,16 @@ static int ipq806x_gmac_probe(struct pla
+ plat_dat->bsp_priv = gmac;
+ plat_dat->fix_mac_speed = ipq806x_gmac_fix_mac_speed;
+
++ dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
++ GFP_KERNEL);
++
++ dma_cfg->pbl = 32;
++ dma_cfg->burst_len = DMA_AXI_BLEN_16 |
++ (7 << DMA_AXI_RD_OSR_LMT_SHIFT) |
++ (7 << DMA_AXI_WR_OSR_LMT_SHIFT);
++
++ plat_dat->dma_cfg = dma_cfg;
++
+ return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
+ }
+
+--- a/include/linux/stmmac.h
++++ b/include/linux/stmmac.h
+@@ -73,6 +73,9 @@
+ | DMA_AXI_BLEN_32 | DMA_AXI_BLEN_64 \
+ | DMA_AXI_BLEN_128 | DMA_AXI_BLEN_256)
+
++#define DMA_AXI_RD_OSR_LMT_SHIFT 16
++#define DMA_AXI_WR_OSR_LMT_SHIFT 20
++
+ /* Platfrom data for platform device structure's platform_data field */
+
+ struct stmmac_mdio_bus_data {
diff --git a/target/linux/ipq806x/patches-4.1/710-stmmac-fix-ipq806x-DMA-configuration.patch b/target/linux/ipq806x/patches-4.1/710-stmmac-fix-ipq806x-DMA-configuration.patch
new file mode 100644
index 0000000..c09793f
--- /dev/null
+++ b/target/linux/ipq806x/patches-4.1/710-stmmac-fix-ipq806x-DMA-configuration.patch
@@ -0,0 +1,39 @@
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c
+@@ -259,6 +259,7 @@ static int ipq806x_gmac_probe(struct pla
+ {
+ struct plat_stmmacenet_data *plat_dat;
+ struct stmmac_resources stmmac_res;
++ struct stmmac_dma_cfg *dma_cfg;
+ struct device *dev = &pdev->dev;
+ struct ipq806x_gmac *gmac;
+ int val;
+@@ -348,6 +349,16 @@ static int ipq806x_gmac_probe(struct pla
+ plat_dat->bsp_priv = gmac;
+ plat_dat->fix_mac_speed = ipq806x_gmac_fix_mac_speed;
+
++ dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
++ GFP_KERNEL);
++
++ dma_cfg->pbl = 32;
++ dma_cfg->burst_len = DMA_AXI_BLEN_16 |
++ (7 << DMA_AXI_RD_OSR_LMT_SHIFT) |
++ (7 << DMA_AXI_WR_OSR_LMT_SHIFT);
++
++ plat_dat->dma_cfg = dma_cfg;
++
+ return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
+ }
+
+--- a/include/linux/stmmac.h
++++ b/include/linux/stmmac.h
+@@ -73,6 +73,9 @@
+ | DMA_AXI_BLEN_32 | DMA_AXI_BLEN_64 \
+ | DMA_AXI_BLEN_128 | DMA_AXI_BLEN_256)
+
++#define DMA_AXI_RD_OSR_LMT_SHIFT 16
++#define DMA_AXI_WR_OSR_LMT_SHIFT 20
++
+ /* Platfrom data for platform device structure's platform_data field */
+
+ struct stmmac_mdio_bus_data {