[4/4][via-rhine][PATCH] Reset function rewrite

Roger Luethi (rl@hellgate.ch)
Sat, 15 Feb 2003 12:18:31 +0100


This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_courier-5444-1045308183-0001-2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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.

--=_courier-5444-1045308183-0001-2
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="via-rhine-1.16rc-04_reset.diff"

--- 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

--=_courier-5444-1045308183-0001-2--