Advertisement
Guest User

Untitled

a guest
Mar 12th, 2015
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. From f75abc3ea66b3b5a1db4ed5451fca87543208b6b Mon Sep 17 00:00:00 2001
  2. From: Michael Trimarchi <[email protected]>
  3. Date: Wed, 11 Mar 2015 17:44:28 +0100
  4. Subject: [PATCH] net: stmmac: use msleep instead of udelay for gpio reset
  5.  
  6. Reset delay values are expressed in microsecond but most of the
  7. time the delay is more then 2ms and up to 100ms. Use udelay
  8. is wrong for large sleep period. This function is not used
  9. in interrupt context according to the documentation.
  10.  
  11. Signed-off-by: Michael Trimarchi <[email protected]>
  12. ---
  13. drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 14 +++++++-------
  14. 1 file changed, 7 insertions(+), 7 deletions(-)
  15.  
  16. diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
  17. index b735fa2..009a86a 100644
  18. --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
  19. +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
  20. @@ -157,15 +157,15 @@ int stmmac_mdio_reset(struct mii_bus *bus)
  21. }
  22.  
  23. reset_gpio = data->reset_gpio;
  24. - active_low = data->active_low;
  25. + active_low = !!data->active_low;
  26.  
  27. if (!gpio_request(reset_gpio, "mdio-reset")) {
  28. - gpio_direction_output(reset_gpio, active_low ? 1 : 0);
  29. - udelay(data->delays[0]);
  30. - gpio_set_value(reset_gpio, active_low ? 0 : 1);
  31. - udelay(data->delays[1]);
  32. - gpio_set_value(reset_gpio, active_low ? 1 : 0);
  33. - udelay(data->delays[2]);
  34. + gpio_direction_output(reset_gpio, active_low);
  35. + msleep(max(1U, data->delays[0] / 1000));
  36. + gpio_set_value(reset_gpio, !active_low);
  37. + msleep(max(1U, data->delays[1] / 1000));
  38. + gpio_set_value(reset_gpio, active_low);
  39. + msleep(max(1U, data->delays[2] / 1000));
  40. }
  41. }
  42. #endif
  43. --
  44. 1.9.1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement