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 <mich...@amarulasolutions.com>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to