aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorJohn Crispin <john@phrozen.org>2017-10-09 11:29:01 +0200
committerJohn Crispin <john@phrozen.org>2017-10-09 11:29:01 +0200
commitc972779e9875a3b69ae607bdb691bf5ff52710cf (patch)
tree0d56b4284a1c89f52a8668fbbc28536bf2d06eef /target
parent9e9696afc8f295b5abd1a8bc0b1826d7ec5e54ca (diff)
downloadupstream-c972779e9875a3b69ae607bdb691bf5ff52710cf.tar.gz
upstream-c972779e9875a3b69ae607bdb691bf5ff52710cf.tar.bz2
upstream-c972779e9875a3b69ae607bdb691bf5ff52710cf.zip
mediatek: fix a sleep while atomic bug inside the ethernet driver
this sometimes happens when we have hw nat enabled. Signed-off-by: John Crispin <john@phrozen.org>
Diffstat (limited to 'target')
-rw-r--r--target/linux/mediatek/patches-4.9/0063-atomic-sleep.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/target/linux/mediatek/patches-4.9/0063-atomic-sleep.patch b/target/linux/mediatek/patches-4.9/0063-atomic-sleep.patch
new file mode 100644
index 0000000000..3a8cd59611
--- /dev/null
+++ b/target/linux/mediatek/patches-4.9/0063-atomic-sleep.patch
@@ -0,0 +1,40 @@
+Index: linux-4.9.50/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+===================================================================
+--- linux-4.9.50.orig/drivers/net/ethernet/mediatek/mtk_eth_soc.c
++++ linux-4.9.50/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+@@ -1533,7 +1533,10 @@ static void mtk_hwlro_rx_uninit(struct m
+ for (i = 0; i < 10; i++) {
+ val = mtk_r32(eth, MTK_PDMA_LRO_CTRL_DW0);
+ if (val & MTK_LRO_RING_RELINQUISH_DONE) {
+- msleep(20);
++ if (in_atomic())
++ mdelay(20);
++ else
++ msleep(20);
+ continue;
+ }
+ break;
+@@ -1951,7 +1954,10 @@ static void mtk_stop_dma(struct mtk_eth
+ for (i = 0; i < 10; i++) {
+ val = mtk_r32(eth, glo_cfg);
+ if (val & (MTK_TX_DMA_BUSY | MTK_RX_DMA_BUSY)) {
+- msleep(20);
++ if (in_atomic())
++ mdelay(20);
++ else
++ msleep(20);
+ continue;
+ }
+ break;
+@@ -1996,7 +2002,10 @@ static void ethsys_reset(struct mtk_eth
+ reset_bits,
+ reset_bits);
+
+- usleep_range(1000, 1100);
++ if (in_atomic())
++ udelay(1000);
++ else
++ usleep_range(1000, 1100);
+ regmap_update_bits(eth->ethsys, ETHSYS_RSTCTRL,
+ reset_bits,
+ ~reset_bits);