[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1429614973-6883-1-git-send-email-michael@amarulasolutions.com>
Date: Tue, 21 Apr 2015 13:16:13 +0200
From: Michael Trimarchi <michael@...rulasolutions.com>
To: Giuseppe Cavallaro <peppe.cavallaro@...com>
Cc: Michael Trimarchi <michael@...rulasolutions.com>,
Fabio Estevam <festevam@...il.com>, netdev@...r.kernel.org
Subject: [PATCH V2] 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.
Cc: Fabio Estevam <festevam@...il.com>
Signed-off-by: Michael Trimarchi <michael@...rulasolutions.com>
---
Changes v1 -> v2:
- remove unreleated changes
---
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index b735fa2..c843fbe 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -161,11 +161,11 @@ int stmmac_mdio_reset(struct mii_bus *bus)
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]);
+ 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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists