aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ni5010.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ni5010.c')
-rw-r--r--drivers/net/ni5010.c170
1 files changed, 83 insertions, 87 deletions
diff --git a/drivers/net/ni5010.c b/drivers/net/ni5010.c
index a68bf474f6ed..383c690eefec 100644
--- a/drivers/net/ni5010.c
+++ b/drivers/net/ni5010.c
@@ -1,17 +1,12 @@
1/* ni5010.c: A network driver for the MiCom-Interlan NI5010 ethercard. 1/* ni5010.c: A network driver for the MiCom-Interlan NI5010 ethercard.
2 * 2 *
3 * Copyright 1996,1997 Jan-Pascal van Best and Andreas Mohr. 3 * Copyright 1996,1997,2006 Jan-Pascal van Best and Andreas Mohr.
4 * 4 *
5 * This software may be used and distributed according to the terms 5 * This software may be used and distributed according to the terms
6 * of the GNU General Public License, incorporated herein by reference. 6 * of the GNU General Public License, incorporated herein by reference.
7 * 7 *
8 * The authors may be reached as: 8 * The authors may be reached as:
9 * jvbest@wi.leidenuniv.nl a.mohr@mailto.de 9 * janpascal@vanbest.org andi@lisas.de
10 * or by snail mail as
11 * Jan-Pascal van Best Andreas Mohr
12 * Klikspaanweg 58-4 Stauferstr. 6
13 * 2324 LZ Leiden D-71272 Renningen
14 * The Netherlands Germany
15 * 10 *
16 * Sources: 11 * Sources:
17 * Donald Becker's "skeleton.c" 12 * Donald Becker's "skeleton.c"
@@ -27,8 +22,9 @@
27 * 970503 v0.93: Fixed auto-irq failure on warm reboot (JB) 22 * 970503 v0.93: Fixed auto-irq failure on warm reboot (JB)
28 * 970623 v1.00: First kernel version (AM) 23 * 970623 v1.00: First kernel version (AM)
29 * 970814 v1.01: Added detection of onboard receive buffer size (AM) 24 * 970814 v1.01: Added detection of onboard receive buffer size (AM)
25 * 060611 v1.02: slight cleanup: email addresses, driver modernization.
30 * Bugs: 26 * Bugs:
31 * - None known... 27 * - not SMP-safe (no locking of I/O accesses)
32 * - Note that you have to patch ifconfig for the new /proc/net/dev 28 * - Note that you have to patch ifconfig for the new /proc/net/dev
33 * format. It gives incorrect stats otherwise. 29 * format. It gives incorrect stats otherwise.
34 * 30 *
@@ -39,15 +35,15 @@
39 * Complete merge with Andreas' driver 35 * Complete merge with Andreas' driver
40 * Implement ring buffers (Is this useful? You can't squeeze 36 * Implement ring buffers (Is this useful? You can't squeeze
41 * too many packet in a 2k buffer!) 37 * too many packet in a 2k buffer!)
42 * Implement DMA (Again, is this useful? Some docs says DMA is 38 * Implement DMA (Again, is this useful? Some docs say DMA is
43 * slower than programmed I/O) 39 * slower than programmed I/O)
44 * 40 *
45 * Compile with: 41 * Compile with:
46 * gcc -O2 -fomit-frame-pointer -m486 -D__KERNEL__ \ 42 * gcc -O2 -fomit-frame-pointer -m486 -D__KERNEL__ \
47 * -DMODULE -c ni5010.c 43 * -DMODULE -c ni5010.c
48 * 44 *
49 * Insert with e.g.: 45 * Insert with e.g.:
50 * insmod ni5010.o io=0x300 irq=5 46 * insmod ni5010.ko io=0x300 irq=5
51 */ 47 */
52 48
53#include <linux/module.h> 49#include <linux/module.h>
@@ -69,15 +65,15 @@
69 65
70#include "ni5010.h" 66#include "ni5010.h"
71 67
72static const char *boardname = "NI5010"; 68static const char boardname[] = "NI5010";
73static char *version = 69static char version[] __initdata =
74 "ni5010.c: v1.00 06/23/97 Jan-Pascal van Best and Andreas Mohr\n"; 70 "ni5010.c: v1.02 20060611 Jan-Pascal van Best and Andreas Mohr\n";
75 71
76/* bufsize_rcv == 0 means autoprobing */ 72/* bufsize_rcv == 0 means autoprobing */
77static unsigned int bufsize_rcv; 73static unsigned int bufsize_rcv;
78 74
79#define jumpered_interrupts /* IRQ line jumpered on board */ 75#define JUMPERED_INTERRUPTS /* IRQ line jumpered on board */
80#undef jumpered_dma /* No DMA used */ 76#undef JUMPERED_DMA /* No DMA used */
81#undef FULL_IODETECT /* Only detect in portlist */ 77#undef FULL_IODETECT /* Only detect in portlist */
82 78
83#ifndef FULL_IODETECT 79#ifndef FULL_IODETECT
@@ -232,7 +228,7 @@ static int __init ni5010_probe1(struct net_device *dev, int ioaddr)
232 * - Andreas 228 * - Andreas
233 */ 229 */
234 230
235 PRINTK2((KERN_DEBUG "%s: entering ni5010_probe1(%#3x)\n", 231 PRINTK2((KERN_DEBUG "%s: entering ni5010_probe1(%#3x)\n",
236 dev->name, ioaddr)); 232 dev->name, ioaddr));
237 233
238 if (inb(ioaddr+0) == 0xff) 234 if (inb(ioaddr+0) == 0xff)
@@ -281,7 +277,7 @@ static int __init ni5010_probe1(struct net_device *dev, int ioaddr)
281 277
282 PRINTK2((KERN_DEBUG "%s: I/O #4 passed!\n", dev->name)); 278 PRINTK2((KERN_DEBUG "%s: I/O #4 passed!\n", dev->name));
283 279
284#ifdef jumpered_interrupts 280#ifdef JUMPERED_INTERRUPTS
285 if (dev->irq == 0xff) 281 if (dev->irq == 0xff)
286 ; 282 ;
287 else if (dev->irq < 2) { 283 else if (dev->irq < 2) {
@@ -305,7 +301,7 @@ static int __init ni5010_probe1(struct net_device *dev, int ioaddr)
305 } else if (dev->irq == 2) { 301 } else if (dev->irq == 2) {
306 dev->irq = 9; 302 dev->irq = 9;
307 } 303 }
308#endif /* jumpered_irq */ 304#endif /* JUMPERED_INTERRUPTS */
309 PRINTK2((KERN_DEBUG "%s: I/O #9 passed!\n", dev->name)); 305 PRINTK2((KERN_DEBUG "%s: I/O #9 passed!\n", dev->name));
310 306
311 /* DMA is not supported (yet?), so no use detecting it */ 307 /* DMA is not supported (yet?), so no use detecting it */
@@ -334,9 +330,9 @@ static int __init ni5010_probe1(struct net_device *dev, int ioaddr)
334 outw(0, IE_GP); /* Point GP at start of packet */ 330 outw(0, IE_GP); /* Point GP at start of packet */
335 outb(0, IE_RBUF); /* set buffer byte 0 to 0 again */ 331 outb(0, IE_RBUF); /* set buffer byte 0 to 0 again */
336 } 332 }
337 printk("// bufsize rcv/xmt=%d/%d\n", bufsize_rcv, NI5010_BUFSIZE); 333 printk("-> bufsize rcv/xmt=%d/%d\n", bufsize_rcv, NI5010_BUFSIZE);
338 memset(dev->priv, 0, sizeof(struct ni5010_local)); 334 memset(dev->priv, 0, sizeof(struct ni5010_local));
339 335
340 dev->open = ni5010_open; 336 dev->open = ni5010_open;
341 dev->stop = ni5010_close; 337 dev->stop = ni5010_close;
342 dev->hard_start_xmit = ni5010_send_packet; 338 dev->hard_start_xmit = ni5010_send_packet;
@@ -354,33 +350,31 @@ static int __init ni5010_probe1(struct net_device *dev, int ioaddr)
354 outb(0xff, EDLC_XCLR); /* Kill all pending xmt interrupts */ 350 outb(0xff, EDLC_XCLR); /* Kill all pending xmt interrupts */
355 351
356 printk(KERN_INFO "%s: NI5010 found at 0x%x, using IRQ %d", dev->name, ioaddr, dev->irq); 352 printk(KERN_INFO "%s: NI5010 found at 0x%x, using IRQ %d", dev->name, ioaddr, dev->irq);
357 if (dev->dma) printk(" & DMA %d", dev->dma); 353 if (dev->dma)
354 printk(" & DMA %d", dev->dma);
358 printk(".\n"); 355 printk(".\n");
359
360 printk(KERN_INFO "Join the NI5010 driver development team!\n");
361 printk(KERN_INFO "Mail to a.mohr@mailto.de or jvbest@wi.leidenuniv.nl\n");
362 return 0; 356 return 0;
363out: 357out:
364 release_region(dev->base_addr, NI5010_IO_EXTENT); 358 release_region(dev->base_addr, NI5010_IO_EXTENT);
365 return err; 359 return err;
366} 360}
367 361
368/* 362/*
369 * Open/initialize the board. This is called (in the current kernel) 363 * Open/initialize the board. This is called (in the current kernel)
370 * sometime after booting when the 'ifconfig' program is run. 364 * sometime after booting when the 'ifconfig' program is run.
371 * 365 *
372 * This routine should set everything up anew at each open, even 366 * This routine should set everything up anew at each open, even
373 * registers that "should" only need to be set once at boot, so that 367 * registers that "should" only need to be set once at boot, so that
374 * there is non-reboot way to recover if something goes wrong. 368 * there is a non-reboot way to recover if something goes wrong.
375 */ 369 */
376 370
377static int ni5010_open(struct net_device *dev) 371static int ni5010_open(struct net_device *dev)
378{ 372{
379 int ioaddr = dev->base_addr; 373 int ioaddr = dev->base_addr;
380 int i; 374 int i;
381 375
382 PRINTK2((KERN_DEBUG "%s: entering ni5010_open()\n", dev->name)); 376 PRINTK2((KERN_DEBUG "%s: entering ni5010_open()\n", dev->name));
383 377
384 if (request_irq(dev->irq, &ni5010_interrupt, 0, boardname, dev)) { 378 if (request_irq(dev->irq, &ni5010_interrupt, 0, boardname, dev)) {
385 printk(KERN_WARNING "%s: Cannot get irq %#2x\n", dev->name, dev->irq); 379 printk(KERN_WARNING "%s: Cannot get irq %#2x\n", dev->name, dev->irq);
386 return -EAGAIN; 380 return -EAGAIN;
@@ -390,13 +384,13 @@ static int ni5010_open(struct net_device *dev)
390 * Always allocate the DMA channel after the IRQ, 384 * Always allocate the DMA channel after the IRQ,
391 * and clean up on failure. 385 * and clean up on failure.
392 */ 386 */
393#ifdef jumpered_dma 387#ifdef JUMPERED_DMA
394 if (request_dma(dev->dma, cardname)) { 388 if (request_dma(dev->dma, cardname)) {
395 printk(KERN_WARNING "%s: Cannot get dma %#2x\n", dev->name, dev->dma); 389 printk(KERN_WARNING "%s: Cannot get dma %#2x\n", dev->name, dev->dma);
396 free_irq(dev->irq, NULL); 390 free_irq(dev->irq, NULL);
397 return -EAGAIN; 391 return -EAGAIN;
398 } 392 }
399#endif /* jumpered_dma */ 393#endif /* JUMPERED_DMA */
400 394
401 PRINTK3((KERN_DEBUG "%s: passed open() #2\n", dev->name)); 395 PRINTK3((KERN_DEBUG "%s: passed open() #2\n", dev->name));
402 /* Reset the hardware here. Don't forget to set the station address. */ 396 /* Reset the hardware here. Don't forget to set the station address. */
@@ -410,21 +404,21 @@ static int ni5010_open(struct net_device *dev)
410 for(i = 0;i < 6; i++) { 404 for(i = 0;i < 6; i++) {
411 outb(dev->dev_addr[i], EDLC_ADDR + i); 405 outb(dev->dev_addr[i], EDLC_ADDR + i);
412 } 406 }
413 407
414 PRINTK3((KERN_DEBUG "%s: Initialising ni5010\n", dev->name)); 408 PRINTK3((KERN_DEBUG "%s: Initialising ni5010\n", dev->name));
415 outb(0, EDLC_XMASK); /* No xmit interrupts for now */ 409 outb(0, EDLC_XMASK); /* No xmit interrupts for now */
416 outb(XMD_IG_PAR | XMD_T_MODE | XMD_LBC, EDLC_XMODE); 410 outb(XMD_IG_PAR | XMD_T_MODE | XMD_LBC, EDLC_XMODE);
417 /* Normal packet xmit mode */ 411 /* Normal packet xmit mode */
418 outb(0xff, EDLC_XCLR); /* Clear all pending xmit interrupts */ 412 outb(0xff, EDLC_XCLR); /* Clear all pending xmit interrupts */
419 outb(RMD_BROADCAST, EDLC_RMODE); 413 outb(RMD_BROADCAST, EDLC_RMODE);
420 /* Receive broadcast and normal packets */ 414 /* Receive broadcast and normal packets */
421 reset_receiver(dev); /* Ready ni5010 for receiving packets */ 415 reset_receiver(dev); /* Ready ni5010 for receiving packets */
422 416
423 outb(0, EDLC_RESET); /* Un-reset the ni5010 */ 417 outb(0, EDLC_RESET); /* Un-reset the ni5010 */
424 418
425 netif_start_queue(dev); 419 netif_start_queue(dev);
426 420
427 if (NI5010_DEBUG) ni5010_show_registers(dev); 421 if (NI5010_DEBUG) ni5010_show_registers(dev);
428 422
429 PRINTK((KERN_DEBUG "%s: open successful\n", dev->name)); 423 PRINTK((KERN_DEBUG "%s: open successful\n", dev->name));
430 return 0; 424 return 0;
@@ -433,7 +427,7 @@ static int ni5010_open(struct net_device *dev)
433static void reset_receiver(struct net_device *dev) 427static void reset_receiver(struct net_device *dev)
434{ 428{
435 int ioaddr = dev->base_addr; 429 int ioaddr = dev->base_addr;
436 430
437 PRINTK3((KERN_DEBUG "%s: resetting receiver\n", dev->name)); 431 PRINTK3((KERN_DEBUG "%s: resetting receiver\n", dev->name));
438 outw(0, IE_GP); /* Receive packet at start of buffer */ 432 outw(0, IE_GP); /* Receive packet at start of buffer */
439 outb(0xff, EDLC_RCLR); /* Clear all pending rcv interrupts */ 433 outb(0xff, EDLC_RCLR); /* Clear all pending rcv interrupts */
@@ -459,10 +453,10 @@ static int ni5010_send_packet(struct sk_buff *skb, struct net_device *dev)
459 453
460 PRINTK2((KERN_DEBUG "%s: entering ni5010_send_packet\n", dev->name)); 454 PRINTK2((KERN_DEBUG "%s: entering ni5010_send_packet\n", dev->name));
461 455
462 /* 456 /*
463 * Block sending 457 * Block sending
464 */ 458 */
465 459
466 netif_stop_queue(dev); 460 netif_stop_queue(dev);
467 hardware_send_packet(dev, (unsigned char *)skb->data, skb->len, length-skb->len); 461 hardware_send_packet(dev, (unsigned char *)skb->data, skb->len, length-skb->len);
468 dev->trans_start = jiffies; 462 dev->trans_start = jiffies;
@@ -470,9 +464,9 @@ static int ni5010_send_packet(struct sk_buff *skb, struct net_device *dev)
470 return 0; 464 return 0;
471} 465}
472 466
473/* 467/*
474 * The typical workload of the driver: 468 * The typical workload of the driver:
475 * Handle the network interface interrupts. 469 * Handle the network interface interrupts.
476 */ 470 */
477static irqreturn_t ni5010_interrupt(int irq, void *dev_id, struct pt_regs *regs) 471static irqreturn_t ni5010_interrupt(int irq, void *dev_id, struct pt_regs *regs)
478{ 472{
@@ -485,11 +479,11 @@ static irqreturn_t ni5010_interrupt(int irq, void *dev_id, struct pt_regs *regs)
485 479
486 ioaddr = dev->base_addr; 480 ioaddr = dev->base_addr;
487 lp = netdev_priv(dev); 481 lp = netdev_priv(dev);
488 482
489 spin_lock(&lp->lock); 483 spin_lock(&lp->lock);
490 status = inb(IE_ISTAT); 484 status = inb(IE_ISTAT);
491 PRINTK3((KERN_DEBUG "%s: IE_ISTAT = %#02x\n", dev->name, status)); 485 PRINTK3((KERN_DEBUG "%s: IE_ISTAT = %#02x\n", dev->name, status));
492 486
493 if ((status & IS_R_INT) == 0) ni5010_rx(dev); 487 if ((status & IS_R_INT) == 0) ni5010_rx(dev);
494 488
495 if ((status & IS_X_INT) == 0) { 489 if ((status & IS_X_INT) == 0) {
@@ -501,8 +495,8 @@ static irqreturn_t ni5010_interrupt(int irq, void *dev_id, struct pt_regs *regs)
501 outb(0, IE_DMA_RST); /* Reset DMA int */ 495 outb(0, IE_DMA_RST); /* Reset DMA int */
502 } 496 }
503 497
504 if (!xmit_was_error) 498 if (!xmit_was_error)
505 reset_receiver(dev); 499 reset_receiver(dev);
506 spin_unlock(&lp->lock); 500 spin_unlock(&lp->lock);
507 return IRQ_HANDLED; 501 return IRQ_HANDLED;
508} 502}
@@ -511,7 +505,7 @@ static irqreturn_t ni5010_interrupt(int irq, void *dev_id, struct pt_regs *regs)
511static void dump_packet(void *buf, int len) 505static void dump_packet(void *buf, int len)
512{ 506{
513 int i; 507 int i;
514 508
515 printk(KERN_DEBUG "Packet length = %#4x\n", len); 509 printk(KERN_DEBUG "Packet length = %#4x\n", len);
516 for (i = 0; i < len; i++){ 510 for (i = 0; i < len; i++){
517 if (i % 16 == 0) printk(KERN_DEBUG "%#4.4x", i); 511 if (i % 16 == 0) printk(KERN_DEBUG "%#4.4x", i);
@@ -520,7 +514,7 @@ static void dump_packet(void *buf, int len)
520 if (i % 16 == 15) printk("\n"); 514 if (i % 16 == 15) printk("\n");
521 } 515 }
522 printk("\n"); 516 printk("\n");
523 517
524 return; 518 return;
525} 519}
526 520
@@ -532,12 +526,12 @@ static void ni5010_rx(struct net_device *dev)
532 unsigned char rcv_stat; 526 unsigned char rcv_stat;
533 struct sk_buff *skb; 527 struct sk_buff *skb;
534 int i_pkt_size; 528 int i_pkt_size;
535 529
536 PRINTK2((KERN_DEBUG "%s: entering ni5010_rx()\n", dev->name)); 530 PRINTK2((KERN_DEBUG "%s: entering ni5010_rx()\n", dev->name));
537 531
538 rcv_stat = inb(EDLC_RSTAT); 532 rcv_stat = inb(EDLC_RSTAT);
539 PRINTK3((KERN_DEBUG "%s: EDLC_RSTAT = %#2x\n", dev->name, rcv_stat)); 533 PRINTK3((KERN_DEBUG "%s: EDLC_RSTAT = %#2x\n", dev->name, rcv_stat));
540 534
541 if ( (rcv_stat & RS_VALID_BITS) != RS_PKT_OK) { 535 if ( (rcv_stat & RS_VALID_BITS) != RS_PKT_OK) {
542 PRINTK((KERN_INFO "%s: receive error.\n", dev->name)); 536 PRINTK((KERN_INFO "%s: receive error.\n", dev->name));
543 lp->stats.rx_errors++; 537 lp->stats.rx_errors++;
@@ -548,12 +542,12 @@ static void ni5010_rx(struct net_device *dev)
548 outb(0xff, EDLC_RCLR); /* Clear the interrupt */ 542 outb(0xff, EDLC_RCLR); /* Clear the interrupt */
549 return; 543 return;
550 } 544 }
551 545
552 outb(0xff, EDLC_RCLR); /* Clear the interrupt */ 546 outb(0xff, EDLC_RCLR); /* Clear the interrupt */
553 547
554 i_pkt_size = inw(IE_RCNT); 548 i_pkt_size = inw(IE_RCNT);
555 if (i_pkt_size > ETH_FRAME_LEN || i_pkt_size < 10 ) { 549 if (i_pkt_size > ETH_FRAME_LEN || i_pkt_size < 10 ) {
556 PRINTK((KERN_DEBUG "%s: Packet size error, packet size = %#4.4x\n", 550 PRINTK((KERN_DEBUG "%s: Packet size error, packet size = %#4.4x\n",
557 dev->name, i_pkt_size)); 551 dev->name, i_pkt_size));
558 lp->stats.rx_errors++; 552 lp->stats.rx_errors++;
559 lp->stats.rx_length_errors++; 553 lp->stats.rx_length_errors++;
@@ -567,27 +561,27 @@ static void ni5010_rx(struct net_device *dev)
567 lp->stats.rx_dropped++; 561 lp->stats.rx_dropped++;
568 return; 562 return;
569 } 563 }
570 564
571 skb->dev = dev; 565 skb->dev = dev;
572 skb_reserve(skb, 2); 566 skb_reserve(skb, 2);
573 567
574 /* Read packet into buffer */ 568 /* Read packet into buffer */
575 outb(MM_MUX, IE_MMODE); /* Rcv buffer to system bus */ 569 outb(MM_MUX, IE_MMODE); /* Rcv buffer to system bus */
576 outw(0, IE_GP); /* Seek to beginning of packet */ 570 outw(0, IE_GP); /* Seek to beginning of packet */
577 insb(IE_RBUF, skb_put(skb, i_pkt_size), i_pkt_size); 571 insb(IE_RBUF, skb_put(skb, i_pkt_size), i_pkt_size);
578 572
579 if (NI5010_DEBUG >= 4) 573 if (NI5010_DEBUG >= 4)
580 dump_packet(skb->data, skb->len); 574 dump_packet(skb->data, skb->len);
581 575
582 skb->protocol = eth_type_trans(skb,dev); 576 skb->protocol = eth_type_trans(skb,dev);
583 netif_rx(skb); 577 netif_rx(skb);
584 dev->last_rx = jiffies; 578 dev->last_rx = jiffies;
585 lp->stats.rx_packets++; 579 lp->stats.rx_packets++;
586 lp->stats.rx_bytes += i_pkt_size; 580 lp->stats.rx_bytes += i_pkt_size;
587 581
588 PRINTK2((KERN_DEBUG "%s: Received packet, size=%#4.4x\n", 582 PRINTK2((KERN_DEBUG "%s: Received packet, size=%#4.4x\n",
589 dev->name, i_pkt_size)); 583 dev->name, i_pkt_size));
590 584
591} 585}
592 586
593static int process_xmt_interrupt(struct net_device *dev) 587static int process_xmt_interrupt(struct net_device *dev)
@@ -600,12 +594,12 @@ static int process_xmt_interrupt(struct net_device *dev)
600 594
601 xmit_stat = inb(EDLC_XSTAT); 595 xmit_stat = inb(EDLC_XSTAT);
602 PRINTK3((KERN_DEBUG "%s: EDLC_XSTAT = %2.2x\n", dev->name, xmit_stat)); 596 PRINTK3((KERN_DEBUG "%s: EDLC_XSTAT = %2.2x\n", dev->name, xmit_stat));
603 597
604 outb(0, EDLC_XMASK); /* Disable xmit IRQ's */ 598 outb(0, EDLC_XMASK); /* Disable xmit IRQ's */
605 outb(0xff, EDLC_XCLR); /* Clear all pending xmit IRQ's */ 599 outb(0xff, EDLC_XCLR); /* Clear all pending xmit IRQ's */
606 600
607 if (xmit_stat & XS_COLL){ 601 if (xmit_stat & XS_COLL){
608 PRINTK((KERN_DEBUG "%s: collision detected, retransmitting\n", 602 PRINTK((KERN_DEBUG "%s: collision detected, retransmitting\n",
609 dev->name)); 603 dev->name));
610 outw(NI5010_BUFSIZE - lp->o_pkt_size, IE_GP); 604 outw(NI5010_BUFSIZE - lp->o_pkt_size, IE_GP);
611 /* outb(0, IE_MMODE); */ /* xmt buf on sysbus FIXME: needed ? */ 605 /* outb(0, IE_MMODE); */ /* xmt buf on sysbus FIXME: needed ? */
@@ -620,8 +614,8 @@ static int process_xmt_interrupt(struct net_device *dev)
620 lp->stats.tx_packets++; 614 lp->stats.tx_packets++;
621 lp->stats.tx_bytes += lp->o_pkt_size; 615 lp->stats.tx_bytes += lp->o_pkt_size;
622 netif_wake_queue(dev); 616 netif_wake_queue(dev);
623 617
624 PRINTK2((KERN_DEBUG "%s: sent packet, size=%#4.4x\n", 618 PRINTK2((KERN_DEBUG "%s: sent packet, size=%#4.4x\n",
625 dev->name, lp->o_pkt_size)); 619 dev->name, lp->o_pkt_size));
626 620
627 return 0; 621 return 0;
@@ -633,7 +627,7 @@ static int ni5010_close(struct net_device *dev)
633 int ioaddr = dev->base_addr; 627 int ioaddr = dev->base_addr;
634 628
635 PRINTK2((KERN_DEBUG "%s: entering ni5010_close\n", dev->name)); 629 PRINTK2((KERN_DEBUG "%s: entering ni5010_close\n", dev->name));
636#ifdef jumpered_interrupts 630#ifdef JUMPERED_INTERRUPTS
637 free_irq(dev->irq, NULL); 631 free_irq(dev->irq, NULL);
638#endif 632#endif
639 /* Put card in held-RESET state */ 633 /* Put card in held-RESET state */
@@ -641,7 +635,7 @@ static int ni5010_close(struct net_device *dev)
641 outb(RS_RESET, EDLC_RESET); 635 outb(RS_RESET, EDLC_RESET);
642 636
643 netif_stop_queue(dev); 637 netif_stop_queue(dev);
644 638
645 PRINTK((KERN_DEBUG "%s: %s closed down\n", dev->name, boardname)); 639 PRINTK((KERN_DEBUG "%s: %s closed down\n", dev->name, boardname));
646 return 0; 640 return 0;
647 641
@@ -654,9 +648,9 @@ static struct net_device_stats *ni5010_get_stats(struct net_device *dev)
654 struct ni5010_local *lp = netdev_priv(dev); 648 struct ni5010_local *lp = netdev_priv(dev);
655 649
656 PRINTK2((KERN_DEBUG "%s: entering ni5010_get_stats\n", dev->name)); 650 PRINTK2((KERN_DEBUG "%s: entering ni5010_get_stats\n", dev->name));
657 651
658 if (NI5010_DEBUG) ni5010_show_registers(dev); 652 if (NI5010_DEBUG) ni5010_show_registers(dev);
659 653
660 /* cli(); */ 654 /* cli(); */
661 /* Update the statistics from the device registers. */ 655 /* Update the statistics from the device registers. */
662 /* We do this in the interrupt handler */ 656 /* We do this in the interrupt handler */
@@ -673,7 +667,7 @@ static struct net_device_stats *ni5010_get_stats(struct net_device *dev)
673*/ 667*/
674static void ni5010_set_multicast_list(struct net_device *dev) 668static void ni5010_set_multicast_list(struct net_device *dev)
675{ 669{
676 short ioaddr = dev->base_addr; 670 short ioaddr = dev->base_addr;
677 671
678 PRINTK2((KERN_DEBUG "%s: entering set_multicast_list\n", dev->name)); 672 PRINTK2((KERN_DEBUG "%s: entering set_multicast_list\n", dev->name));
679 673
@@ -699,7 +693,7 @@ static void hardware_send_packet(struct net_device *dev, char *buf, int length,
699 unsigned int buf_offs; 693 unsigned int buf_offs;
700 694
701 PRINTK2((KERN_DEBUG "%s: entering hardware_send_packet\n", dev->name)); 695 PRINTK2((KERN_DEBUG "%s: entering hardware_send_packet\n", dev->name));
702 696
703 if (length > ETH_FRAME_LEN) { 697 if (length > ETH_FRAME_LEN) {
704 PRINTK((KERN_WARNING "%s: packet too large, not possible\n", 698 PRINTK((KERN_WARNING "%s: packet too large, not possible\n",
705 dev->name)); 699 dev->name));
@@ -709,11 +703,11 @@ static void hardware_send_packet(struct net_device *dev, char *buf, int length,
709 if (NI5010_DEBUG) ni5010_show_registers(dev); 703 if (NI5010_DEBUG) ni5010_show_registers(dev);
710 704
711 if (inb(IE_ISTAT) & IS_EN_XMT) { 705 if (inb(IE_ISTAT) & IS_EN_XMT) {
712 PRINTK((KERN_WARNING "%s: sending packet while already transmitting, not possible\n", 706 PRINTK((KERN_WARNING "%s: sending packet while already transmitting, not possible\n",
713 dev->name)); 707 dev->name));
714 return; 708 return;
715 } 709 }
716 710
717 if (NI5010_DEBUG > 3) dump_packet(buf, length); 711 if (NI5010_DEBUG > 3) dump_packet(buf, length);
718 712
719 buf_offs = NI5010_BUFSIZE - length - pad; 713 buf_offs = NI5010_BUFSIZE - length - pad;
@@ -729,7 +723,7 @@ static void hardware_send_packet(struct net_device *dev, char *buf, int length,
729 outsb(IE_XBUF, buf, length); /* Put data in buffer */ 723 outsb(IE_XBUF, buf, length); /* Put data in buffer */
730 while(pad--) 724 while(pad--)
731 outb(0, IE_XBUF); 725 outb(0, IE_XBUF);
732 726
733 outw(buf_offs, IE_GP); /* Rewrite where packet starts */ 727 outw(buf_offs, IE_GP); /* Rewrite where packet starts */
734 728
735 /* should work without that outb() (Crynwr used it) */ 729 /* should work without that outb() (Crynwr used it) */
@@ -740,8 +734,8 @@ static void hardware_send_packet(struct net_device *dev, char *buf, int length,
740 spin_unlock_irqrestore(&lp->lock, flags); 734 spin_unlock_irqrestore(&lp->lock, flags);
741 735
742 netif_wake_queue(dev); 736 netif_wake_queue(dev);
743 737
744 if (NI5010_DEBUG) ni5010_show_registers(dev); 738 if (NI5010_DEBUG) ni5010_show_registers(dev);
745} 739}
746 740
747static void chipset_init(struct net_device *dev, int startp) 741static void chipset_init(struct net_device *dev, int startp)
@@ -753,7 +747,7 @@ static void chipset_init(struct net_device *dev, int startp)
753static void ni5010_show_registers(struct net_device *dev) 747static void ni5010_show_registers(struct net_device *dev)
754{ 748{
755 int ioaddr = dev->base_addr; 749 int ioaddr = dev->base_addr;
756 750
757 PRINTK3((KERN_DEBUG "%s: XSTAT %#2.2x\n", dev->name, inb(EDLC_XSTAT))); 751 PRINTK3((KERN_DEBUG "%s: XSTAT %#2.2x\n", dev->name, inb(EDLC_XSTAT)));
758 PRINTK3((KERN_DEBUG "%s: XMASK %#2.2x\n", dev->name, inb(EDLC_XMASK))); 752 PRINTK3((KERN_DEBUG "%s: XMASK %#2.2x\n", dev->name, inb(EDLC_XMASK)));
759 PRINTK3((KERN_DEBUG "%s: RSTAT %#2.2x\n", dev->name, inb(EDLC_RSTAT))); 753 PRINTK3((KERN_DEBUG "%s: RSTAT %#2.2x\n", dev->name, inb(EDLC_RSTAT)));
@@ -771,7 +765,7 @@ module_param(irq, int, 0);
771MODULE_PARM_DESC(io, "ni5010 I/O base address"); 765MODULE_PARM_DESC(io, "ni5010 I/O base address");
772MODULE_PARM_DESC(irq, "ni5010 IRQ number"); 766MODULE_PARM_DESC(irq, "ni5010 IRQ number");
773 767
774int init_module(void) 768static int __init ni5010_init_module(void)
775{ 769{
776 PRINTK2((KERN_DEBUG "%s: entering init_module\n", boardname)); 770 PRINTK2((KERN_DEBUG "%s: entering init_module\n", boardname));
777 /* 771 /*
@@ -792,13 +786,15 @@ int init_module(void)
792 return 0; 786 return 0;
793} 787}
794 788
795void cleanup_module(void) 789static void __exit ni5010_cleanup_module(void)
796{ 790{
797 PRINTK2((KERN_DEBUG "%s: entering cleanup_module\n", boardname)); 791 PRINTK2((KERN_DEBUG "%s: entering cleanup_module\n", boardname));
798 unregister_netdev(dev_ni5010); 792 unregister_netdev(dev_ni5010);
799 release_region(dev_ni5010->base_addr, NI5010_IO_EXTENT); 793 release_region(dev_ni5010->base_addr, NI5010_IO_EXTENT);
800 free_netdev(dev_ni5010); 794 free_netdev(dev_ni5010);
801} 795}
796module_init(ni5010_init_module);
797module_exit(ni5010_cleanup_module);
802#endif /* MODULE */ 798#endif /* MODULE */
803MODULE_LICENSE("GPL"); 799MODULE_LICENSE("GPL");
804 800