Skip to content

Commit 892aa01

Browse files
sjoerdsimonsdavem330
authored andcommitted
net: stmmac: Use msleep rather then udelay for reset delay
The reset delays used for stmmac are in the order of 10ms to 1 second, which is far too long for udelay usage, so switch to using msleep. Practically this fixes the PHY not being reliably detected in some cases as udelay wouldn't actually delay for long enough to let the phy reliably be reset. Signed-off-by: Sjoerd Simons <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d64f69b commit 892aa01

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,16 @@ int stmmac_mdio_reset(struct mii_bus *bus)
161161

162162
if (!gpio_request(reset_gpio, "mdio-reset")) {
163163
gpio_direction_output(reset_gpio, active_low ? 1 : 0);
164-
udelay(data->delays[0]);
164+
if (data->delays[0])
165+
msleep(DIV_ROUND_UP(data->delays[0], 1000));
166+
165167
gpio_set_value(reset_gpio, active_low ? 0 : 1);
166-
udelay(data->delays[1]);
168+
if (data->delays[1])
169+
msleep(DIV_ROUND_UP(data->delays[1], 1000));
170+
167171
gpio_set_value(reset_gpio, active_low ? 1 : 0);
168-
udelay(data->delays[2]);
172+
if (data->delays[2])
173+
msleep(DIV_ROUND_UP(data->delays[2], 1000));
169174
}
170175
}
171176
#endif

0 commit comments

Comments
 (0)