netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Timo Teräs" <timo.teras@iki.fi>
To: netdev@vger.kernel.org
Cc: "Timo Teräs" <timo.teras@iki.fi>,
	"Francois Romieu" <romieu@fr.zoreil.com>,
	Hayeswang <hayeswang@realtek.com>
Subject: [PATCH] r8169: fix mdio_read and update mdio_write according to hw specs
Date: Wed,  9 Jun 2010 08:22:10 +0300	[thread overview]
Message-ID: <1276060930-15697-1-git-send-email-timo.teras@iki.fi> (raw)
In-Reply-To: <BD599B881C1D407DA7BC93A9244650B0@realtek.com.tw>

Realtek confirmed that a 20us delay is needed after mdio_read and
mdio_write operations. Reduce the delay in mdio_write, and add it
to mdio_read too. Also add a comment that the 20us is from hw specs.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Cc: Francois Romieu <romieu@fr.zoreil.com>
Cc: Hayeswang <hayeswang@realtek.com>
---
 drivers/net/r8169.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 03a8318..96b6cfb 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -560,10 +560,10 @@ static void mdio_write(void __iomem *ioaddr, int reg_addr, int value)
 		udelay(25);
 	}
 	/*
-	 * Some configurations require a small delay even after the write
-	 * completed indication or the next write might fail.
+	 * According to hardware specs a 20us delay is required after write
+	 * complete indication, but before sending next command.
 	 */
-	udelay(25);
+	udelay(20);
 }
 
 static int mdio_read(void __iomem *ioaddr, int reg_addr)
@@ -583,6 +583,12 @@ static int mdio_read(void __iomem *ioaddr, int reg_addr)
 		}
 		udelay(25);
 	}
+	/*
+	 * According to hardware specs a 20us delay is required after read
+	 * complete indication, but before sending next command.
+	 */
+	udelay(20);
+
 	return value;
 }
 
-- 
1.7.0.4


  reply	other threads:[~2010-06-09  5:22 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-04 12:10 still having r8169 woes with XID 18000000 Timo Teräs
2010-06-04 12:36 ` Phil Sutter
2010-06-04 13:02   ` Timo Teräs
2010-06-04 13:43     ` Phil Sutter
2010-06-04 17:31       ` Timo Teräs
2010-06-04 20:24         ` Timo Teräs
2010-06-05  7:39           ` [PATCH] " Timo Teräs
2010-06-05  9:02             ` David Miller
2010-06-05  9:13             ` Eric Dumazet
2010-06-05  9:21               ` Timo Teräs
2010-06-05 10:21                 ` [PATCH] r8169: fix random mdio_write failures Timo Teräs
2010-06-05 12:41                   ` Francois Romieu
2010-06-06 22:39                     ` David Miller
2010-06-07  9:26                     ` hayeswang
2010-06-07 21:51                       ` Francois Romieu
2010-06-08  6:06                         ` Timo Teräs
2010-06-08  6:26                           ` Francois Romieu
2010-06-09  2:47                           ` hayeswang
2010-06-09  5:22                             ` Timo Teräs [this message]
2010-06-09  6:18                               ` [PATCH] r8169: fix mdio_read and update mdio_write according to hw specs Francois Romieu
2010-06-10  0:32                                 ` 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=1276060930-15697-1-git-send-email-timo.teras@iki.fi \
    --to=timo.teras@iki.fi \
    --cc=hayeswang@realtek.com \
    --cc=netdev@vger.kernel.org \
    --cc=romieu@fr.zoreil.com \
    /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;
as well as URLs for NNTP newsgroup(s).