smsc95xx: sleep before read for lengthy operations
During init, the device reset is unexpected to complete immediately, so sleep before testing the condition rather than after it. Signed-off-by: Steve Glendinning <steve.glendinning@shawell.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
6a06e5e1bb
commit
cf2acec2e9
@ -763,12 +763,12 @@ static int smsc95xx_reset(struct usbnet *dev)
|
|||||||
|
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
do {
|
do {
|
||||||
|
msleep(10);
|
||||||
ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
|
ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret);
|
netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
msleep(10);
|
|
||||||
timeout++;
|
timeout++;
|
||||||
} while ((read_buf & HW_CFG_LRST_) && (timeout < 100));
|
} while ((read_buf & HW_CFG_LRST_) && (timeout < 100));
|
||||||
|
|
||||||
@ -786,12 +786,12 @@ static int smsc95xx_reset(struct usbnet *dev)
|
|||||||
|
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
do {
|
do {
|
||||||
|
msleep(10);
|
||||||
ret = smsc95xx_read_reg(dev, PM_CTRL, &read_buf);
|
ret = smsc95xx_read_reg(dev, PM_CTRL, &read_buf);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
netdev_warn(dev->net, "Failed to read PM_CTRL: %d\n", ret);
|
netdev_warn(dev->net, "Failed to read PM_CTRL: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
msleep(10);
|
|
||||||
timeout++;
|
timeout++;
|
||||||
} while ((read_buf & PM_CTL_PHY_RST_) && (timeout < 100));
|
} while ((read_buf & PM_CTL_PHY_RST_) && (timeout < 100));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user