aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/rdc
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2014-01-15 16:04:25 -0500
committerDavid S. Miller <davem@davemloft.net>2014-01-16 19:22:54 -0500
commit4f8d9f3ce0e52adf2cb4e0661f06ef8cfdc97cfe (patch)
tree0a897dd1a0f011b099e25a088a0ec82543cbbf52 /drivers/net/ethernet/rdc
parent2c0057dec90bf65618c5e8f97e9193ff756ee2fb (diff)
r6040: add delays in MDIO read/write polling loops
On newer and faster machines (Vortex X86DX) using the r6040 driver, it was noticed that the driver was returning an error during probing traced down to being the MDIO bus probing and the inability to complete a MDIO read operation in time. It turns out that the MDIO operations on these faster machines usually complete after ~2140 iterations which is bigger than 2048 (MAC_DEF_TIMEOUT) and results in spurious timeouts depending on the system load. Update r6040_phy_read() and r6040_phy_write() to include a 1 micro second delay in each busy-looping iteration of the loop which is a much safer operation than incrementing MAC_DEF_TIMEOUT. Reported-by: Nils Koehler <nils.koehler@ibt-interfaces.de> Reported-by: Daniel Goertzen <daniel.goertzen@gmail.com> Signed-off-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/rdc')
-rw-r--r--drivers/net/ethernet/rdc/r6040.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/rdc/r6040.c b/drivers/net/ethernet/rdc/r6040.c
index 851376b7fc78..c6cd1d05f8ea 100644
--- a/drivers/net/ethernet/rdc/r6040.c
+++ b/drivers/net/ethernet/rdc/r6040.c
@@ -221,6 +221,7 @@ static int r6040_phy_read(void __iomem *ioaddr, int phy_addr, int reg)
221 cmd = ioread16(ioaddr + MMDIO); 221 cmd = ioread16(ioaddr + MMDIO);
222 if (!(cmd & MDIO_READ)) 222 if (!(cmd & MDIO_READ))
223 break; 223 break;
224 udelay(1);
224 } 225 }
225 226
226 if (limit < 0) 227 if (limit < 0)
@@ -244,6 +245,7 @@ static int r6040_phy_write(void __iomem *ioaddr,
244 cmd = ioread16(ioaddr + MMDIO); 245 cmd = ioread16(ioaddr + MMDIO);
245 if (!(cmd & MDIO_WRITE)) 246 if (!(cmd & MDIO_WRITE))
246 break; 247 break;
248 udelay(1);
247 } 249 }
248 250
249 return (limit < 0) ? -ETIMEDOUT : 0; 251 return (limit < 0) ? -ETIMEDOUT : 0;