All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Luethi <rl@hellgate.ch>
To: Jeff Garzik <jgarzik@pobox.com>,
	Linus Torvalds <torvalds@transmeta.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@digeo.com>
Subject: [4/4][via-rhine][PATCH] Reset function rewrite
Date: Sat, 15 Feb 2003 12:18:31 +0100	[thread overview]
Message-ID: <20030215111831.GA11254@k3.hellgate.ch> (raw)
In-Reply-To: <20030215111705.GA11127@k3.hellgate.ch>

[-- Attachment #1: Type: text/plain, Size: 299 bytes --]

The new reset function only waits up to 0.1 ms for the reset to complete,
instead of 10 ms. However, it introduces the use of a forced reset flag if
a chip doesn't seem cooperative. This fixes cases where until now only
reloading the driver or even rebooting the machine would bring the chip
back.


[-- Attachment #2: via-rhine-1.16rc-04_reset.diff --]
[-- Type: text/plain, Size: 1201 bytes --]

--- 03_duplex/drivers/net/via-rhine.c	Fri Feb 14 19:07:17 2003
+++ 04_reset/drivers/net/via-rhine.c	Fri Feb 14 19:13:04 2003
@@ -523,24 +523,25 @@ static int  via_rhine_close(struct net_d
 static void wait_for_reset(struct net_device *dev, int chip_id, char *name)
 {
 	long ioaddr = dev->base_addr;
-	int i;
 
-	/* VT86C100A may need long delay after reset (dlink) */
-	if (chip_id == VT86C100A)
+	udelay(5);
+
+	if (readw(ioaddr + ChipCmd) & CmdReset) {
+		printk(KERN_INFO "%s: Reset did not complete in 5 us. "
+			"Trying harder.\n", name);
+
+		/* Rhine-II needs to be forced sometimes */
+		if (chip_id == VT6102)
+			writeb(0x40, ioaddr + 0x81);
+
+		/* VT86C100A may need long delay after reset (dlink) */
+		/* Seen on Rhine-II as well (rl) */
 		udelay(100);
+	}
 
-	i = 0;
-	do {
-		udelay(5);
-		i++;
-		if(i > 2000) {
-			printk(KERN_ERR "%s: reset did not complete in 10 ms.\n", name);
-			break;
-		}
-	} while(readw(ioaddr + ChipCmd) & CmdReset);
 	if (debug > 1)
-		printk(KERN_INFO "%s: reset finished after %d microseconds.\n",
-			   name, 5*i);
+		printk(KERN_INFO "%s: Reset %s.\n", name,
+			(readw(ioaddr + ChipCmd) & CmdReset) ? "failed" : "succeeded");
 }
 
 #ifdef USE_MEM

  parent reply	other threads:[~2003-02-15 11:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-15 11:17 [0/4][via-rhine] Improvements Roger Luethi
2003-02-15 11:18 ` [1/4][via-rhine][PATCH] Trivial changes; not affecting functionality Roger Luethi
2003-02-15 11:18 ` [2/4][via-rhine][PATCH] Fix broken Tx underrun handling Roger Luethi
2003-02-15 11:18 ` [3/4][via-rhine][PATCH] Various duplex related fixes Roger Luethi
2003-02-15 11:18 ` Roger Luethi [this message]
2003-02-15 19:08 ` [0/4][via-rhine] Improvements Jeff Garzik
2003-02-15 20:53   ` Roger Luethi
2003-02-15 21:49     ` Jeff Garzik
2003-02-15 22:52       ` Roger Luethi
2003-02-16  0:16         ` Linus Torvalds
2003-02-16 11:01           ` Roger Luethi
2003-02-17 18:44             ` Jeff Garzik
2003-02-15 21:40 ` Jeff Garzik

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=20030215111831.GA11254@k3.hellgate.ch \
    --to=rl@hellgate.ch \
    --cc=akpm@digeo.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.