* [PATCH 3/5] tc35815: Increase timeout for mdio
@ 2009-08-06 14:41 Atsushi Nemoto
2009-08-06 20:16 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Atsushi Nemoto @ 2009-08-06 14:41 UTC (permalink / raw)
To: netdev; +Cc: David Miller, Ralf Roesch
The current timeout value is too short for very high-load condition
which jiffies might jump up in busy-loop.
Also add minimum delay before checking completion of MDIO.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
drivers/net/tc35815.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index 801d201..1adb150 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -594,9 +594,10 @@ static int tc_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
struct net_device *dev = bus->priv;
struct tc35815_regs __iomem *tr =
(struct tc35815_regs __iomem *)dev->base_addr;
- unsigned long timeout = jiffies + 10;
+ unsigned long timeout = jiffies + HZ;
tc_writel(MD_CA_Busy | (mii_id << 5) | (regnum & 0x1f), &tr->MD_CA);
+ udelay(12); /* it takes 32 x 400ns at least */
while (tc_readl(&tr->MD_CA) & MD_CA_Busy) {
if (time_after(jiffies, timeout))
return -EIO;
@@ -610,11 +611,12 @@ static int tc_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 val)
struct net_device *dev = bus->priv;
struct tc35815_regs __iomem *tr =
(struct tc35815_regs __iomem *)dev->base_addr;
- unsigned long timeout = jiffies + 10;
+ unsigned long timeout = jiffies + HZ;
tc_writel(val, &tr->MD_Data);
tc_writel(MD_CA_Busy | MD_CA_Wr | (mii_id << 5) | (regnum & 0x1f),
&tr->MD_CA);
+ udelay(12); /* it takes 32 x 400ns at least */
while (tc_readl(&tr->MD_CA) & MD_CA_Busy) {
if (time_after(jiffies, timeout))
return -EIO;
--
1.5.6.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 3/5] tc35815: Increase timeout for mdio
2009-08-06 14:41 [PATCH 3/5] tc35815: Increase timeout for mdio Atsushi Nemoto
@ 2009-08-06 20:16 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-08-06 20:16 UTC (permalink / raw)
To: anemo; +Cc: netdev, ralf.roesch
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Thu, 6 Aug 2009 23:41:47 +0900
> The current timeout value is too short for very high-load condition
> which jiffies might jump up in busy-loop.
> Also add minimum delay before checking completion of MDIO.
>
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Applied to net-next-2.6
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-08-06 20:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-06 14:41 [PATCH 3/5] tc35815: Increase timeout for mdio Atsushi Nemoto
2009-08-06 20:16 ` David Miller
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).