net: stmmac: use msleep instead of udelay for gpio reset
Subsystems (4)
RFC PATCH 1/1 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.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +7 -7
@@ -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
Signature · 1 line
1.9.1
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c int stmmac_mdio_reset(struct mii_bus *bus) · line 160
Quoted 3 lines · Michael Trimarchi
reset_gpio = data->reset_gpio;drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +1
-1- active_low = data->active_low; + active_low = !!data->active_low;
This is an unrelated change.
A message that is not in the archive (sent off-list or not yet received): CAOf5uw=0dw-4kHTCgiN143f33YxpZLsqsHyTcDfxnKCW5aDpzw@mail.gmail.com
Quoted 9 lines · Michael Trimarchi
Hi
Quoted 3 lines · On Apr 19, 2015 1:37 AM, "Fabio Estevam" <[email protected]…
On Sat, Apr 18, 2015 at 12:02 PM, Michael Trimarchi <[email protected] <mailto:[email protected]>>
Quoted 1 line · wrote:
Quoted 8 lines
Quoted 5 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c int stmmac_mdio_reset(struct mii_bus *bus) · line 160
Quoted 3 lines
reset_gpio = data->reset_gpio;drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +1
-1- active_low = data->active_low; + active_low = !!data->active_low;This is an unrelated change.
I have already try to minimize the change. Anyway I will repost it if necessary
yes send V2 w/ related changes for ms reset time only
thanks
Peppe
Quoted 2 lines
Michael