mediatek: fix mdio schedule while atomic error
authorJohn Crispin <john@phrozen.org>
Thu, 7 Sep 2017 08:11:45 +0000 (10:11 +0200)
committerJohn Crispin <john@phrozen.org>
Thu, 7 Sep 2017 08:11:45 +0000 (10:11 +0200)
Signed-off-by: John Crispin <john@phrozen.org>
target/linux/mediatek/patches-4.9/0062-mdio-atomic.patch [new file with mode: 0644]

diff --git a/target/linux/mediatek/patches-4.9/0062-mdio-atomic.patch b/target/linux/mediatek/patches-4.9/0062-mdio-atomic.patch
new file mode 100644 (file)
index 0000000..040084d
--- /dev/null
@@ -0,0 +1,16 @@
+Index: linux-4.9.47/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+===================================================================
+--- linux-4.9.47.orig/drivers/net/ethernet/mediatek/mtk_eth_soc.c
++++ linux-4.9.47/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+@@ -97,7 +97,10 @@ static int mtk_mdio_busy_wait(struct mtk
+                       return 0;
+               if (time_after(jiffies, t_start + PHY_IAC_TIMEOUT))
+                       break;
+-              usleep_range(10, 20);
++              if (in_atomic())
++                      udelay(10);
++              else
++                      usleep_range(10, 20);
+       }
+       dev_err(eth->dev, "mdio: MDIO timeout\n");