3a8cd596116eef8ab3105edbbcefa1e0edf1916d
[openwrt/openwrt.git] / target / linux / mediatek / patches-4.9 / 0063-atomic-sleep.patch
1 Index: linux-4.9.50/drivers/net/ethernet/mediatek/mtk_eth_soc.c
2 ===================================================================
3 --- linux-4.9.50.orig/drivers/net/ethernet/mediatek/mtk_eth_soc.c
4 +++ linux-4.9.50/drivers/net/ethernet/mediatek/mtk_eth_soc.c
5 @@ -1533,7 +1533,10 @@ static void mtk_hwlro_rx_uninit(struct m
6 for (i = 0; i < 10; i++) {
7 val = mtk_r32(eth, MTK_PDMA_LRO_CTRL_DW0);
8 if (val & MTK_LRO_RING_RELINQUISH_DONE) {
9 - msleep(20);
10 + if (in_atomic())
11 + mdelay(20);
12 + else
13 + msleep(20);
14 continue;
15 }
16 break;
17 @@ -1951,7 +1954,10 @@ static void mtk_stop_dma(struct mtk_eth
18 for (i = 0; i < 10; i++) {
19 val = mtk_r32(eth, glo_cfg);
20 if (val & (MTK_TX_DMA_BUSY | MTK_RX_DMA_BUSY)) {
21 - msleep(20);
22 + if (in_atomic())
23 + mdelay(20);
24 + else
25 + msleep(20);
26 continue;
27 }
28 break;
29 @@ -1996,7 +2002,10 @@ static void ethsys_reset(struct mtk_eth
30 reset_bits,
31 reset_bits);
32
33 - usleep_range(1000, 1100);
34 + if (in_atomic())
35 + udelay(1000);
36 + else
37 + usleep_range(1000, 1100);
38 regmap_update_bits(eth->ethsys, ETHSYS_RSTCTRL,
39 reset_bits,
40 ~reset_bits);