Commit eb37c563 authored by Stefan Wahren's avatar Stefan Wahren Committed by David S. Miller

net: fec: handle small PHY reset durations more precisely

Since msleep is based on jiffies the PHY reset could take longer
than expected. So use msleep for values greater than 20 msec otherwise
usleep_range.
Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Acked-by: default avatarFugang Duan <fugang.duan@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 38b7097b
...@@ -3191,7 +3191,12 @@ static void fec_reset_phy(struct platform_device *pdev) ...@@ -3191,7 +3191,12 @@ static void fec_reset_phy(struct platform_device *pdev)
dev_err(&pdev->dev, "failed to get phy-reset-gpios: %d\n", err); dev_err(&pdev->dev, "failed to get phy-reset-gpios: %d\n", err);
return; return;
} }
msleep(msec);
if (msec > 20)
msleep(msec);
else
usleep_range(msec * 1000, msec * 1000 + 1000);
gpio_set_value_cansleep(phy_reset, !active_high); gpio_set_value_cansleep(phy_reset, !active_high);
} }
#else /* CONFIG_OF */ #else /* CONFIG_OF */
......
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