提交 892aa01d 编写于 作者: S Sjoerd Simons 提交者: David S. Miller

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: NSjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 d64f69b0
...@@ -161,11 +161,16 @@ int stmmac_mdio_reset(struct mii_bus *bus) ...@@ -161,11 +161,16 @@ int stmmac_mdio_reset(struct mii_bus *bus)
if (!gpio_request(reset_gpio, "mdio-reset")) { if (!gpio_request(reset_gpio, "mdio-reset")) {
gpio_direction_output(reset_gpio, active_low ? 1 : 0); gpio_direction_output(reset_gpio, active_low ? 1 : 0);
udelay(data->delays[0]); if (data->delays[0])
msleep(DIV_ROUND_UP(data->delays[0], 1000));
gpio_set_value(reset_gpio, active_low ? 0 : 1); gpio_set_value(reset_gpio, active_low ? 0 : 1);
udelay(data->delays[1]); if (data->delays[1])
msleep(DIV_ROUND_UP(data->delays[1], 1000));
gpio_set_value(reset_gpio, active_low ? 1 : 0); gpio_set_value(reset_gpio, active_low ? 1 : 0);
udelay(data->delays[2]); if (data->delays[2])
msleep(DIV_ROUND_UP(data->delays[2], 1000));
} }
} }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册