2 * madgemc.c: Driver for the Madge Smart 16/4 MC16 MCA token ring card.
4 * Written 2000 by Adam Fritzler
6 * This software may be used and distributed according to the terms
7 * of the GNU General Public License, incorporated herein by reference.
9 * This driver module supports the following cards:
10 * - Madge Smart 16/4 Ringnode MC16
11 * - Madge Smart 16/4 Ringnode MC32 (??)
14 * AF Adam Fritzler mid@auk.cx
16 * Modification History:
17 * 16-Jan-00 AF Created
20 static const char version
[] = "madgemc.c: v0.91 23/01/2000 by Adam Fritzler\n";
22 #include <linux/module.h>
23 #include <linux/mca-legacy.h>
24 #include <linux/kernel.h>
25 #include <linux/errno.h>
26 #include <linux/pci.h>
27 #include <linux/init.h>
28 #include <linux/netdevice.h>
29 #include <linux/trdevice.h>
31 #include <asm/system.h>
36 #include "madgemc.h" /* Madge-specific constants */
38 #define MADGEMC_IO_EXTENT 32
39 #define MADGEMC_SIF_OFFSET 0x08
42 struct net_device
*dev
;
45 * These are read from the BIA ROM.
48 unsigned int cardtype
;
53 * These are read from the MCA POS registers.
55 unsigned int burstmode
:2;
56 unsigned int fairness
:1; /* 0 = Fair, 1 = Unfair */
57 unsigned int arblevel
:4;
58 unsigned int ringspeed
:2; /* 0 = 4mb, 1 = 16, 2 = Auto/none */
59 unsigned int cabletype
:1; /* 0 = RJ45, 1 = DB9 */
61 struct madgemc_card
*next
;
63 static struct madgemc_card
*madgemc_card_list
;
66 static int madgemc_open(struct net_device
*dev
);
67 static int madgemc_close(struct net_device
*dev
);
68 static int madgemc_chipset_init(struct net_device
*dev
);
69 static void madgemc_read_rom(struct madgemc_card
*card
);
70 static unsigned short madgemc_setnselout_pins(struct net_device
*dev
);
71 static void madgemc_setcabletype(struct net_device
*dev
, int type
);
73 static int madgemc_mcaproc(char *buf
, int slot
, void *d
);
75 static void madgemc_setregpage(struct net_device
*dev
, int page
);
76 static void madgemc_setsifsel(struct net_device
*dev
, int val
);
77 static void madgemc_setint(struct net_device
*dev
, int val
);
79 static irqreturn_t
madgemc_interrupt(int irq
, void *dev_id
, struct pt_regs
*regs
);
82 * These work around paging, however they don't guarentee you're on the
85 #define SIFREADB(reg) (inb(dev->base_addr + ((reg<0x8)?reg:reg-0x8)))
86 #define SIFWRITEB(val, reg) (outb(val, dev->base_addr + ((reg<0x8)?reg:reg-0x8)))
87 #define SIFREADW(reg) (inw(dev->base_addr + ((reg<0x8)?reg:reg-0x8)))
88 #define SIFWRITEW(val, reg) (outw(val, dev->base_addr + ((reg<0x8)?reg:reg-0x8)))
91 * Read a byte-length value from the register.
93 static unsigned short madgemc_sifreadb(struct net_device
*dev
, unsigned short reg
)
99 madgemc_setregpage(dev
, 1);
101 madgemc_setregpage(dev
, 0);
107 * Write a byte-length value to a register.
109 static void madgemc_sifwriteb(struct net_device
*dev
, unsigned short val
, unsigned short reg
)
114 madgemc_setregpage(dev
, 1);
116 madgemc_setregpage(dev
, 0);
122 * Read a word-length value from a register
124 static unsigned short madgemc_sifreadw(struct net_device
*dev
, unsigned short reg
)
130 madgemc_setregpage(dev
, 1);
132 madgemc_setregpage(dev
, 0);
138 * Write a word-length value to a register.
140 static void madgemc_sifwritew(struct net_device
*dev
, unsigned short val
, unsigned short reg
)
145 madgemc_setregpage(dev
, 1);
147 madgemc_setregpage(dev
, 0);
154 static int __init
madgemc_probe(void)
156 static int versionprinted
;
157 struct net_device
*dev
;
158 struct net_local
*tp
;
159 struct madgemc_card
*card
;
166 while (slot
!= MCA_NOTFOUND
) {
168 * Currently we only support the MC16/32 (MCA ID 002d)
170 slot
= mca_find_unused_adapter(0x002d, slot
);
171 if (slot
== MCA_NOTFOUND
)
175 * If we get here, we have an adapter.
177 if (versionprinted
++ == 0)
178 printk("%s", version
);
180 dev
= alloc_trdev(sizeof(struct net_local
));
182 printk("madgemc: unable to allocate dev space\n");
183 if (madgemc_card_list
)
188 SET_MODULE_OWNER(dev
);
192 * Fetch MCA config registers
195 posreg
[i
] = mca_read_stored_pos(slot
, i
+2);
197 card
= kmalloc(sizeof(struct madgemc_card
), GFP_KERNEL
);
199 printk("madgemc: unable to allocate card struct\n");
201 if (madgemc_card_list
)
208 * Parse configuration information. This all comes
209 * directly from the publicly available @002d.ADF.
210 * Get it from Madge or your local ADF library.
216 dev
->base_addr
= 0x0a20 +
217 ((posreg
[2] & MC16_POS2_ADDR2
)?0x0400:0) +
218 ((posreg
[0] & MC16_POS0_ADDR1
)?0x1000:0) +
219 ((posreg
[3] & MC16_POS3_ADDR3
)?0x2000:0);
224 switch(posreg
[0] >> 6) { /* upper two bits */
225 case 0x1: dev
->irq
= 3; break;
226 case 0x2: dev
->irq
= 9; break; /* IRQ 2 = IRQ 9 */
227 case 0x3: dev
->irq
= 10; break;
228 default: dev
->irq
= 0; break;
232 printk("%s: invalid IRQ\n", dev
->name
);
236 if (!request_region(dev
->base_addr
, MADGEMC_IO_EXTENT
,
238 printk(KERN_INFO
"madgemc: unable to setup Smart MC in slot %d because of I/O base conflict at 0x%04lx\n", slot
, dev
->base_addr
);
239 dev
->base_addr
+= MADGEMC_SIF_OFFSET
;
242 dev
->base_addr
+= MADGEMC_SIF_OFFSET
;
247 card
->arblevel
= ((posreg
[0] >> 1) & 0x7) + 8;
250 * Burst mode and Fairness
252 card
->burstmode
= ((posreg
[2] >> 6) & 0x3);
253 card
->fairness
= ((posreg
[2] >> 4) & 0x1);
258 if ((posreg
[1] >> 2)&0x1)
259 card
->ringspeed
= 2; /* not selected */
260 else if ((posreg
[2] >> 5) & 0x1)
261 card
->ringspeed
= 1; /* 16Mb */
263 card
->ringspeed
= 0; /* 4Mb */
268 if ((posreg
[1] >> 6)&0x1)
269 card
->cabletype
= 1; /* STP/DB9 */
271 card
->cabletype
= 0; /* UTP/RJ-45 */
275 * ROM Info. This requires us to actually twiddle
276 * bits on the card, so we must ensure above that
277 * the base address is free of conflict (request_region above).
279 madgemc_read_rom(card
);
281 if (card
->manid
!= 0x4d) { /* something went wrong */
282 printk(KERN_INFO
"%s: Madge MC ROM read failed (unknown manufacturer ID %02x)\n", dev
->name
, card
->manid
);
286 if ((card
->cardtype
!= 0x08) && (card
->cardtype
!= 0x0d)) {
287 printk(KERN_INFO
"%s: Madge MC ROM read failed (unknown card ID %02x)\n", dev
->name
, card
->cardtype
);
291 /* All cards except Rev 0 and 1 MC16's have 256kb of RAM */
292 if ((card
->cardtype
== 0x08) && (card
->cardrev
<= 0x01))
297 printk("%s: %s Rev %d at 0x%04lx IRQ %d\n",
299 (card
->cardtype
== 0x08)?MADGEMC16_CARDNAME
:
300 MADGEMC32_CARDNAME
, card
->cardrev
,
301 dev
->base_addr
, dev
->irq
);
303 if (card
->cardtype
== 0x0d)
304 printk("%s: Warning: MC32 support is experimental and highly untested\n", dev
->name
);
306 if (card
->ringspeed
==2) { /* Unknown */
307 printk("%s: Warning: Ring speed not set in POS -- Please run the reference disk and set it!\n", dev
->name
);
308 card
->ringspeed
= 1; /* default to 16mb */
311 printk("%s: RAM Size: %dKB\n", dev
->name
, card
->ramsize
);
313 printk("%s: Ring Speed: %dMb/sec on %s\n", dev
->name
,
314 (card
->ringspeed
)?16:4,
315 card
->cabletype
?"STP/DB9":"UTP/RJ-45");
316 printk("%s: Arbitration Level: %d\n", dev
->name
,
319 printk("%s: Burst Mode: ", dev
->name
);
320 switch(card
->burstmode
) {
321 case 0: printk("Cycle steal"); break;
322 case 1: printk("Limited burst"); break;
323 case 2: printk("Delayed release"); break;
324 case 3: printk("Immediate release"); break;
326 printk(" (%s)\n", (card
->fairness
)?"Unfair":"Fair");
330 * Enable SIF before we assign the interrupt handler,
331 * just in case we get spurious interrupts that need
334 outb(0, dev
->base_addr
+ MC_CONTROL_REG0
); /* sanity */
335 madgemc_setsifsel(dev
, 1);
336 if (request_irq(dev
->irq
, madgemc_interrupt
, SA_SHIRQ
,
340 madgemc_chipset_init(dev
); /* enables interrupts! */
341 madgemc_setcabletype(dev
, card
->cabletype
);
343 /* Setup MCA structures */
344 mca_set_adapter_name(slot
, (card
->cardtype
== 0x08)?MADGEMC16_CARDNAME
:MADGEMC32_CARDNAME
);
345 mca_set_adapter_procfn(slot
, madgemc_mcaproc
, dev
);
346 mca_mark_as_used(slot
);
348 printk("%s: Ring Station Address: ", dev
->name
);
349 printk("%2.2x", dev
->dev_addr
[0]);
350 for (i
= 1; i
< 6; i
++)
351 printk(":%2.2x", dev
->dev_addr
[i
]);
354 /* XXX is ISA_MAX_ADDRESS correct here? */
355 if (tmsdev_init(dev
, ISA_MAX_ADDRESS
, NULL
)) {
356 printk("%s: unable to get memory for dev->priv.\n",
358 release_region(dev
->base_addr
-MADGEMC_SIF_OFFSET
,
364 if (madgemc_card_list
)
368 tp
= netdev_priv(dev
);
371 * The MC16 is physically a 32bit card. However, Madge
372 * insists on calling it 16bit, so I'll assume here that
373 * they know what they're talking about. Cut off DMA
376 tp
->setnselout
= madgemc_setnselout_pins
;
377 tp
->sifwriteb
= madgemc_sifwriteb
;
378 tp
->sifreadb
= madgemc_sifreadb
;
379 tp
->sifwritew
= madgemc_sifwritew
;
380 tp
->sifreadw
= madgemc_sifreadw
;
381 tp
->DataRate
= (card
->ringspeed
)?SPEED_16
:SPEED_4
;
383 memcpy(tp
->ProductID
, "Madge MCA 16/4 ", PROD_ID_SIZE
+ 1);
385 dev
->open
= madgemc_open
;
386 dev
->stop
= madgemc_close
;
388 if (register_netdev(dev
) == 0) {
389 /* Enlist in the card list */
390 card
->next
= madgemc_card_list
;
391 madgemc_card_list
= card
;
393 continue; /* successful, try to find another */
396 free_irq(dev
->irq
, dev
);
398 release_region(dev
->base_addr
-MADGEMC_SIF_OFFSET
,
406 if (madgemc_card_list
)
412 * Handle interrupts generated by the card
414 * The MicroChannel Madge cards need slightly more handling
415 * after an interrupt than other TMS380 cards do.
417 * First we must make sure it was this card that generated the
418 * interrupt (since interrupt sharing is allowed). Then,
419 * because we're using level-triggered interrupts (as is
420 * standard on MCA), we must toggle the interrupt line
421 * on the card in order to claim and acknowledge the interrupt.
422 * Once that is done, the interrupt should be handlable in
423 * the normal tms380tr_interrupt() routine.
425 * There's two ways we can check to see if the interrupt is ours,
426 * both with their own disadvantages...
428 * 1) Read in the SIFSTS register from the TMS controller. This
429 * is guarenteed to be accurate, however, there's a fairly
430 * large performance penalty for doing so: the Madge chips
431 * must request the register from the Eagle, the Eagle must
432 * read them from its internal bus, and then take the route
433 * back out again, for a 16bit read.
435 * 2) Use the MC_CONTROL_REG0_SINTR bit from the Madge ASICs.
436 * The major disadvantage here is that the accuracy of the
437 * bit is in question. However, it cuts out the extra read
438 * cycles it takes to read the Eagle's SIF, as its only an
439 * 8bit read, and theoretically the Madge bit is directly
440 * connected to the interrupt latch coming out of the Eagle
441 * hardware (that statement is not verified).
443 * I can't determine which of these methods has the best win. For now,
444 * we make a compromise. Use the Madge way for the first interrupt,
445 * which should be the fast-path, and then once we hit the first
446 * interrupt, keep on trying using the SIF method until we've
447 * exhausted all contiguous interrupts.
450 static irqreturn_t
madgemc_interrupt(int irq
, void *dev_id
, struct pt_regs
*regs
)
453 struct net_device
*dev
;
456 printk("madgemc_interrupt: was not passed a dev_id!\n");
460 dev
= (struct net_device
*)dev_id
;
462 /* Make sure its really us. -- the Madge way */
463 pending
= inb(dev
->base_addr
+ MC_CONTROL_REG0
);
464 if (!(pending
& MC_CONTROL_REG0_SINTR
))
465 return IRQ_NONE
; /* not our interrupt */
468 * Since we're level-triggered, we may miss the rising edge
469 * of the next interrupt while we're off handling this one,
470 * so keep checking until the SIF verifies that it has nothing
473 pending
= STS_SYSTEM_IRQ
;
475 if (pending
& STS_SYSTEM_IRQ
) {
477 /* Toggle the interrupt to reset the latch on card */
478 reg1
= inb(dev
->base_addr
+ MC_CONTROL_REG1
);
479 outb(reg1
^ MC_CONTROL_REG1_SINTEN
,
480 dev
->base_addr
+ MC_CONTROL_REG1
);
481 outb(reg1
, dev
->base_addr
+ MC_CONTROL_REG1
);
483 /* Continue handling as normal */
484 tms380tr_interrupt(irq
, dev_id
, regs
);
486 pending
= SIFREADW(SIFSTS
); /* restart - the SIF way */
492 return IRQ_HANDLED
; /* not reachable */
496 * Set the card to the prefered ring speed.
498 * Unlike newer cards, the MC16/32 have their speed selection
499 * circuit connected to the Madge ASICs and not to the TMS380
500 * NSELOUT pins. Set the ASIC bits correctly here, and return
501 * zero to leave the TMS NSELOUT bits unaffected.
504 unsigned short madgemc_setnselout_pins(struct net_device
*dev
)
507 struct net_local
*tp
= netdev_priv(dev
);
509 reg1
= inb(dev
->base_addr
+ MC_CONTROL_REG1
);
511 if(tp
->DataRate
== SPEED_16
)
512 reg1
|= MC_CONTROL_REG1_SPEED_SEL
; /* add for 16mb */
513 else if (reg1
& MC_CONTROL_REG1_SPEED_SEL
)
514 reg1
^= MC_CONTROL_REG1_SPEED_SEL
; /* remove for 4mb */
515 outb(reg1
, dev
->base_addr
+ MC_CONTROL_REG1
);
517 return 0; /* no change */
521 * Set the register page. This equates to the SRSX line
524 * Register selection is normally done via three contiguous
525 * bits. However, some boards (such as the MC16/32) use only
526 * two bits, plus a separate bit in the glue chip. This
527 * sets the SRSX bit (the top bit). See page 4-17 in the
528 * Yellow Book for which registers are affected.
531 static void madgemc_setregpage(struct net_device
*dev
, int page
)
535 reg1
= inb(dev
->base_addr
+ MC_CONTROL_REG1
);
536 if ((page
== 0) && (reg1
& MC_CONTROL_REG1_SRSX
)) {
537 outb(reg1
^ MC_CONTROL_REG1_SRSX
,
538 dev
->base_addr
+ MC_CONTROL_REG1
);
540 else if (page
== 1) {
541 outb(reg1
| MC_CONTROL_REG1_SRSX
,
542 dev
->base_addr
+ MC_CONTROL_REG1
);
544 reg1
= inb(dev
->base_addr
+ MC_CONTROL_REG1
);
550 * The SIF registers are not mapped into register space by default
551 * Set this to 1 to map them, 0 to map the BIA ROM.
554 static void madgemc_setsifsel(struct net_device
*dev
, int val
)
558 reg0
= inb(dev
->base_addr
+ MC_CONTROL_REG0
);
559 if ((val
== 0) && (reg0
& MC_CONTROL_REG0_SIFSEL
)) {
560 outb(reg0
^ MC_CONTROL_REG0_SIFSEL
,
561 dev
->base_addr
+ MC_CONTROL_REG0
);
562 } else if (val
== 1) {
563 outb(reg0
| MC_CONTROL_REG0_SIFSEL
,
564 dev
->base_addr
+ MC_CONTROL_REG0
);
566 reg0
= inb(dev
->base_addr
+ MC_CONTROL_REG0
);
572 * Enable SIF interrupts
574 * This does not enable interrupts in the SIF, but rather
575 * enables SIF interrupts to be passed onto the host.
578 static void madgemc_setint(struct net_device
*dev
, int val
)
582 reg1
= inb(dev
->base_addr
+ MC_CONTROL_REG1
);
583 if ((val
== 0) && (reg1
& MC_CONTROL_REG1_SINTEN
)) {
584 outb(reg1
^ MC_CONTROL_REG1_SINTEN
,
585 dev
->base_addr
+ MC_CONTROL_REG1
);
586 } else if (val
== 1) {
587 outb(reg1
| MC_CONTROL_REG1_SINTEN
,
588 dev
->base_addr
+ MC_CONTROL_REG1
);
595 * Cable type is set via control register 7. Bit zero high
596 * for UTP, low for STP.
598 static void madgemc_setcabletype(struct net_device
*dev
, int type
)
600 outb((type
==0)?MC_CONTROL_REG7_CABLEUTP
:MC_CONTROL_REG7_CABLESTP
,
601 dev
->base_addr
+ MC_CONTROL_REG7
);
605 * Enable the functions of the Madge chipset needed for
606 * full working order.
608 static int madgemc_chipset_init(struct net_device
*dev
)
610 outb(0, dev
->base_addr
+ MC_CONTROL_REG1
); /* pull SRESET low */
611 tms380tr_wait(100); /* wait for card to reset */
613 /* bring back into normal operating mode */
614 outb(MC_CONTROL_REG1_NSRESET
, dev
->base_addr
+ MC_CONTROL_REG1
);
616 /* map SIF registers */
617 madgemc_setsifsel(dev
, 1);
619 /* enable SIF interrupts */
620 madgemc_setint(dev
, 1);
626 * Disable the board, and put back into power-up state.
628 void madgemc_chipset_close(struct net_device
*dev
)
630 /* disable interrupts */
631 madgemc_setint(dev
, 0);
632 /* unmap SIF registers */
633 madgemc_setsifsel(dev
, 0);
639 * Read the card type (MC16 or MC32) from the card.
641 * The configuration registers are stored in two separate
642 * pages. Pages are flipped by clearing bit 3 of CONTROL_REG0 (PAGE)
643 * for page zero, or setting bit 3 for page one.
645 * Page zero contains the following data:
646 * Byte 0: Manufacturer ID (0x4D -- ASCII "M")
650 * Byte 2: Card revision
651 * Byte 3: Mirror of POS config register 0
652 * Byte 4: Mirror of POS 1
653 * Byte 5: Mirror of POS 2
655 * Page one contains the following data:
657 * Byte 1-6: BIA, MSB to LSB.
659 * Note that to read the BIA, we must unmap the SIF registers
660 * by clearing bit 2 of CONTROL_REG0 (SIFSEL), as the data
661 * will reside in the same logical location. For this reason,
662 * _never_ read the BIA while the Eagle processor is running!
663 * The SIF will be completely inaccessible until the BIA operation
667 static void madgemc_read_rom(struct madgemc_card
*card
)
669 unsigned long ioaddr
;
670 unsigned char reg0
, reg1
, tmpreg0
, i
;
672 ioaddr
= card
->dev
->base_addr
;
674 reg0
= inb(ioaddr
+ MC_CONTROL_REG0
);
675 reg1
= inb(ioaddr
+ MC_CONTROL_REG1
);
677 /* Switch to page zero and unmap SIF */
678 tmpreg0
= reg0
& ~(MC_CONTROL_REG0_PAGE
+ MC_CONTROL_REG0_SIFSEL
);
679 outb(tmpreg0
, ioaddr
+ MC_CONTROL_REG0
);
681 card
->manid
= inb(ioaddr
+ MC_ROM_MANUFACTURERID
);
682 card
->cardtype
= inb(ioaddr
+ MC_ROM_ADAPTERID
);
683 card
->cardrev
= inb(ioaddr
+ MC_ROM_REVISION
);
685 /* Switch to rom page one */
686 outb(tmpreg0
| MC_CONTROL_REG0_PAGE
, ioaddr
+ MC_CONTROL_REG0
);
689 card
->dev
->addr_len
= 6;
690 for (i
= 0; i
< 6; i
++)
691 card
->dev
->dev_addr
[i
] = inb(ioaddr
+ MC_ROM_BIA_START
+ i
);
693 /* Restore original register values */
694 outb(reg0
, ioaddr
+ MC_CONTROL_REG0
);
695 outb(reg1
, ioaddr
+ MC_CONTROL_REG1
);
700 static int madgemc_open(struct net_device
*dev
)
703 * Go ahead and reinitialize the chipset again, just to
704 * make sure we didn't get left in a bad state.
706 madgemc_chipset_init(dev
);
711 static int madgemc_close(struct net_device
*dev
)
714 madgemc_chipset_close(dev
);
719 * Give some details available from /proc/mca/slotX
721 static int madgemc_mcaproc(char *buf
, int slot
, void *d
)
723 struct net_device
*dev
= (struct net_device
*)d
;
724 struct madgemc_card
*curcard
= madgemc_card_list
;
727 while (curcard
) { /* search for card struct */
728 if (curcard
->dev
== dev
)
730 curcard
= curcard
->next
;
732 len
+= sprintf(buf
+len
, "-------\n");
734 struct net_local
*tp
= netdev_priv(dev
);
737 len
+= sprintf(buf
+len
, "Card Revision: %d\n", curcard
->cardrev
);
738 len
+= sprintf(buf
+len
, "RAM Size: %dkb\n", curcard
->ramsize
);
739 len
+= sprintf(buf
+len
, "Cable type: %s\n", (curcard
->cabletype
)?"STP/DB9":"UTP/RJ-45");
740 len
+= sprintf(buf
+len
, "Configured ring speed: %dMb/sec\n", (curcard
->ringspeed
)?16:4);
741 len
+= sprintf(buf
+len
, "Running ring speed: %dMb/sec\n", (tp
->DataRate
==SPEED_16
)?16:4);
742 len
+= sprintf(buf
+len
, "Device: %s\n", dev
->name
);
743 len
+= sprintf(buf
+len
, "IO Port: 0x%04lx\n", dev
->base_addr
);
744 len
+= sprintf(buf
+len
, "IRQ: %d\n", dev
->irq
);
745 len
+= sprintf(buf
+len
, "Arbitration Level: %d\n", curcard
->arblevel
);
746 len
+= sprintf(buf
+len
, "Burst Mode: ");
747 switch(curcard
->burstmode
) {
748 case 0: len
+= sprintf(buf
+len
, "Cycle steal"); break;
749 case 1: len
+= sprintf(buf
+len
, "Limited burst"); break;
750 case 2: len
+= sprintf(buf
+len
, "Delayed release"); break;
751 case 3: len
+= sprintf(buf
+len
, "Immediate release"); break;
753 len
+= sprintf(buf
+len
, " (%s)\n", (curcard
->fairness
)?"Unfair":"Fair");
755 len
+= sprintf(buf
+len
, "Ring Station Address: ");
756 len
+= sprintf(buf
+len
, "%2.2x", dev
->dev_addr
[0]);
757 for (i
= 1; i
< 6; i
++)
758 len
+= sprintf(buf
+len
, " %2.2x", dev
->dev_addr
[i
]);
759 len
+= sprintf(buf
+len
, "\n");
761 len
+= sprintf(buf
+len
, "Card not configured\n");
766 static void __exit
madgemc_exit(void)
768 struct net_device
*dev
;
769 struct madgemc_card
*this_card
;
771 while (madgemc_card_list
) {
772 dev
= madgemc_card_list
->dev
;
773 unregister_netdev(dev
);
774 release_region(dev
->base_addr
-MADGEMC_SIF_OFFSET
, MADGEMC_IO_EXTENT
);
775 free_irq(dev
->irq
, dev
);
778 this_card
= madgemc_card_list
;
779 madgemc_card_list
= this_card
->next
;
784 module_init(madgemc_probe
);
785 module_exit(madgemc_exit
);
787 MODULE_LICENSE("GPL");
792 * compile-command: "gcc -DMODVERSIONS -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer -I/usr/src/linux/drivers/net/tokenring/ -c madgemc.c"
793 * alt-compile-command: "gcc -DMODULE -D__KERNEL__ -Wall -Wstrict-prototypes -O6 -fomit-frame-pointer -I/usr/src/linux/drivers/net/tokenring/ -c madgemc.c"