diff options
author | hayeswang <hayeswang@realtek.com> | 2014-09-08 23:40:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-09 23:10:44 -0400 |
commit | 8ddfa07778afdd9e00406a6a8ede827d51d9f26e (patch) | |
tree | 7cb5122ff69c397242d35e0d95bb18e13e175341 | |
parent | 67cc0d4077951295f42bed63805e91b46c24477b (diff) |
r8152: use usleep_range
Replace mdelay with usleep_range to avoid busy loop.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/usb/r8152.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index f95e678cb69d..2130c757b37e 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
@@ -2051,13 +2051,13 @@ static void rtl8152_disable(struct r8152 *tp) | |||
2051 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); | 2051 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); |
2052 | if ((ocp_data & FIFO_EMPTY) == FIFO_EMPTY) | 2052 | if ((ocp_data & FIFO_EMPTY) == FIFO_EMPTY) |
2053 | break; | 2053 | break; |
2054 | mdelay(1); | 2054 | usleep_range(1000, 2000); |
2055 | } | 2055 | } |
2056 | 2056 | ||
2057 | for (i = 0; i < 1000; i++) { | 2057 | for (i = 0; i < 1000; i++) { |
2058 | if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_TCR0) & TCR0_TX_EMPTY) | 2058 | if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_TCR0) & TCR0_TX_EMPTY) |
2059 | break; | 2059 | break; |
2060 | mdelay(1); | 2060 | usleep_range(1000, 2000); |
2061 | } | 2061 | } |
2062 | 2062 | ||
2063 | for (i = 0; i < RTL8152_MAX_RX; i++) | 2063 | for (i = 0; i < RTL8152_MAX_RX; i++) |
@@ -2202,7 +2202,7 @@ static void rtl_clear_bp(struct r8152 *tp) | |||
2202 | ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_2, 0); | 2202 | ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_2, 0); |
2203 | ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_4, 0); | 2203 | ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_4, 0); |
2204 | ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_6, 0); | 2204 | ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_6, 0); |
2205 | mdelay(3); | 2205 | usleep_range(3000, 6000); |
2206 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_BP_BA, 0); | 2206 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_BP_BA, 0); |
2207 | ocp_write_word(tp, MCU_TYPE_USB, USB_BP_BA, 0); | 2207 | ocp_write_word(tp, MCU_TYPE_USB, USB_BP_BA, 0); |
2208 | } | 2208 | } |
@@ -2288,7 +2288,7 @@ static void r8152b_exit_oob(struct r8152 *tp) | |||
2288 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); | 2288 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); |
2289 | if (ocp_data & LINK_LIST_READY) | 2289 | if (ocp_data & LINK_LIST_READY) |
2290 | break; | 2290 | break; |
2291 | mdelay(1); | 2291 | usleep_range(1000, 2000); |
2292 | } | 2292 | } |
2293 | 2293 | ||
2294 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_SFF_STS_7); | 2294 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_SFF_STS_7); |
@@ -2299,7 +2299,7 @@ static void r8152b_exit_oob(struct r8152 *tp) | |||
2299 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); | 2299 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); |
2300 | if (ocp_data & LINK_LIST_READY) | 2300 | if (ocp_data & LINK_LIST_READY) |
2301 | break; | 2301 | break; |
2302 | mdelay(1); | 2302 | usleep_range(1000, 2000); |
2303 | } | 2303 | } |
2304 | 2304 | ||
2305 | rtl8152_nic_reset(tp); | 2305 | rtl8152_nic_reset(tp); |
@@ -2360,7 +2360,7 @@ static void r8152b_enter_oob(struct r8152 *tp) | |||
2360 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); | 2360 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); |
2361 | if (ocp_data & LINK_LIST_READY) | 2361 | if (ocp_data & LINK_LIST_READY) |
2362 | break; | 2362 | break; |
2363 | mdelay(1); | 2363 | usleep_range(1000, 2000); |
2364 | } | 2364 | } |
2365 | 2365 | ||
2366 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_SFF_STS_7); | 2366 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_SFF_STS_7); |
@@ -2371,7 +2371,7 @@ static void r8152b_enter_oob(struct r8152 *tp) | |||
2371 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); | 2371 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); |
2372 | if (ocp_data & LINK_LIST_READY) | 2372 | if (ocp_data & LINK_LIST_READY) |
2373 | break; | 2373 | break; |
2374 | mdelay(1); | 2374 | usleep_range(1000, 2000); |
2375 | } | 2375 | } |
2376 | 2376 | ||
2377 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, RTL8152_RMS); | 2377 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, RTL8152_RMS); |
@@ -2518,7 +2518,7 @@ static void r8153_first_init(struct r8152 *tp) | |||
2518 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); | 2518 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); |
2519 | if (ocp_data & LINK_LIST_READY) | 2519 | if (ocp_data & LINK_LIST_READY) |
2520 | break; | 2520 | break; |
2521 | mdelay(1); | 2521 | usleep_range(1000, 2000); |
2522 | } | 2522 | } |
2523 | 2523 | ||
2524 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_SFF_STS_7); | 2524 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_SFF_STS_7); |
@@ -2529,7 +2529,7 @@ static void r8153_first_init(struct r8152 *tp) | |||
2529 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); | 2529 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); |
2530 | if (ocp_data & LINK_LIST_READY) | 2530 | if (ocp_data & LINK_LIST_READY) |
2531 | break; | 2531 | break; |
2532 | mdelay(1); | 2532 | usleep_range(1000, 2000); |
2533 | } | 2533 | } |
2534 | 2534 | ||
2535 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_CPCR); | 2535 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_CPCR); |
@@ -2573,7 +2573,7 @@ static void r8153_enter_oob(struct r8152 *tp) | |||
2573 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); | 2573 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); |
2574 | if (ocp_data & LINK_LIST_READY) | 2574 | if (ocp_data & LINK_LIST_READY) |
2575 | break; | 2575 | break; |
2576 | mdelay(1); | 2576 | usleep_range(1000, 2000); |
2577 | } | 2577 | } |
2578 | 2578 | ||
2579 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_SFF_STS_7); | 2579 | ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_SFF_STS_7); |
@@ -2584,7 +2584,7 @@ static void r8153_enter_oob(struct r8152 *tp) | |||
2584 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); | 2584 | ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); |
2585 | if (ocp_data & LINK_LIST_READY) | 2585 | if (ocp_data & LINK_LIST_READY) |
2586 | break; | 2586 | break; |
2587 | mdelay(1); | 2587 | usleep_range(1000, 2000); |
2588 | } | 2588 | } |
2589 | 2589 | ||
2590 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, RTL8153_RMS); | 2590 | ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, RTL8153_RMS); |