setup enviroment for compilation
[linux-2.4.21-pre4.git] / drivers / net / arctic_enet.c
1 /*
2  *  IPE405 (IBM IAP 405 chip evaluation board) Debug Support Board
3  *    Ehernet Driver
4  *  (C) Copyright 2001 by S.nishino (jl04348@jp.ibm.com)  IBM-Japan
5  *
6  * ---------- Strategy ----------
7  *
8  *  This NIC is RTL8019AS, simply connected to External Bus Controller
9  *  of IAP 405 chip. As many folks of 8390 based NIC, 8390 core driver
10  *  is usable.  luckily, the following driver is already available for
11  *  Amiga zorro bus (however I don't know this architecture beyond
12  *  below), this is modified based on this driver (ariadne2).
13  *
14  * ---------- original header ----------
15  *  Amiga Linux/m68k Ariadne II Ethernet Driver
16  *
17  *  (C) Copyright 1998 by some Elitist 680x0 Users(TM)
18  *
19  *  ---------------------------------------------------------------------------
20  *
21  *  This program is based on all the other NE2000 drivers for Linux
22  *
23  *  ---------------------------------------------------------------------------
24  *
25  *  This file is subject to the terms and conditions of the GNU General Public
26  *  License.  See the file COPYING in the main directory of the Linux
27  *  distribution for more details.  */
28
29 #include <linux/module.h>
30 #include <linux/kernel.h>
31 #include <linux/sched.h>
32 #include <linux/errno.h>
33 #include <linux/init.h>
34 #include <linux/delay.h>
35 #include <linux/netdevice.h>
36 #include <linux/etherdevice.h>
37 #include <linux/irq.h>
38
39
40 #include <asm/system.h>
41 #include <asm/io.h>
42 #include <asm/irq.h>
43 #include <asm/ppc4xx_pic.h>
44 #if defined(CONFIG_ARCTIC2)
45 #include <platforms/arctic2.h>
46 #else
47 #error The driver only works on Arctic
48 #endif
49
50 #include "8390.h"
51
52
53 #define ARCTIC_ENET_BASE8       (ARCTIC2_FPGA8_PADDR + 256*1024)
54 #define ARCTIC_ENET_BASE16      (ARCTIC2_FPGA16_PADDR + 0)
55
56 #define ARCTIC_ENET_IOBASE      0x0300  /* io base offset from NIC region */
57
58 #define ARCTIC_ENET_IRQ         29      /* irq number in UIC */
59 #define ARCTIC_ENET_IRQ_MASK    (0x80000000 >> ARCTIC_ENET_IRQ)
60
61 #define NE_BASE         (ARCTIC_ENET_BASE8 + ARCTIC_ENET_IOBASE)
62 #define NE_BASE16       (ARCTIC_ENET_BASE16 + ARCTIC_ENET_IOBASE)
63
64 /* 8390 register address */
65 #define NE_CMD          (0x00)
66 #define NE_DATAPORT     (0x10)  /* NatSemi-defined port window offset. */
67 #define NE_DATAPORT16   (NE_DATAPORT / sizeof(u16))
68 #define NE_RESET        (0x1f)  /* Issue a read to reset, a write to clear. */
69 #define NE_IO_EXTENT    (0x20)  /* region extent */
70
71 #define NE_EN0_ISR      (0x07)
72 #define NE_EN0_DCFG     (0x0e)
73
74 #define NE_EN0_RSARLO   (0x08)
75 #define NE_EN0_RSARHI   (0x09)
76 #define NE_EN0_RCNTLO   (0x0a)
77 #define NE_EN0_RXCR     (0x0c)
78 #define NE_EN0_TXCR     (0x0d)
79 #define NE_EN0_RCNTHI   (0x0b)
80 #define NE_EN0_IMR      (0x0f)
81
82 /* 8390 packet buffer page number */
83 #define NESM_START_PG   0x40    /* First page of TX buffer */
84 #define NESM_STOP_PG    0x80    /* Last page +1 of RX ring */
85
86 static u8 *iobase8;
87 static u16 *iobase16;
88
89 static int arctic_enet_probe(struct net_device *dev);
90 static int arctic_enet_init(struct net_device *dev);
91
92 static int arctic_enet_open(struct net_device *dev);
93 static int arctic_enet_close(struct net_device *dev);
94
95 static void arctic_enet_reset_8390(struct net_device *dev);
96 static void arctic_enet_get_8390_hdr(struct net_device *dev,
97                                     struct e8390_pkt_hdr *hdr,
98                                     int ring_page);
99 static void arctic_enet_block_input(struct net_device *dev, int count,
100                                    struct sk_buff *skb, int ring_offset);
101 static void arctic_enet_block_output(struct net_device *dev,
102                                     const int count,
103                                     const unsigned char *buf,
104                                     const int start_page);
105
106 /* These macros will do something on Arctic-I if we ever add support
107  * for it back in */
108 #define switch_16bit_bank()     do { } while (0)
109 #define switch_8bit_bank()      do { } while (0)
110
111 void p_dump(unsigned char *p, int sz)
112 {
113         int i;
114         unsigned char *wp;
115         
116         wp = p;
117         
118         printk("------ PACKET START :  %d Bytes  ------ \n", sz);
119         
120         for (i = 0; i < sz; i++) {
121                 if (i % 16 == 0) {
122                         printk("\n %04X: %02X ", i, *wp);
123                 } else if (i % 16 == 15) {
124                         printk("%02X", *wp);
125                 } else {
126                         printk("%02X ", *wp);
127                 }
128                 wp++;
129         }
130
131         printk("------ PACKET END   ------ \n");
132 }
133
134 /* Code for reading the MAC address from the Arctic ethernet based on
135  * similar code in PIBS */
136
137 static void __init writereg_9346(volatile u8 *iobase, u8 value)
138 {
139         /* Switch to register page 3 */
140         writeb(readb(iobase + NE_CMD) | 0xc0, iobase + NE_CMD);
141         writeb(value, iobase + 0x01);
142 }
143
144 static u8 __init readreg_9346(volatile u8 *iobase)
145 {
146         /* Switch to register page 3 */
147         writeb(readb(iobase + NE_CMD) | 0xc0, iobase + NE_CMD);
148         return readb(iobase + 0x01);
149 }
150
151 static void __init write_bit_9346(volatile u8 *iobase, u8 bit)
152 {
153         u8 mask = ~0x06;
154         
155         writereg_9346(iobase, (readreg_9346(iobase) & mask) | bit);
156         udelay(1000);
157         writereg_9346(iobase, (readreg_9346(iobase) & mask) | bit | 0x04);
158         udelay(1000);
159 }
160
161 static u8 __init read_bit_9346(volatile u8 *iobase)
162 {
163         u8 bit;
164         u8 mask = ~0x05;
165         
166         mask = ~0x05;
167         writereg_9346(iobase, readreg_9346(iobase) & mask);
168         udelay(1000);
169         writereg_9346(iobase, (readreg_9346(iobase) & mask) | 0x04);
170         bit = readreg_9346(iobase) & 0x01;
171         udelay(1000);
172
173         return bit;
174 }
175
176 static u16 __init arctic_read_9346(volatile u8 *iobase, unsigned long addr)
177 {
178         unsigned long flags;
179         int i;
180         u16 data;
181
182         local_irq_save(flags);
183
184         /* Put the chip into 8390 programming mode */
185         writereg_9346(iobase, (readreg_9346(iobase) & ~0xc0) | 0x80);
186         udelay(1000);
187
188         /* Send command (read 16-bit value) to EEPROM */
189         /* Bring CS Low */
190         writereg_9346(iobase, readreg_9346(iobase) & ~0x0f);
191         udelay(1000);
192         /* Bring CS High */
193         writereg_9346(iobase, (readreg_9346(iobase) & ~0x0f) | 0x08);
194         udelay(1000);
195
196         /* Send a 1 */
197         write_bit_9346(iobase, 0x02);
198         /* Send opcode 0b10 */
199         write_bit_9346(iobase, 0x02);
200         write_bit_9346(iobase, 0x00);
201         /* Send address to read */
202         for (i = 0; i < 6; i++) {
203                 if (addr & 0x20)
204                         write_bit_9346(iobase, 0x02);
205                 else
206                         write_bit_9346(iobase, 0x00);
207                 addr <<= 1;
208         }
209
210         /* Read the value back, bit by bit */
211         data = 0;
212         for (i = 0; i < 16; i++) {
213                 data <<= 1;
214                 if (read_bit_9346(iobase))
215                         data |= 0x1;
216         }
217
218         /* Bring CS Low */
219         writereg_9346(iobase, readreg_9346(iobase) & ~0x0f);
220         udelay(1000);
221         /* Bring the chip out of 8390 programming mode */
222         writereg_9346(iobase, readreg_9346(iobase) & ~0xc0);
223         udelay(1000);
224
225         /* Return to register page 0 */
226         writeb(readb(iobase + NE_CMD) & ~0xc0, iobase + NE_CMD);
227         udelay(1000);
228
229         local_irq_restore(flags);
230         
231         return data;
232 }
233
234 static void __init arctic_get_macaddr(struct net_device *dev)
235 {
236         u16 t0, t1, t2, v0, v1;
237
238         t0 = arctic_read_9346(iobase8, 0);
239         t1 = arctic_read_9346(iobase8, 2);
240         t2 = arctic_read_9346(iobase8, 4);
241         v0 = arctic_read_9346(iobase8, 6);
242         v1 = arctic_read_9346(iobase8, 8);
243
244         if ( (v0 != 0x4d50) || (v1 != 0x5400) ) {
245                 printk(KERN_WARNING "%s: MAC address is not set in EEPROM\n", dev->name);
246                 return;
247         }
248
249         dev->dev_addr[0] = t0 >> 8;
250         dev->dev_addr[1] = t0 & 0xff;
251         dev->dev_addr[2] = t1 >> 8;
252         dev->dev_addr[3] = t1 & 0xff;
253         dev->dev_addr[4] = t2 >> 8;
254         dev->dev_addr[5] = t2 & 0xff;
255 }
256
257 int __init arctic_enet_probe(struct net_device *dev)
258 {
259         unsigned long reset_start_time;
260
261         switch_8bit_bank();
262         /* Reset card. Who knows what dain-bramaged state it was left in. */
263         reset_start_time = jiffies;
264         
265         writeb(readb(iobase8 + NE_RESET), iobase8 + NE_RESET);
266
267         while ((readb(iobase8 + NE_EN0_ISR) & ENISR_RESET) == 0)
268                 if (jiffies - reset_start_time > 2 * HZ / 100) {
269                         printk("arctic_enet: not found (no reset ack).\n");
270                         return -ENODEV;
271                 }
272         
273         writeb(0xff, iobase8 + NE_EN0_ISR);     /* Ack all intr. */
274
275         arctic_get_macaddr(dev);
276
277         printk("arctic_enet: found at 0x%08x/0x%08x, MAC address "
278                "%02x:%02x:%02x:%02x:%02x:%02x\n",
279                NE_BASE, NE_BASE16,
280                dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
281                dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]);
282
283         /* Hack to let 8390.c work properly - it assumes IO space
284          * addresses */
285         dev->base_addr = (unsigned long)iobase8 - _IO_BASE;
286         dev->irq = ARCTIC_ENET_IRQ;
287
288         return 0;
289 }
290
291 static int __init arctic_enet_init(struct net_device *dev)
292 {
293         static u32 arctic_enet_offsets[16] = {
294                 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
295                 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
296         };
297
298         /* Since this irq is connected to uic as edge interrupt, its pending must be cleared. */
299         /* FIXME: it would be nice to get rid of the direct reference
300          * to the 4xx irq structure */
301         ppc4xx_pic->ack(dev->irq);
302
303         /* Install the Interrupt handler */
304         if (request_irq(dev->irq, ei_interrupt, SA_SHIRQ, dev->name, dev))
305                 return -EAGAIN;
306
307         /* Allocate dev->priv and fill in 8390 specific dev fields. */
308         if (ethdev_init(dev)) {
309                 printk(" Unable to get memory for dev->priv.\n");
310                 return -ENOMEM;
311         }
312         
313         /*
314          * Fill 8390 specific member for 8390 core driver
315          */
316         ei_status.name = "RTL8019AS";
317         ei_status.tx_start_page = NESM_START_PG;
318         ei_status.stop_page = NESM_STOP_PG;
319         ei_status.word16 = 1;
320         ei_status.rx_start_page = NESM_START_PG + TX_PAGES;
321         
322         ei_status.reset_8390 = &arctic_enet_reset_8390;
323         ei_status.block_input = &arctic_enet_block_input;
324         ei_status.block_output = &arctic_enet_block_output;
325         ei_status.get_8390_hdr = &arctic_enet_get_8390_hdr;
326         ei_status.reg_offset = arctic_enet_offsets;
327
328         NS8390_init(dev, 0);
329         return 0;
330 }
331
332 static int arctic_enet_open(struct net_device *dev)
333 {
334         int err;
335         err = ei_open(dev);
336         if (err)
337                 return err;
338
339         MOD_INC_USE_COUNT;
340         return 0;
341 }
342
343 static int arctic_enet_close(struct net_device *dev)
344 {
345         int err;
346
347         err = ei_close(dev);
348         if (err)
349                 return err;
350
351         MOD_DEC_USE_COUNT;
352         return 0;
353 }
354
355 /* Hard reset the card.  This used to pause for the same period that a
356    8390 reset command required, but that shouldn't be necessary. */
357 static void arctic_enet_reset_8390(struct net_device *dev)
358 {
359         unsigned long reset_start_time = jiffies;
360
361         if (ei_debug > 1)
362                 printk("resetting the 8390 t=%ld...", jiffies);
363
364         writeb(readb(iobase8 + NE_RESET), iobase8 + NE_RESET);
365
366         ei_status.txing = 0;
367         ei_status.dmaing = 0;
368
369         /* This check _should_not_ be necessary, omit eventually. */
370         while ((readb(iobase8 + NE_EN0_ISR) & ENISR_RESET) == 0)
371                 if (jiffies - reset_start_time > 2 * HZ / 100) {
372                         printk("%s: ne_reset_8390() did not complete.\n",
373                                dev->name);
374                         break;
375                 }
376         writeb(ENISR_RESET, iobase8 + NE_EN0_ISR);      /* Ack intr. */
377 }
378
379 /* Grab the 8390 specific header. Similar to the block_input routine, but
380    we don't need to be concerned with ring wrap as the header will be at
381    the start of a page, so we optimize accordingly. */
382
383 static void arctic_enet_get_8390_hdr(struct net_device *dev,
384                                     struct e8390_pkt_hdr *hdr,
385                                     int ring_page)
386 {
387         int cnt;
388         u16 *ptrs;
389         unsigned char *ptrc;
390
391         /* This *shouldn't* happen. If it does, it's the last thing you'll see */
392         if (ei_status.dmaing) {
393                 printk("%s: DMAing conflict in ne_get_8390_hdr "
394                        "[DMAstat:%d][irqlock:%d].\n", dev->name,
395                        ei_status.dmaing, ei_status.irqlock);
396                 return;
397         }
398
399         ei_status.dmaing |= 0x01;
400         writeb(E8390_NODMA + E8390_PAGE0 + E8390_START, iobase8 + NE_CMD);
401         writeb(ENISR_RDC, iobase8 + NE_EN0_ISR);
402         writeb(sizeof(struct e8390_pkt_hdr), iobase8 + NE_EN0_RCNTLO);
403         writeb(0, iobase8 + NE_EN0_RCNTHI);
404         writeb(0, iobase8 + NE_EN0_RSARLO);     /* On page boundary */
405         writeb(ring_page, iobase8 + NE_EN0_RSARHI);
406         writeb(E8390_RREAD + E8390_START, iobase8 + NE_CMD);
407
408         if (ei_status.word16) {
409                 switch_16bit_bank();
410                 ptrs = (u16 *) hdr;
411                 for (cnt = 0; cnt < (sizeof(struct e8390_pkt_hdr) >> 1);
412                      cnt++)
413                         *ptrs++ = in_be16((u16 *) (iobase16 + NE_DATAPORT16));
414                 switch_8bit_bank();
415         } else {
416
417                 ptrc = (unsigned char *) hdr;
418                 for (cnt = 0; cnt < sizeof(struct e8390_pkt_hdr); cnt++)
419                         *ptrc++ = readb(iobase8 + NE_DATAPORT);
420         }
421
422
423         writeb(ENISR_RDC, iobase8 + NE_EN0_ISR);        /* Ack intr. */
424
425         /* I am Big Endian, but received byte count is Little Endian. */
426         hdr->count = le16_to_cpu(hdr->count);
427
428         ei_status.dmaing &= ~0x01;
429 }
430
431 /* Block input and output, similar to the Crynwr packet driver.  If you
432    are porting to a new ethercard, look at the packet driver source for hints.
433    The NEx000 doesn't share the on-board packet memory -- you have to put
434    the packet out through the "remote DMA" dataport using writeb. */
435
436 static void arctic_enet_block_input(struct net_device *dev, int count,
437                                    struct sk_buff *skb, int ring_offset)
438 {
439         char *buf = skb->data;
440         u16 *ptrs;
441         unsigned char *ptrc;
442
443         int cnt;
444
445         /* This *shouldn't* happen. If it does, it's the last thing you'll see */
446         if (ei_status.dmaing) {
447                 printk("%s: DMAing conflict in ne_block_input "
448                        "[DMAstat:%d][irqlock:%d].\n",
449                        dev->name, ei_status.dmaing, ei_status.irqlock);
450                 return;
451         }
452         ei_status.dmaing |= 0x01;
453         writeb(E8390_NODMA + E8390_PAGE0 + E8390_START, iobase8 + NE_CMD);
454         writeb(ENISR_RDC, iobase8 + NE_EN0_ISR);
455         writeb(count & 0xff, iobase8 + NE_EN0_RCNTLO);
456         writeb(count >> 8, iobase8 + NE_EN0_RCNTHI);
457         writeb(ring_offset & 0xff, iobase8 + NE_EN0_RSARLO);
458         writeb(ring_offset >> 8, iobase8 + NE_EN0_RSARHI);
459         writeb(E8390_RREAD + E8390_START, iobase8 + NE_CMD);
460
461
462         if (ei_status.word16) {
463
464                 switch_16bit_bank();
465
466                 ptrs = (u16 *) buf;
467                 for (cnt = 0; cnt < (count >> 1); cnt++)
468                         /* At 16 bits mode, bus acts as Little Endian mode
469                            That's swap is needed ??? */
470                         *ptrs++ = in_be16((u16 *) (iobase16 + NE_DATAPORT16));
471                 switch_8bit_bank();
472
473                 if (count & 0x01)
474                         buf[count - 1] = readb(iobase8 + NE_DATAPORT);
475
476         } else {
477
478
479                 ptrc = (unsigned char *) buf;
480                 for (cnt = 0; cnt < count; cnt++)
481                         *ptrc++ = readb(iobase8 + NE_DATAPORT);
482         }
483
484         writeb(ENISR_RDC, iobase8 + NE_EN0_ISR);        /* Ack intr. */
485         ei_status.dmaing &= ~0x01;
486 }
487
488 static void arctic_enet_block_output(struct net_device *dev, int count,
489                                     const unsigned char *buf,
490                                     const int start_page)
491 {
492         unsigned long dma_start;
493         u16 *ptrs;
494         unsigned char *ptrc;
495         int cnt;
496
497         /* Round the count up for word writes.  Do we need to do this?
498            What effect will an odd byte count have on the 8390?
499            I should check someday. */
500         if (count & 0x01)
501                 count++;
502
503         /* This *shouldn't* happen. If it does, it's the last thing you'll see */
504         if (ei_status.dmaing) {
505                 printk("%s: DMAing conflict in ne_block_output."
506                        "[DMAstat:%d][irqlock:%d]\n", dev->name,
507                        ei_status.dmaing, ei_status.irqlock);
508                 return;
509         }
510         ei_status.dmaing |= 0x01;
511
512 #if 1 /* FIXME: not sure what this is for -dwg */
513         writeb(0x42, iobase8 + EN0_RCNTLO);
514         writeb(0x00, iobase8 + EN0_RCNTHI);
515         writeb(0x42, iobase8 + EN0_RSARLO);
516         writeb(0x00, iobase8 + EN0_RSARHI);
517 #endif
518         /* We should already be in page 0, but to be safe... */
519         writeb(E8390_PAGE0 + E8390_START + E8390_NODMA, iobase8 + NE_CMD);
520
521         writeb(ENISR_RDC, iobase8 + NE_EN0_ISR);
522
523         /* Now the normal output. */
524         writeb(count & 0xff, iobase8 + NE_EN0_RCNTLO);
525         writeb(count >> 8, iobase8 + NE_EN0_RCNTHI);
526         writeb(0x00, iobase8 + NE_EN0_RSARLO);
527         writeb(start_page, iobase8 + NE_EN0_RSARHI);
528
529         writeb(E8390_RWRITE + E8390_START, iobase8 + NE_CMD);
530
531         if (ei_status.word16) {
532                 switch_16bit_bank();
533
534                 ptrs = (u16 *) buf;
535                 for (cnt = 0; cnt < count >> 1; cnt++) {
536                         /* At 16 bits mode, bus acts as Little Endian mode
537                            That's swap is needed ??? */
538                         out_be16((u16 *) (iobase16 + NE_DATAPORT16),
539                                  *ptrs);
540                         ptrs++;
541                 }
542
543                 switch_8bit_bank();
544
545         } else {
546                 ptrc = (unsigned char *) buf;
547                 for (cnt = 0; cnt < count; cnt++)
548                         writeb(*ptrc++, iobase8 + NE_DATAPORT);
549         }
550
551         dma_start = jiffies;
552
553         while ((readb(iobase8 + NE_EN0_ISR) & ENISR_RDC) == 0)
554                 if (jiffies - dma_start > 2 * HZ / 100) {       /* 20ms */
555                         printk("%s: timeout waiting for Tx RDC.\n",
556                                dev->name);
557                         arctic_enet_reset_8390(dev);
558                         NS8390_init(dev, 1);
559                         break;
560                 }
561
562         writeb(ENISR_RDC, iobase8 + NE_EN0_ISR);        /* Ack intr. */
563         ei_status.dmaing &= ~0x01;
564         return;
565 }
566
567 static struct net_device arctic_enet_dev = {
568         .init   = arctic_enet_init,
569         .open   = arctic_enet_open,
570         .stop   = arctic_enet_close,
571 };
572
573 int init_arctic_enet(void)
574 {
575         struct net_device *dev = &arctic_enet_dev;
576         int rsvd8 = 0;
577         int rsvd16 = 0;
578         int err;
579
580         /* First set up our IO regions */
581         if (! request_mem_region(NE_BASE, NE_IO_EXTENT, "arctic_enet"))
582                 goto fail;
583         rsvd8 = 1;
584
585         iobase8 = ioremap(NE_BASE, NE_IO_EXTENT);
586         if (! iobase8) {
587                 err = -EBUSY;
588                 goto fail;
589         }
590         
591         if (NE_BASE16 != NE_BASE) {
592                 if (! request_mem_region(NE_BASE16, NE_IO_EXTENT, "arctic_enet"))
593                         goto fail;
594                 rsvd16 = 1;
595         }
596
597         iobase16 = ioremap(NE_BASE16, NE_IO_EXTENT);
598         if (! iobase16) {
599                 err = -EBUSY;
600                 goto fail;
601         }       
602
603         /* Configure IRQ */
604         cli();
605         mtdcr(DCRN_UIC0_TR, mfdcr(DCRN_UIC0_TR) | ARCTIC_ENET_IRQ_MASK);
606         mtdcr(DCRN_UIC0_PR, mfdcr(DCRN_UIC0_PR) | ARCTIC_ENET_IRQ_MASK);
607         mtdcr(DCRN_UIC0_SR, ARCTIC_ENET_IRQ_MASK);
608         sti();
609
610         err = arctic_enet_probe(dev);
611         if (err) {
612                 printk(KERN_ERR "arctic_enet: No Arctic ethernet card found.\n");
613                 goto fail;
614         }
615
616         err = register_netdev(dev);
617         if (err)
618                 goto fail;
619
620         return 0;
621
622  fail:
623         if (iobase16)
624                 iounmap(iobase16);
625         if (rsvd16)
626                 release_mem_region(NE_BASE16, NE_IO_EXTENT);
627         if (iobase8)
628                 iounmap(iobase8);
629         if (rsvd8)
630                 release_mem_region(NE_BASE, NE_IO_EXTENT);
631
632         return err;
633         
634 }
635
636 void remove_arctic_enet(void)
637 {
638         unregister_netdev(&arctic_enet_dev);
639         free_irq(ARCTIC_ENET_IRQ, &arctic_enet_dev);
640
641         if (iobase16) {
642                 iounmap(iobase16);
643                 release_mem_region(NE_BASE16, NE_IO_EXTENT);
644         }
645         if (iobase8) {
646                 iounmap(iobase8);
647                 release_mem_region(NE_BASE, NE_IO_EXTENT);
648         }
649 }
650
651 module_init(init_arctic_enet);
652 module_exit(remove_arctic_enet);