ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / drivers / net / arm / etherh.c
1 /*
2  *  linux/drivers/acorn/net/etherh.c
3  *
4  *  Copyright (C) 2000-2002 Russell King
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * NS8390 I-cubed EtherH and ANT EtherM specific driver
11  * Thanks to I-Cubed for information on their cards.
12  * EtherM conversion (C) 1999 Chris Kemp and Tim Watterton
13  * EtherM integration (C) 2000 Aleph One Ltd (Tak-Shing Chan)
14  * EtherM integration re-engineered by Russell King.
15  *
16  * Changelog:
17  *  08-12-1996  RMK     1.00    Created
18  *              RMK     1.03    Added support for EtherLan500 cards
19  *  23-11-1997  RMK     1.04    Added media autodetection
20  *  16-04-1998  RMK     1.05    Improved media autodetection
21  *  10-02-2000  RMK     1.06    Updated for 2.3.43
22  *  13-05-2000  RMK     1.07    Updated for 2.3.99-pre8
23  *  12-10-1999  CK/TEW          EtherM driver first release
24  *  21-12-2000  TTC             EtherH/EtherM integration
25  *  25-12-2000  RMK     1.08    Clean integration of EtherM into this driver.
26  *  03-01-2002  RMK     1.09    Always enable IRQs if we're in the nic slot.
27  */
28
29 #include <linux/module.h>
30 #include <linux/kernel.h>
31 #include <linux/sched.h>
32 #include <linux/types.h>
33 #include <linux/fcntl.h>
34 #include <linux/interrupt.h>
35 #include <linux/ptrace.h>
36 #include <linux/ioport.h>
37 #include <linux/in.h>
38 #include <linux/slab.h>
39 #include <linux/string.h>
40 #include <linux/errno.h>
41 #include <linux/netdevice.h>
42 #include <linux/etherdevice.h>
43 #include <linux/skbuff.h>
44 #include <linux/delay.h>
45 #include <linux/device.h>
46 #include <linux/init.h>
47
48 #include <asm/system.h>
49 #include <asm/bitops.h>
50 #include <asm/ecard.h>
51 #include <asm/io.h>
52 #include <asm/irq.h>
53
54 #include "../8390.h"
55
56 #define NET_DEBUG  0
57 #define DEBUG_INIT 2
58
59 static unsigned int net_debug = NET_DEBUG;
60
61 struct etherh_priv {
62         void            *ioc_fast;
63         void            *memc;
64         unsigned int    id;
65         void            *ctrl_port;
66         unsigned char   ctrl;
67 };
68
69 struct etherh_data {
70         unsigned long   ns8390_offset;
71         unsigned long   dataport_offset;
72         unsigned long   ctrlport_offset;
73         int             ctrl_ioc;
74         const char      name[16];
75         /*
76          * netdev flags and port
77          */
78         unsigned short  flags;
79         unsigned char   if_port;
80         unsigned char   tx_start_page;
81         unsigned char   stop_page;
82 };
83
84 MODULE_AUTHOR("Russell King");
85 MODULE_DESCRIPTION("EtherH/EtherM driver");
86 MODULE_LICENSE("GPL");
87
88 static char version[] __initdata =
89         "EtherH/EtherM Driver (c) 2002 Russell King v1.09\n";
90
91 #define ETHERH500_DATAPORT      0x800   /* MEMC */
92 #define ETHERH500_NS8390        0x000   /* MEMC */
93 #define ETHERH500_CTRLPORT      0x800   /* IOC  */
94
95 #define ETHERH600_DATAPORT      0x040   /* MEMC */
96 #define ETHERH600_NS8390        0x800   /* MEMC */
97 #define ETHERH600_CTRLPORT      0x200   /* MEMC */
98
99 #define ETHERH_CP_IE            1
100 #define ETHERH_CP_IF            2
101 #define ETHERH_CP_HEARTBEAT     2
102
103 #define ETHERH_TX_START_PAGE    1
104 #define ETHERH_STOP_PAGE        127
105
106 /*
107  * These came from CK/TEW
108  */
109 #define ETHERM_DATAPORT         0x200   /* MEMC */
110 #define ETHERM_NS8390           0x800   /* MEMC */
111 #define ETHERM_CTRLPORT         0x23c   /* MEMC */
112
113 #define ETHERM_TX_START_PAGE    64
114 #define ETHERM_STOP_PAGE        127
115
116 /* ------------------------------------------------------------------------ */
117
118 #define etherh_priv(dev) \
119  ((struct etherh_priv *)(((char *)netdev_priv(dev)) + sizeof(struct ei_device)))
120
121 static inline void etherh_set_ctrl(struct etherh_priv *eh, unsigned char mask)
122 {
123         unsigned char ctrl = eh->ctrl | mask;
124         eh->ctrl = ctrl;
125         writeb(ctrl, eh->ctrl_port);
126 }
127
128 static inline void etherh_clr_ctrl(struct etherh_priv *eh, unsigned char mask)
129 {
130         unsigned char ctrl = eh->ctrl & ~mask;
131         eh->ctrl = ctrl;
132         writeb(ctrl, eh->ctrl_port);
133 }
134
135 static inline unsigned int etherh_get_stat(struct etherh_priv *eh)
136 {
137         return readb(eh->ctrl_port);
138 }
139
140
141
142
143 static void etherh_irq_enable(ecard_t *ec, int irqnr)
144 {
145         struct etherh_priv *eh = ec->irq_data;
146
147         etherh_set_ctrl(eh, ETHERH_CP_IE);
148 }
149
150 static void etherh_irq_disable(ecard_t *ec, int irqnr)
151 {
152         struct etherh_priv *eh = ec->irq_data;
153
154         etherh_clr_ctrl(eh, ETHERH_CP_IE);
155 }
156
157 static expansioncard_ops_t etherh_ops = {
158         .irqenable      = etherh_irq_enable,
159         .irqdisable     = etherh_irq_disable,
160 };
161
162
163
164
165 static void
166 etherh_setif(struct net_device *dev)
167 {
168         struct ei_device *ei_local = netdev_priv(dev);
169         unsigned long addr, flags;
170
171         local_irq_save(flags);
172
173         /* set the interface type */
174         switch (etherh_priv(dev)->id) {
175         case PROD_I3_ETHERLAN600:
176         case PROD_I3_ETHERLAN600A:
177                 addr = dev->base_addr + EN0_RCNTHI;
178
179                 switch (dev->if_port) {
180                 case IF_PORT_10BASE2:
181                         writeb((readb(addr) & 0xf8) | 1, addr);
182                         break;
183                 case IF_PORT_10BASET:
184                         writeb((readb(addr) & 0xf8), addr);
185                         break;
186                 }
187                 break;
188
189         case PROD_I3_ETHERLAN500:
190                 switch (dev->if_port) {
191                 case IF_PORT_10BASE2:
192                         etherh_clr_ctrl(etherh_priv(dev), ETHERH_CP_IF);
193                         break;
194
195                 case IF_PORT_10BASET:
196                         etherh_set_ctrl(etherh_priv(dev), ETHERH_CP_IF);
197                         break;
198                 }
199                 break;
200
201         default:
202                 break;
203         }
204
205         local_irq_restore(flags);
206 }
207
208 static int
209 etherh_getifstat(struct net_device *dev)
210 {
211         struct ei_device *ei_local = netdev_priv(dev);
212         int stat = 0;
213
214         switch (etherh_priv(dev)->id) {
215         case PROD_I3_ETHERLAN600:
216         case PROD_I3_ETHERLAN600A:
217                 switch (dev->if_port) {
218                 case IF_PORT_10BASE2:
219                         stat = 1;
220                         break;
221                 case IF_PORT_10BASET:
222                         stat = readb(dev->base_addr+EN0_RCNTHI) & 4;
223                         break;
224                 }
225                 break;
226
227         case PROD_I3_ETHERLAN500:
228                 switch (dev->if_port) {
229                 case IF_PORT_10BASE2:
230                         stat = 1;
231                         break;
232                 case IF_PORT_10BASET:
233                         stat = etherh_get_stat(etherh_priv(dev)) & ETHERH_CP_HEARTBEAT;
234                         break;
235                 }
236                 break;
237
238         default:
239                 stat = 0;
240                 break;
241         }
242
243         return stat != 0;
244 }
245
246 /*
247  * Configure the interface.  Note that we ignore the other
248  * parts of ifmap, since its mostly meaningless for this driver.
249  */
250 static int etherh_set_config(struct net_device *dev, struct ifmap *map)
251 {
252         switch (map->port) {
253         case IF_PORT_10BASE2:
254         case IF_PORT_10BASET:
255                 /*
256                  * If the user explicitly sets the interface
257                  * media type, turn off automedia detection.
258                  */
259                 dev->flags &= ~IFF_AUTOMEDIA;
260                 dev->if_port = map->port;
261                 break;
262
263         default:
264                 return -EINVAL;
265         }
266
267         etherh_setif(dev);
268
269         return 0;
270 }
271
272 /*
273  * Reset the 8390 (hard reset).  Note that we can't actually do this.
274  */
275 static void
276 etherh_reset(struct net_device *dev)
277 {
278         struct ei_device *ei_local = netdev_priv(dev);
279
280         writeb(E8390_NODMA+E8390_PAGE0+E8390_STOP, dev->base_addr);
281
282         /*
283          * See if we need to change the interface type.
284          * Note that we use 'interface_num' as a flag
285          * to indicate that we need to change the media.
286          */
287         if (dev->flags & IFF_AUTOMEDIA && ei_local->interface_num) {
288                 ei_local->interface_num = 0;
289
290                 if (dev->if_port == IF_PORT_10BASET)
291                         dev->if_port = IF_PORT_10BASE2;
292                 else
293                         dev->if_port = IF_PORT_10BASET;
294
295                 etherh_setif(dev);
296         }
297 }
298
299 /*
300  * Write a block of data out to the 8390
301  */
302 static void
303 etherh_block_output (struct net_device *dev, int count, const unsigned char *buf, int start_page)
304 {
305         struct ei_device *ei_local = netdev_priv(dev);
306         unsigned int addr, dma_addr;
307         unsigned long dma_start;
308
309         if (ei_local->dmaing) {
310                 printk(KERN_ERR "%s: DMAing conflict in etherh_block_input: "
311                         " DMAstat %d irqlock %d\n", dev->name,
312                         ei_local->dmaing, ei_local->irqlock);
313                 return;
314         }
315
316         /*
317          * Make sure we have a round number of bytes if we're in word mode.
318          */
319         if (count & 1 && ei_local->word16)
320                 count++;
321
322         ei_local->dmaing = 1;
323
324         addr = dev->base_addr;
325         dma_addr = dev->mem_start;
326
327         count = (count + 1) & ~1;
328         writeb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD);
329
330         writeb (0x42, addr + EN0_RCNTLO);
331         writeb (0x00, addr + EN0_RCNTHI);
332         writeb (0x42, addr + EN0_RSARLO);
333         writeb (0x00, addr + EN0_RSARHI);
334         writeb (E8390_RREAD | E8390_START, addr + E8390_CMD);
335
336         udelay (1);
337
338         writeb (ENISR_RDC, addr + EN0_ISR);
339         writeb (count, addr + EN0_RCNTLO);
340         writeb (count >> 8, addr + EN0_RCNTHI);
341         writeb (0, addr + EN0_RSARLO);
342         writeb (start_page, addr + EN0_RSARHI);
343         writeb (E8390_RWRITE | E8390_START, addr + E8390_CMD);
344
345         if (ei_local->word16)
346                 writesw (dma_addr, buf, count >> 1);
347         else
348                 writesb (dma_addr, buf, count);
349
350         dma_start = jiffies;
351
352         while ((readb (addr + EN0_ISR) & ENISR_RDC) == 0)
353                 if (jiffies - dma_start > 2*HZ/100) { /* 20ms */
354                         printk(KERN_ERR "%s: timeout waiting for TX RDC\n",
355                                 dev->name);
356                         etherh_reset (dev);
357                         NS8390_init (dev, 1);
358                         break;
359                 }
360
361         writeb (ENISR_RDC, addr + EN0_ISR);
362         ei_local->dmaing = 0;
363 }
364
365 /*
366  * Read a block of data from the 8390
367  */
368 static void
369 etherh_block_input (struct net_device *dev, int count, struct sk_buff *skb, int ring_offset)
370 {
371         struct ei_device *ei_local = netdev_priv(dev);
372         unsigned int addr, dma_addr;
373         unsigned char *buf;
374
375         if (ei_local->dmaing) {
376                 printk(KERN_ERR "%s: DMAing conflict in etherh_block_input: "
377                         " DMAstat %d irqlock %d\n", dev->name,
378                         ei_local->dmaing, ei_local->irqlock);
379                 return;
380         }
381
382         ei_local->dmaing = 1;
383
384         addr = dev->base_addr;
385         dma_addr = dev->mem_start;
386
387         buf = skb->data;
388         writeb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD);
389         writeb (count, addr + EN0_RCNTLO);
390         writeb (count >> 8, addr + EN0_RCNTHI);
391         writeb (ring_offset, addr + EN0_RSARLO);
392         writeb (ring_offset >> 8, addr + EN0_RSARHI);
393         writeb (E8390_RREAD | E8390_START, addr + E8390_CMD);
394
395         if (ei_local->word16) {
396                 readsw (dma_addr, buf, count >> 1);
397                 if (count & 1)
398                         buf[count - 1] = readb (dma_addr);
399         } else
400                 readsb (dma_addr, buf, count);
401
402         writeb (ENISR_RDC, addr + EN0_ISR);
403         ei_local->dmaing = 0;
404 }
405
406 /*
407  * Read a header from the 8390
408  */
409 static void
410 etherh_get_header (struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page)
411 {
412         struct ei_device *ei_local = netdev_priv(dev);
413         unsigned int addr, dma_addr;
414
415         if (ei_local->dmaing) {
416                 printk(KERN_ERR "%s: DMAing conflict in etherh_get_header: "
417                         " DMAstat %d irqlock %d\n", dev->name,
418                         ei_local->dmaing, ei_local->irqlock);
419                 return;
420         }
421
422         ei_local->dmaing = 1;
423
424         addr = dev->base_addr;
425         dma_addr = dev->mem_start;
426
427         writeb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD);
428         writeb (sizeof (*hdr), addr + EN0_RCNTLO);
429         writeb (0, addr + EN0_RCNTHI);
430         writeb (0, addr + EN0_RSARLO);
431         writeb (ring_page, addr + EN0_RSARHI);
432         writeb (E8390_RREAD | E8390_START, addr + E8390_CMD);
433
434         if (ei_local->word16)
435                 readsw (dma_addr, hdr, sizeof (*hdr) >> 1);
436         else
437                 readsb (dma_addr, hdr, sizeof (*hdr));
438
439         writeb (ENISR_RDC, addr + EN0_ISR);
440         ei_local->dmaing = 0;
441 }
442
443 /*
444  * Open/initialize the board.  This is called (in the current kernel)
445  * sometime after booting when the 'ifconfig' program is run.
446  *
447  * This routine should set everything up anew at each open, even
448  * registers that "should" only need to be set once at boot, so that
449  * there is non-reboot way to recover if something goes wrong.
450  */
451 static int
452 etherh_open(struct net_device *dev)
453 {
454         struct ei_device *ei_local = netdev_priv(dev);
455
456         if (!is_valid_ether_addr(dev->dev_addr)) {
457                 printk(KERN_WARNING "%s: invalid ethernet MAC address\n",
458                         dev->name);
459                 return -EINVAL;
460         }
461
462         if (request_irq(dev->irq, ei_interrupt, 0, dev->name, dev))
463                 return -EAGAIN;
464
465         /*
466          * Make sure that we aren't going to change the
467          * media type on the next reset - we are about to
468          * do automedia manually now.
469          */
470         ei_local->interface_num = 0;
471
472         /*
473          * If we are doing automedia detection, do it now.
474          * This is more reliable than the 8390's detection.
475          */
476         if (dev->flags & IFF_AUTOMEDIA) {
477                 dev->if_port = IF_PORT_10BASET;
478                 etherh_setif(dev);
479                 mdelay(1);
480                 if (!etherh_getifstat(dev)) {
481                         dev->if_port = IF_PORT_10BASE2;
482                         etherh_setif(dev);
483                 }
484         } else
485                 etherh_setif(dev);
486
487         etherh_reset(dev);
488         ei_open(dev);
489
490         return 0;
491 }
492
493 /*
494  * The inverse routine to etherh_open().
495  */
496 static int
497 etherh_close(struct net_device *dev)
498 {
499         ei_close (dev);
500         free_irq (dev->irq, dev);
501         return 0;
502 }
503
504 /*
505  * Initialisation
506  */
507
508 static void __init etherh_banner(void)
509 {
510         static int version_printed;
511
512         if (net_debug && version_printed++ == 0)
513                 printk(KERN_INFO "%s", version);
514 }
515
516 /*
517  * Read the ethernet address string from the on board rom.
518  * This is an ascii string...
519  */
520 static int __init etherh_addr(char *addr, struct expansion_card *ec)
521 {
522         struct in_chunk_dir cd;
523         char *s;
524         
525         if (ecard_readchunk(&cd, ec, 0xf5, 0) && (s = strchr(cd.d.string, '('))) {
526                 int i;
527                 for (i = 0; i < 6; i++) {
528                         addr[i] = simple_strtoul(s + 1, &s, 0x10);
529                         if (*s != (i == 5? ')' : ':'))
530                                 break;
531                 }
532                 if (i == 6)
533                         return 0;
534         }
535         return -ENODEV;
536 }
537
538 /*
539  * Create an ethernet address from the system serial number.
540  */
541 static int __init etherm_addr(char *addr)
542 {
543         unsigned int serial;
544
545         if (system_serial_low == 0 && system_serial_high == 0)
546                 return -ENODEV;
547
548         serial = system_serial_low | system_serial_high;
549
550         addr[0] = 0;
551         addr[1] = 0;
552         addr[2] = 0xa4;
553         addr[3] = 0x10 + (serial >> 24);
554         addr[4] = serial >> 16;
555         addr[5] = serial >> 8;
556         return 0;
557 }
558
559 static u32 etherh_regoffsets[16];
560 static u32 etherm_regoffsets[16];
561
562 static int __init
563 etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
564 {
565         const struct etherh_data *data = id->data;
566         struct ei_device *ei_local;
567         struct net_device *dev;
568         struct etherh_priv *eh;
569         int i, ret;
570
571         etherh_banner();
572
573         ret = ecard_request_resources(ec);
574         if (ret)
575                 goto out;
576
577         dev = alloc_ei_netdev();
578         if (!dev) {
579                 ret = -ENOMEM;
580                 goto release;
581         }
582
583         SET_MODULE_OWNER(dev);
584         SET_NETDEV_DEV(dev, &ec->dev);
585
586         dev->open               = etherh_open;
587         dev->stop               = etherh_close;
588         dev->set_config         = etherh_set_config;
589         dev->irq                = ec->irq;
590         dev->if_port            = data->if_port;
591         dev->flags              |= data->flags;
592
593         eh = etherh_priv(dev);
594         eh->ctrl                = 0;
595         eh->id                  = ec->cid.product;
596         eh->memc                = ioremap(ecard_resource_start(ec, ECARD_RES_MEMC), PAGE_SIZE);
597         if (!eh->memc) {
598                 ret = -ENOMEM;
599                 goto free;
600         }
601
602         eh->ctrl_port = eh->memc;
603         if (data->ctrl_ioc) {
604                 eh->ioc_fast = ioremap(ecard_resource_start(ec, ECARD_RES_IOCFAST), PAGE_SIZE);
605                 if (!eh->ioc_fast) {
606                         ret = -ENOMEM;
607                         goto free;
608                 }
609                 eh->ctrl_port = eh->ioc_fast;
610         }
611
612         dev->base_addr = (unsigned long)eh->memc + data->ns8390_offset;
613         dev->mem_start = (unsigned long)eh->memc + data->dataport_offset;
614         eh->ctrl_port += data->ctrlport_offset;
615
616         /*
617          * IRQ and control port handling - only for non-NIC slot cards.
618          */
619         if (ec->slot_no != 8) {
620                 ec->ops         = &etherh_ops;
621                 ec->irq_data    = eh;
622         } else {
623                 /*
624                  * If we're in the NIC slot, make sure the IRQ is enabled
625                  */
626                 etherh_set_ctrl(eh, ETHERH_CP_IE);
627         }
628
629         ei_local = netdev_priv(dev);
630         spin_lock_init(&ei_local->page_lock);
631
632         if (ec->cid.product == PROD_ANT_ETHERM) {
633                 etherm_addr(dev->dev_addr);
634                 ei_local->reg_offset = etherm_regoffsets;
635         } else {
636                 etherh_addr(dev->dev_addr, ec);
637                 ei_local->reg_offset = etherh_regoffsets;
638         }
639
640         ei_local->name          = dev->name;
641         ei_local->word16        = 1;
642         ei_local->tx_start_page = data->tx_start_page;
643         ei_local->rx_start_page = ei_local->tx_start_page + TX_PAGES;
644         ei_local->stop_page     = data->stop_page;
645         ei_local->reset_8390    = etherh_reset;
646         ei_local->block_input   = etherh_block_input;
647         ei_local->block_output  = etherh_block_output;
648         ei_local->get_8390_hdr  = etherh_get_header;
649         ei_local->interface_num = 0;
650
651         etherh_reset(dev);
652         NS8390_init(dev, 0);
653
654         ret = register_netdev(dev);
655         if (ret)
656                 goto free;
657
658         printk(KERN_INFO "%s: %s in slot %d, ",
659                 dev->name, data->name, ec->slot_no);
660
661         for (i = 0; i < 6; i++)
662                 printk("%2.2x%c", dev->dev_addr[i], i == 5 ? '\n' : ':');
663
664         ecard_set_drvdata(ec, dev);
665
666         return 0;
667
668  free:
669         if (eh->ioc_fast)
670                 iounmap(eh->ioc_fast);
671         if (eh->memc)
672                 iounmap(eh->memc);
673         free_netdev(dev);
674  release:
675         ecard_release_resources(ec);
676  out:
677         return ret;
678 }
679
680 static void __devexit etherh_remove(struct expansion_card *ec)
681 {
682         struct net_device *dev = ecard_get_drvdata(ec);
683         struct etherh_priv *eh = etherh_priv(dev);
684
685         ecard_set_drvdata(ec, NULL);
686
687         unregister_netdev(dev);
688         ec->ops = NULL;
689
690         if (eh->ioc_fast)
691                 iounmap(eh->ioc_fast);
692         iounmap(eh->memc);
693
694         free_netdev(dev);
695
696         ecard_release_resources(ec);
697 }
698
699 static struct etherh_data etherm_data = {
700         .ns8390_offset          = ETHERM_NS8390,
701         .dataport_offset        = ETHERM_NS8390 + ETHERM_DATAPORT,
702         .ctrlport_offset        = ETHERM_NS8390 + ETHERM_CTRLPORT,
703         .name                   = "ANT EtherM",
704         .if_port                = IF_PORT_UNKNOWN,
705         .tx_start_page          = ETHERM_TX_START_PAGE,
706         .stop_page              = ETHERM_STOP_PAGE,
707 };
708
709 static struct etherh_data etherlan500_data = {
710         .ns8390_offset          = ETHERH500_NS8390,
711         .dataport_offset        = ETHERH500_NS8390 + ETHERH500_DATAPORT,
712         .ctrlport_offset        = ETHERH500_CTRLPORT,
713         .ctrl_ioc               = 1,
714         .name                   = "i3 EtherH 500",
715         .if_port                = IF_PORT_UNKNOWN,
716         .tx_start_page          = ETHERH_TX_START_PAGE,
717         .stop_page              = ETHERH_STOP_PAGE,
718 };
719
720 static struct etherh_data etherlan600_data = {
721         .ns8390_offset          = ETHERH600_NS8390,
722         .dataport_offset        = ETHERH600_NS8390 + ETHERH600_DATAPORT,
723         .ctrlport_offset        = ETHERH600_NS8390 + ETHERH600_CTRLPORT,
724         .name                   = "i3 EtherH 600",
725         .flags                  = IFF_PORTSEL | IFF_AUTOMEDIA,
726         .if_port                = IF_PORT_10BASET,
727         .tx_start_page          = ETHERH_TX_START_PAGE,
728         .stop_page              = ETHERH_STOP_PAGE,
729 };
730
731 static struct etherh_data etherlan600a_data = {
732         .ns8390_offset          = ETHERH600_NS8390,
733         .dataport_offset        = ETHERH600_NS8390 + ETHERH600_DATAPORT,
734         .ctrlport_offset        = ETHERH600_NS8390 + ETHERH600_CTRLPORT,
735         .name                   = "i3 EtherH 600A",
736         .flags                  = IFF_PORTSEL | IFF_AUTOMEDIA,
737         .if_port                = IF_PORT_10BASET,
738         .tx_start_page          = ETHERH_TX_START_PAGE,
739         .stop_page              = ETHERH_STOP_PAGE,
740 };
741
742 static const struct ecard_id etherh_ids[] = {
743         { MANU_ANT, PROD_ANT_ETHERM,      &etherm_data       },
744         { MANU_I3,  PROD_I3_ETHERLAN500,  &etherlan500_data  },
745         { MANU_I3,  PROD_I3_ETHERLAN600,  &etherlan600_data  },
746         { MANU_I3,  PROD_I3_ETHERLAN600A, &etherlan600a_data },
747         { 0xffff,   0xffff }
748 };
749
750 static struct ecard_driver etherh_driver = {
751         .probe          = etherh_probe,
752         .remove         = __devexit_p(etherh_remove),
753         .id_table       = etherh_ids,
754         .drv = {
755                 .name   = "etherh",
756         },
757 };
758
759 static int __init etherh_init(void)
760 {
761         int i;
762
763         for (i = 0; i < 16; i++) {
764                 etherh_regoffsets[i] = i << 2;
765                 etherm_regoffsets[i] = i << 5;
766         }
767
768         return ecard_register_driver(&etherh_driver);
769 }
770
771 static void __exit etherh_exit(void)
772 {
773         ecard_remove_driver(&etherh_driver);
774 }
775
776 module_init(etherh_init);
777 module_exit(etherh_exit);