Netdev List
 help / color / mirror / Atom feed
From: Florian Fainelli <florian@openwrt.org>
To: <netdev@vger.kernel.org>
Cc: <davem@davemloft.net>, Florian Fainelli <florian@openwrt.org>
Subject: [PATCH net-next 1/2] r6040: add delays in MDIO read/write polling loops
Date: Wed, 15 Jan 2014 13:04:25 -0800	[thread overview]
Message-ID: <1389819866-32142-2-git-send-email-florian@openwrt.org> (raw)
In-Reply-To: <1389819866-32142-1-git-send-email-florian@openwrt.org>

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>
---
 drivers/net/ethernet/rdc/r6040.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/rdc/r6040.c b/drivers/net/ethernet/rdc/r6040.c
index 1e49ec5..ff4683a 100644
--- a/drivers/net/ethernet/rdc/r6040.c
+++ b/drivers/net/ethernet/rdc/r6040.c
@@ -222,6 +222,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)
@@ -245,6 +246,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;
-- 
1.8.3.2

  reply	other threads:[~2014-01-15 21:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-15 21:04 [PATCH net-next 0/2] r6040: misc fixes Florian Fainelli
2014-01-15 21:04 ` Florian Fainelli [this message]
2014-01-15 21:04 ` [PATCH net-next 2/2] r6040: use ETH_ZLEN instead of MISR for SKB length checking Florian Fainelli
2014-01-16  7:23   ` Ben Hutchings
2014-01-16  9:10     ` David Laight
2014-01-16 17:33       ` Ben Hutchings
2014-01-16 19:30         ` Florian Fainelli
2014-01-17  0:24 ` [PATCH net-next 0/2] r6040: misc fixes David Miller

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=1389819866-32142-2-git-send-email-florian@openwrt.org \
    --to=florian@openwrt.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /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