From: Michael Trimarchi <michael@amarulasolutions.com>
To: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Michael Trimarchi <michael@amarulasolutions.com>,
Fabio Estevam <festevam@gmail.com>,
netdev@vger.kernel.org
Subject: [PATCH V2] net: stmmac: use msleep instead of udelay for gpio reset
Date: Tue, 21 Apr 2015 13:16:13 +0200 [thread overview]
Message-ID: <1429614973-6883-1-git-send-email-michael@amarulasolutions.com> (raw)
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@gmail.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.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
next reply other threads:[~2015-04-21 11:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-21 11:16 Michael Trimarchi [this message]
2015-04-21 21:35 ` [PATCH V2] net: stmmac: use msleep instead of udelay for gpio reset David Miller
2015-04-21 23:13 ` Michael Trimarchi
2015-04-22 0:31 ` David Miller
2015-04-22 0:55 ` Michael Trimarchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1429614973-6883-1-git-send-email-michael@amarulasolutions.com \
--to=michael@amarulasolutions.com \
--cc=festevam@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).