Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1223088 > unrolled thread
| Started by | Sjoerd Simons <sjoerd.simons@collabora.co.uk> |
|---|---|
| First post | 2015-09-11 22:30 +0200 |
| Last post | 2015-09-16 00:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v2] net: stmmac: Use msleep rather then udelay for reset delay Sjoerd Simons <sjoerd.simons@collabora.co.uk> - 2015-09-11 22:30 +0200
Re: [PATCH v2] net: stmmac: Use msleep rather then udelay for reset delay David Miller <davem@davemloft.net> - 2015-09-16 00:10 +0200
| From | Sjoerd Simons <sjoerd.simons@collabora.co.uk> |
|---|---|
| Date | 2015-09-11 22:30 +0200 |
| Subject | [PATCH v2] net: stmmac: Use msleep rather then udelay for reset delay |
| Message-ID | <q7D7l-3Xq-5@gated-at.bofh.it> |
The reset delays used for stmmac are in the order of 10ms to 1 second,
which is far too long for udelay usage, so switch to using msleep.
Practically this fixes the PHY not being reliably detected in some cases
as udelay wouldn't actually delay for long enough to let the phy
reliably be reset.
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
---
Changes in v2:
- Use DIV_ROUND_UP instead of handcoding the same
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index b735fa2..ebf6abc 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -161,11 +161,16 @@ 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]);
+ if (data->delays[0])
+ msleep(DIV_ROUND_UP(data->delays[0], 1000));
+
gpio_set_value(reset_gpio, active_low ? 0 : 1);
- udelay(data->delays[1]);
+ if (data->delays[1])
+ msleep(DIV_ROUND_UP(data->delays[1], 1000));
+
gpio_set_value(reset_gpio, active_low ? 1 : 0);
- udelay(data->delays[2]);
+ if (data->delays[2])
+ msleep(DIV_ROUND_UP(data->delays[2], 1000));
}
}
#endif
--
2.5.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2015-09-16 00:10 +0200 |
| Subject | Re: [PATCH v2] net: stmmac: Use msleep rather then udelay for reset delay |
| Message-ID | <q96Ai-1Xc-29@gated-at.bofh.it> |
| In reply to | #1223088 |
From: Sjoerd Simons <sjoerd.simons@collabora.co.uk> Date: Fri, 11 Sep 2015 22:25:48 +0200 > The reset delays used for stmmac are in the order of 10ms to 1 second, > which is far too long for udelay usage, so switch to using msleep. > > Practically this fixes the PHY not being reliably detected in some cases > as udelay wouldn't actually delay for long enough to let the phy > reliably be reset. > > Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk> Applied, thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web