Commit 8ddfa077 authored by hayeswang's avatar hayeswang Committed by David S. Miller

r8152: use usleep_range

Replace mdelay with usleep_range to avoid busy loop.
Signed-off-by: default avatarHayes Wang <hayeswang@realtek.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 67cc0d40
...@@ -2051,13 +2051,13 @@ static void rtl8152_disable(struct r8152 *tp) ...@@ -2051,13 +2051,13 @@ static void rtl8152_disable(struct r8152 *tp)
ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
if ((ocp_data & FIFO_EMPTY) == FIFO_EMPTY) if ((ocp_data & FIFO_EMPTY) == FIFO_EMPTY)
break; break;
mdelay(1); usleep_range(1000, 2000);
} }
for (i = 0; i < 1000; i++) { for (i = 0; i < 1000; i++) {
if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_TCR0) & TCR0_TX_EMPTY) if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_TCR0) & TCR0_TX_EMPTY)
break; break;
mdelay(1); usleep_range(1000, 2000);
} }
for (i = 0; i < RTL8152_MAX_RX; i++) for (i = 0; i < RTL8152_MAX_RX; i++)
...@@ -2202,7 +2202,7 @@ static void rtl_clear_bp(struct r8152 *tp) ...@@ -2202,7 +2202,7 @@ static void rtl_clear_bp(struct r8152 *tp)
ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_2, 0); ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_2, 0);
ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_4, 0); ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_4, 0);
ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_6, 0); ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_6, 0);
mdelay(3); usleep_range(3000, 6000);
ocp_write_word(tp, MCU_TYPE_PLA, PLA_BP_BA, 0); ocp_write_word(tp, MCU_TYPE_PLA, PLA_BP_BA, 0);
ocp_write_word(tp, MCU_TYPE_USB, USB_BP_BA, 0); ocp_write_word(tp, MCU_TYPE_USB, USB_BP_BA, 0);
} }
...@@ -2288,7 +2288,7 @@ static void r8152b_exit_oob(struct r8152 *tp) ...@@ -2288,7 +2288,7 @@ static void r8152b_exit_oob(struct r8152 *tp)
ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
if (ocp_data & LINK_LIST_READY) if (ocp_data & LINK_LIST_READY)
break; break;
mdelay(1); usleep_range(1000, 2000);
} }
ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_SFF_STS_7); 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,7 +2299,7 @@ static void r8152b_exit_oob(struct r8152 *tp)
ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
if (ocp_data & LINK_LIST_READY) if (ocp_data & LINK_LIST_READY)
break; break;
mdelay(1); usleep_range(1000, 2000);
} }
rtl8152_nic_reset(tp); rtl8152_nic_reset(tp);
...@@ -2360,7 +2360,7 @@ static void r8152b_enter_oob(struct r8152 *tp) ...@@ -2360,7 +2360,7 @@ static void r8152b_enter_oob(struct r8152 *tp)
ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
if (ocp_data & LINK_LIST_READY) if (ocp_data & LINK_LIST_READY)
break; break;
mdelay(1); usleep_range(1000, 2000);
} }
ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_SFF_STS_7); 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,7 +2371,7 @@ static void r8152b_enter_oob(struct r8152 *tp)
ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
if (ocp_data & LINK_LIST_READY) if (ocp_data & LINK_LIST_READY)
break; break;
mdelay(1); usleep_range(1000, 2000);
} }
ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, RTL8152_RMS); ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, RTL8152_RMS);
...@@ -2518,7 +2518,7 @@ static void r8153_first_init(struct r8152 *tp) ...@@ -2518,7 +2518,7 @@ static void r8153_first_init(struct r8152 *tp)
ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
if (ocp_data & LINK_LIST_READY) if (ocp_data & LINK_LIST_READY)
break; break;
mdelay(1); usleep_range(1000, 2000);
} }
ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_SFF_STS_7); 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,7 +2529,7 @@ static void r8153_first_init(struct r8152 *tp)
ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
if (ocp_data & LINK_LIST_READY) if (ocp_data & LINK_LIST_READY)
break; break;
mdelay(1); usleep_range(1000, 2000);
} }
ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_CPCR); ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_CPCR);
...@@ -2573,7 +2573,7 @@ static void r8153_enter_oob(struct r8152 *tp) ...@@ -2573,7 +2573,7 @@ static void r8153_enter_oob(struct r8152 *tp)
ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
if (ocp_data & LINK_LIST_READY) if (ocp_data & LINK_LIST_READY)
break; break;
mdelay(1); usleep_range(1000, 2000);
} }
ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_SFF_STS_7); 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,7 +2584,7 @@ static void r8153_enter_oob(struct r8152 *tp)
ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
if (ocp_data & LINK_LIST_READY) if (ocp_data & LINK_LIST_READY)
break; break;
mdelay(1); usleep_range(1000, 2000);
} }
ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, RTL8153_RMS); ocp_write_word(tp, MCU_TYPE_PLA, PLA_RMS, RTL8153_RMS);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment