lkml.org 
[lkml]   [2003]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[4/4][via-rhine][PATCH] Reset function rewrite
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.

--- 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
\
 
 \ /
  Last update: 2005-03-22 13:33    [W:0.043 / U:7.688 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site