aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/8390/wd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/8390/wd.c')
-rw-r--r--drivers/net/ethernet/8390/wd.c42
1 files changed, 25 insertions, 17 deletions
diff --git a/drivers/net/ethernet/8390/wd.c b/drivers/net/ethernet/8390/wd.c
index 03eb3eed49fa..dd7d816bde52 100644
--- a/drivers/net/ethernet/8390/wd.c
+++ b/drivers/net/ethernet/8390/wd.c
@@ -60,6 +60,7 @@ static void wd_block_output(struct net_device *dev, int count,
60 const unsigned char *buf, int start_page); 60 const unsigned char *buf, int start_page);
61static int wd_close(struct net_device *dev); 61static int wd_close(struct net_device *dev);
62 62
63static u32 wd_msg_enable;
63 64
64#define WD_START_PG 0x00 /* First page of TX buffer */ 65#define WD_START_PG 0x00 /* First page of TX buffer */
65#define WD03_STOP_PG 0x20 /* Last page +1 of RX ring */ 66#define WD03_STOP_PG 0x20 /* Last page +1 of RX ring */
@@ -170,6 +171,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
170 int word16 = 0; /* 0 = 8 bit, 1 = 16 bit */ 171 int word16 = 0; /* 0 = 8 bit, 1 = 16 bit */
171 const char *model_name; 172 const char *model_name;
172 static unsigned version_printed; 173 static unsigned version_printed;
174 struct ei_device *ei_local = netdev_priv(dev);
173 175
174 for (i = 0; i < 8; i++) 176 for (i = 0; i < 8; i++)
175 checksum += inb(ioaddr + 8 + i); 177 checksum += inb(ioaddr + 8 + i);
@@ -180,19 +182,19 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
180 182
181 /* Check for semi-valid mem_start/end values if supplied. */ 183 /* Check for semi-valid mem_start/end values if supplied. */
182 if ((dev->mem_start % 0x2000) || (dev->mem_end % 0x2000)) { 184 if ((dev->mem_start % 0x2000) || (dev->mem_end % 0x2000)) {
183 printk(KERN_WARNING "wd.c: user supplied mem_start or mem_end not on 8kB boundary - ignored.\n"); 185 netdev_warn(dev,
186 "wd.c: user supplied mem_start or mem_end not on 8kB boundary - ignored.\n");
184 dev->mem_start = 0; 187 dev->mem_start = 0;
185 dev->mem_end = 0; 188 dev->mem_end = 0;
186 } 189 }
187 190
188 if (ei_debug && version_printed++ == 0) 191 if ((wd_msg_enable & NETIF_MSG_DRV) && (version_printed++ == 0))
189 printk(version); 192 netdev_info(dev, version);
190 193
191 for (i = 0; i < 6; i++) 194 for (i = 0; i < 6; i++)
192 dev->dev_addr[i] = inb(ioaddr + 8 + i); 195 dev->dev_addr[i] = inb(ioaddr + 8 + i);
193 196
194 printk("%s: WD80x3 at %#3x, %pM", 197 netdev_info(dev, "WD80x3 at %#3x, %pM", ioaddr, dev->dev_addr);
195 dev->name, ioaddr, dev->dev_addr);
196 198
197 /* The following PureData probe code was contributed by 199 /* The following PureData probe code was contributed by
198 Mike Jagdis <jaggy@purplet.demon.co.uk>. Puredata does software 200 Mike Jagdis <jaggy@purplet.demon.co.uk>. Puredata does software
@@ -244,8 +246,9 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
244 } 246 }
245#ifndef final_version 247#ifndef final_version
246 if ( !ancient && (inb(ioaddr+1) & 0x01) != (word16 & 0x01)) 248 if ( !ancient && (inb(ioaddr+1) & 0x01) != (word16 & 0x01))
247 printk("\nWD80?3: Bus width conflict, %d (probe) != %d (reg report).", 249 pr_cont("\nWD80?3: Bus width conflict, %d (probe) != %d (reg report).",
248 word16 ? 16 : 8, (inb(ioaddr+1) & 0x01) ? 16 : 8); 250 word16 ? 16 : 8,
251 (inb(ioaddr+1) & 0x01) ? 16 : 8);
249#endif 252#endif
250 } 253 }
251 254
@@ -259,7 +262,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
259 if (reg0 == 0xff || reg0 == 0) { 262 if (reg0 == 0xff || reg0 == 0) {
260 /* Future plan: this could check a few likely locations first. */ 263 /* Future plan: this could check a few likely locations first. */
261 dev->mem_start = 0xd0000; 264 dev->mem_start = 0xd0000;
262 printk(" assigning address %#lx", dev->mem_start); 265 pr_cont(" assigning address %#lx", dev->mem_start);
263 } else { 266 } else {
264 int high_addr_bits = inb(ioaddr+WD_CMDREG5) & 0x1f; 267 int high_addr_bits = inb(ioaddr+WD_CMDREG5) & 0x1f;
265 /* Some boards don't have the register 5 -- it returns 0xff. */ 268 /* Some boards don't have the register 5 -- it returns 0xff. */
@@ -297,8 +300,8 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
297 300
298 outb_p(0x00, nic_addr+EN0_IMR); /* Mask all intrs. again. */ 301 outb_p(0x00, nic_addr+EN0_IMR); /* Mask all intrs. again. */
299 302
300 if (ei_debug > 2) 303 if (netif_msg_drv(ei_local))
301 printk(" autoirq is %d", dev->irq); 304 pr_cont(" autoirq is %d", dev->irq);
302 if (dev->irq < 2) 305 if (dev->irq < 2)
303 dev->irq = word16 ? 10 : 5; 306 dev->irq = word16 ? 10 : 5;
304 } else 307 } else
@@ -310,7 +313,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
310 share and the board will usually be enabled. */ 313 share and the board will usually be enabled. */
311 i = request_irq(dev->irq, ei_interrupt, 0, DRV_NAME, dev); 314 i = request_irq(dev->irq, ei_interrupt, 0, DRV_NAME, dev);
312 if (i) { 315 if (i) {
313 printk (" unable to get IRQ %d.\n", dev->irq); 316 pr_cont(" unable to get IRQ %d.\n", dev->irq);
314 return i; 317 return i;
315 } 318 }
316 319
@@ -338,8 +341,8 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
338 return -ENOMEM; 341 return -ENOMEM;
339 } 342 }
340 343
341 printk(" %s, IRQ %d, shared memory at %#lx-%#lx.\n", 344 pr_cont(" %s, IRQ %d, shared memory at %#lx-%#lx.\n",
342 model_name, dev->irq, dev->mem_start, dev->mem_end-1); 345 model_name, dev->irq, dev->mem_start, dev->mem_end-1);
343 346
344 ei_status.reset_8390 = wd_reset_8390; 347 ei_status.reset_8390 = wd_reset_8390;
345 ei_status.block_input = wd_block_input; 348 ei_status.block_input = wd_block_input;
@@ -348,6 +351,7 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
348 351
349 dev->netdev_ops = &wd_netdev_ops; 352 dev->netdev_ops = &wd_netdev_ops;
350 NS8390_init(dev, 0); 353 NS8390_init(dev, 0);
354 ei_local->msg_enable = wd_msg_enable;
351 355
352#if 1 356#if 1
353 /* Enable interrupt generation on softconfig cards -- M.U */ 357 /* Enable interrupt generation on softconfig cards -- M.U */
@@ -385,9 +389,11 @@ static void
385wd_reset_8390(struct net_device *dev) 389wd_reset_8390(struct net_device *dev)
386{ 390{
387 int wd_cmd_port = dev->base_addr - WD_NIC_OFFSET; /* WD_CMDREG */ 391 int wd_cmd_port = dev->base_addr - WD_NIC_OFFSET; /* WD_CMDREG */
392 struct ei_device *ei_local = netdev_priv(dev);
388 393
389 outb(WD_RESET, wd_cmd_port); 394 outb(WD_RESET, wd_cmd_port);
390 if (ei_debug > 1) printk("resetting the WD80x3 t=%lu...", jiffies); 395 netif_dbg(ei_local, hw, dev, "resetting the WD80x3 t=%lu...\n",
396 jiffies);
391 ei_status.txing = 0; 397 ei_status.txing = 0;
392 398
393 /* Set up the ASIC registers, just in case something changed them. */ 399 /* Set up the ASIC registers, just in case something changed them. */
@@ -395,7 +401,7 @@ wd_reset_8390(struct net_device *dev)
395 if (ei_status.word16) 401 if (ei_status.word16)
396 outb(NIC16 | ((dev->mem_start>>19) & 0x1f), wd_cmd_port+WD_CMDREG5); 402 outb(NIC16 | ((dev->mem_start>>19) & 0x1f), wd_cmd_port+WD_CMDREG5);
397 403
398 if (ei_debug > 1) printk("reset done\n"); 404 netif_dbg(ei_local, hw, dev, "reset done\n");
399} 405}
400 406
401/* Grab the 8390 specific header. Similar to the block_input routine, but 407/* Grab the 8390 specific header. Similar to the block_input routine, but
@@ -474,9 +480,9 @@ static int
474wd_close(struct net_device *dev) 480wd_close(struct net_device *dev)
475{ 481{
476 int wd_cmdreg = dev->base_addr - WD_NIC_OFFSET; /* WD_CMDREG */ 482 int wd_cmdreg = dev->base_addr - WD_NIC_OFFSET; /* WD_CMDREG */
483 struct ei_device *ei_local = netdev_priv(dev);
477 484
478 if (ei_debug > 1) 485 netif_dbg(ei_local, ifdown, dev, "Shutting down ethercard.\n");
479 printk("%s: Shutting down ethercard.\n", dev->name);
480 ei_close(dev); 486 ei_close(dev);
481 487
482 /* Change from 16-bit to 8-bit shared memory so reboot works. */ 488 /* Change from 16-bit to 8-bit shared memory so reboot works. */
@@ -502,10 +508,12 @@ module_param_array(io, int, NULL, 0);
502module_param_array(irq, int, NULL, 0); 508module_param_array(irq, int, NULL, 0);
503module_param_array(mem, int, NULL, 0); 509module_param_array(mem, int, NULL, 0);
504module_param_array(mem_end, int, NULL, 0); 510module_param_array(mem_end, int, NULL, 0);
511module_param_named(msg_enable, wd_msg_enable, uint, (S_IRUSR|S_IRGRP|S_IROTH));
505MODULE_PARM_DESC(io, "I/O base address(es)"); 512MODULE_PARM_DESC(io, "I/O base address(es)");
506MODULE_PARM_DESC(irq, "IRQ number(s) (ignored for PureData boards)"); 513MODULE_PARM_DESC(irq, "IRQ number(s) (ignored for PureData boards)");
507MODULE_PARM_DESC(mem, "memory base address(es)(ignored for PureData boards)"); 514MODULE_PARM_DESC(mem, "memory base address(es)(ignored for PureData boards)");
508MODULE_PARM_DESC(mem_end, "memory end address(es)"); 515MODULE_PARM_DESC(mem_end, "memory end address(es)");
516MODULE_PARM_DESC(msg_enable, "Debug message level (see linux/netdevice.h for bitmap)");
509MODULE_DESCRIPTION("ISA Western Digital wd8003/wd8013 ; SMC Elite, Elite16 ethernet driver"); 517MODULE_DESCRIPTION("ISA Western Digital wd8003/wd8013 ; SMC Elite, Elite16 ethernet driver");
510MODULE_LICENSE("GPL"); 518MODULE_LICENSE("GPL");
511 519