Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From f75abc3ea66b3b5a1db4ed5451fca87543208b6b Mon Sep 17 00:00:00 2001
- From: Michael Trimarchi <[email protected]>
- Date: Wed, 11 Mar 2015 17:44:28 +0100
- Subject: [PATCH] net: stmmac: use msleep instead of udelay for gpio reset
- Reset delay values are expressed in microsecond but most of the
- time the delay is more then 2ms and up to 100ms. Use udelay
- is wrong for large sleep period. This function is not used
- in interrupt context according to the documentation.
- Signed-off-by: Michael Trimarchi <[email protected]>
- ---
- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 14 +++++++-------
- 1 file changed, 7 insertions(+), 7 deletions(-)
- diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
- index b735fa2..009a86a 100644
- --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
- +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
- @@ -157,15 +157,15 @@ int stmmac_mdio_reset(struct mii_bus *bus)
- }
- reset_gpio = data->reset_gpio;
- - active_low = data->active_low;
- + active_low = !!data->active_low;
- if (!gpio_request(reset_gpio, "mdio-reset")) {
- - gpio_direction_output(reset_gpio, active_low ? 1 : 0);
- - udelay(data->delays[0]);
- - gpio_set_value(reset_gpio, active_low ? 0 : 1);
- - udelay(data->delays[1]);
- - gpio_set_value(reset_gpio, active_low ? 1 : 0);
- - udelay(data->delays[2]);
- + gpio_direction_output(reset_gpio, active_low);
- + msleep(max(1U, data->delays[0] / 1000));
- + gpio_set_value(reset_gpio, !active_low);
- + msleep(max(1U, data->delays[1] / 1000));
- + gpio_set_value(reset_gpio, active_low);
- + msleep(max(1U, data->delays[2] / 1000));
- }
- }
- #endif
- --
- 1.9.1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement