mirror of
https://github.com/torvalds/linux.git
synced 2026-06-05 13:06:59 +02:00
r8152: Add RTL8152_INACCESSIBLE checks to more loops
[ Upstream commit32a574c7e2] Previous commits added checks for RTL8152_INACCESSIBLE in the loops in the driver. There are still a few more that keep tripping the driver up in error cases and make things take longer than they should. Add those in. All the loops that are part of this commit existed in some form or another since the r8152 driver was first introduced, though RTL8152_INACCESSIBLE was known as RTL8152_UNPLUG before commit715f67f33a("r8152: Rename RTL8152_UNPLUG to RTL8152_INACCESSIBLE") Fixes:ac718b6930("net/usb: new driver for RTL8152") Reviewed-by: Grant Grundler <grundler@chromium.org> Signed-off-by: Douglas Anderson <dianders@chromium.org> Acked-by: Hayes Wang <hayeswang@realtek.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
8defe1643d
commit
b7416e0a4d
|
|
@ -2967,6 +2967,8 @@ static void rtl8152_nic_reset(struct r8152 *tp)
|
|||
ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CR, CR_RST);
|
||||
|
||||
for (i = 0; i < 1000; i++) {
|
||||
if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
|
||||
break;
|
||||
if (!(ocp_read_byte(tp, MCU_TYPE_PLA, PLA_CR) & CR_RST))
|
||||
break;
|
||||
usleep_range(100, 400);
|
||||
|
|
@ -3296,6 +3298,8 @@ static void rtl_disable(struct r8152 *tp)
|
|||
rxdy_gated_en(tp, true);
|
||||
|
||||
for (i = 0; i < 1000; i++) {
|
||||
if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
|
||||
break;
|
||||
ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
|
||||
if ((ocp_data & FIFO_EMPTY) == FIFO_EMPTY)
|
||||
break;
|
||||
|
|
@ -3303,6 +3307,8 @@ static void rtl_disable(struct r8152 *tp)
|
|||
}
|
||||
|
||||
for (i = 0; i < 1000; i++) {
|
||||
if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
|
||||
break;
|
||||
if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_TCR0) & TCR0_TX_EMPTY)
|
||||
break;
|
||||
usleep_range(1000, 2000);
|
||||
|
|
@ -5466,6 +5472,8 @@ static void wait_oob_link_list_ready(struct r8152 *tp)
|
|||
int i;
|
||||
|
||||
for (i = 0; i < 1000; i++) {
|
||||
if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
|
||||
break;
|
||||
ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL);
|
||||
if (ocp_data & LINK_LIST_READY)
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user