From: Stefan Wahren Date: Wed, 8 Jun 2016 20:42:46 +0000 (+0000) Subject: net: fec: handle small PHY reset durations more precisely X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=eb37c56361df4a3e9705e808ce3f3bb483da3814;p=linux-beck.git 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: Stefan Wahren Acked-by: Fugang Duan Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index fea0f330ddbd..c36401e59905 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -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); return; } - msleep(msec); + + if (msec > 20) + msleep(msec); + else + usleep_range(msec * 1000, msec * 1000 + 1000); + gpio_set_value_cansleep(phy_reset, !active_high); } #else /* CONFIG_OF */