netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Valerie Henson <val_henson@linux.intel.com>
To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Cc: Val Henson <val_henson@linux.intel.com>,
	Guido Classen <classeng@clagi.de>,
	Grant Grundler <grundler@parisc-linux.org>,
	Jeff Garzik <jeff@garzik.org>
Subject: [patch 1/4] [TULIP]  fix for Lite-On 82c168 PNIC
Date: Mon, 12 Mar 2007 02:59:29 -0700	[thread overview]
Message-ID: <20070312095911.430834000@linux.intel.com> (raw)
In-Reply-To: 20070312093128.577087000@linux.intel.com

[-- Attachment #1: tulip-fix-for-lite-on --]
[-- Type: text/plain, Size: 3702 bytes --]

From: Guido Classen <classeng@clagi.de>

This small patch fixes two issues with the Lite-On 82c168 PNIC adapters.
I've tested it with two cards in different machines both chip rev 17

The first is the wrong register address CSR6 for writing the MII register
which instead is 0xB8 (this may get a symbol too?) (see similar exisiting code
at line 437) in tulip_core.c

[Double-checked by Val Henson; yes, 0xB8 is correct register for
autonegotiate on this card.]

At least by my cards, the the bit 31 from the MII register seems to be
somewhat unstable. This results in reading wrong values from the Phy-Registers
und prevents the card from correct initialization. I've added a litte delay
and an second test of the bit. If the bit is stil cleared the read/write
process has definitely finished.

[Original patch slightly massaged by Val Henson]

Signed-off-by: Val Henson <val_henson@linux.intel.com>
Cc: Guido Classen <classeng@clagi.de>
Signed-off-by: Grant Grundler <grundler@parisc-linux.org>
Cc: Jeff Garzik <jeff@garzik.org>

---
 drivers/net/tulip/media.c      |   31 +++++++++++++++++++++++++++----
 drivers/net/tulip/tulip_core.c |    4 ++--
 2 files changed, 29 insertions(+), 6 deletions(-)

--- tulip-2.6-mm-linux.orig/drivers/net/tulip/tulip_core.c
+++ tulip-2.6-mm-linux/drivers/net/tulip/tulip_core.c
@@ -1701,8 +1701,8 @@ static int __devinit tulip_init_one (str
 			tp->nwayset = 0;
 			iowrite32(csr6_ttm | csr6_ca, ioaddr + CSR6);
 			iowrite32(0x30, ioaddr + CSR12);
-			iowrite32(0x0001F078, ioaddr + CSR6);
-			iowrite32(0x0201F078, ioaddr + CSR6); /* Turn on autonegotiation. */
+			iowrite32(0x0001F078, ioaddr + 0xB8);
+			iowrite32(0x0201F078, ioaddr + 0xB8); /* Turn on autonegotiation. */
 		}
 		break;
 	case MX98713:
--- tulip-2.6-mm-linux.orig/drivers/net/tulip/media.c
+++ tulip-2.6-mm-linux/drivers/net/tulip/media.c
@@ -76,8 +76,20 @@ int tulip_mdio_read(struct net_device *d
 		ioread32(ioaddr + 0xA0);
 		while (--i > 0) {
 			barrier();
-			if ( ! ((retval = ioread32(ioaddr + 0xA0)) & 0x80000000))
-				break;
+			if ( ! ((retval = ioread32(ioaddr + 0xA0))
+                                & 0x80000000)) {
+				/*
+				 * Possible bug in 82c168 rev 17 -
+                                 * sometimes bit 31 is unstable and
+                                 * clears before actually finished.
+                                 * Delay and check if bit 31 is still
+                                 * cleared before believing it.
+				 */
+                                udelay(10);
+                                if ( ! ((retval = ioread32(ioaddr + 0xA0))
+                                        & 0x80000000))
+                                        break;
+                        }
 		}
 		spin_unlock_irqrestore(&tp->mii_lock, flags);
 		return retval & 0xffff;
@@ -136,8 +148,19 @@ void tulip_mdio_write(struct net_device 
 		iowrite32(cmd, ioaddr + 0xA0);
 		do {
 			barrier();
-			if ( ! (ioread32(ioaddr + 0xA0) & 0x80000000))
-				break;
+			if ( ! (ioread32(ioaddr + 0xA0) & 0x80000000)) {
+				/*
+				 * Possible bug in 82c168 rev 17 -
+                                 * sometimes bit 31 is unstable and
+                                 * clears before actually finished.
+                                 * Delay and check if bit 31 is still
+                                 * cleared before believing it.
+				 */
+                                udelay(10);
+                                if ( ! (ioread32(ioaddr + 0xA0)
+                                        & 0x80000000))
+                                        break;
+                        }
 		} while (--i > 0);
 		spin_unlock_irqrestore(&tp->mii_lock, flags);
 		return;

--

  parent reply	other threads:[~2007-03-12  9:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-12  9:59 [patch 0/4] [TULIP] Tulip updates Valerie Henson
2007-03-12  9:31 ` [patch 1/6] [TULIP] From: Jim Gifford <maillist@jg555.com>, Grant Grundler <grundler@parisc-linux.org>, Peter Horton <pdh@colonel-panic.org> Valerie Henson
2007-03-15 15:20   ` Jeff Garzik
2007-03-12  9:31 ` [patch 2/6] [TULIP] From: Thibaut VARENE <T-Bone@parisc-linux.org> Valerie Henson
2007-03-12  9:31 ` [patch 3/6] [TULIP] fix for Lite-On 82c168 PNIC Valerie Henson
2007-03-15 15:21   ` Jeff Garzik
2007-03-12  9:31 ` [patch 4/6] [TULIP] Quiet down tulip_stop_rxtx Valerie Henson
2007-03-15 15:25   ` Jeff Garzik
2007-03-16  0:10     ` Valerie Henson
2007-03-17 19:05     ` Grant Grundler
2007-03-12  9:31 ` [patch 5/6] [TULIP] Fix SytemError typo Valerie Henson
2007-03-15 15:29   ` Jeff Garzik
2007-03-12  9:31 ` [patch 6/6] [TULIP] Rev tulip version Valerie Henson
2007-03-12  9:59 ` Valerie Henson [this message]
2007-03-15 12:40   ` [patch 1/4] [TULIP] fix for Lite-On 82c168 PNIC Mikael Pettersson
2007-03-12  9:59 ` [patch 2/4] [TULIP] Quiet down tulip_stop_rxtx Valerie Henson
2007-03-12  9:59 ` [patch 3/4] [TULIP] Fix SytemError typo Valerie Henson
2007-03-12  9:59 ` [patch 4/4] [TULIP] Rev tulip version Valerie Henson
2007-03-12 10:44   ` Pekka Enberg
2007-03-12 14:07     ` Jeff Garzik
2007-03-13 17:07       ` Andy Gospodarek

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=20070312095911.430834000@linux.intel.com \
    --to=val_henson@linux.intel.com \
    --cc=classeng@clagi.de \
    --cc=grundler@parisc-linux.org \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).