Skip to content

Commit

Permalink
net: fec: handle small PHY reset durations more precisely
Browse files Browse the repository at this point in the history
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 <stefan.wahren@i2se.com>
Acked-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Stefan Wahren authored and David S. Miller committed Jun 13, 2016
1 parent 38b7097 commit eb37c56
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/net/ethernet/freescale/fec_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit eb37c56

Please sign in to comment.