]> Pileus Git - ~andy/linux/commitdiff
r6040: add delays in MDIO read/write polling loops
authorFlorian Fainelli <florian@openwrt.org>
Wed, 15 Jan 2014 21:04:25 +0000 (13:04 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 17 Jan 2014 00:22:54 +0000 (16:22 -0800)
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>
drivers/net/ethernet/rdc/r6040.c

index 851376b7fc7852e28f6f8d53e3d6afcbd0524a4c..c6cd1d05f8ea738f869cd1edeaa726dc469f28fc 100644 (file)
@@ -221,6 +221,7 @@ static int r6040_phy_read(void __iomem *ioaddr, int phy_addr, int reg)
                cmd = ioread16(ioaddr + MMDIO);
                if (!(cmd & MDIO_READ))
                        break;
+               udelay(1);
        }
 
        if (limit < 0)
@@ -244,6 +245,7 @@ static int r6040_phy_write(void __iomem *ioaddr,
                cmd = ioread16(ioaddr + MMDIO);
                if (!(cmd & MDIO_WRITE))
                        break;
+               udelay(1);
        }
 
        return (limit < 0) ? -ETIMEDOUT : 0;