kbuild: document howto build external modules using several directories
[linux-2.6/verdex.git] / drivers / net / arm / etherh.c
blob942a2819576c2efe229c6c6cb71fc4a9c9d79b4f
1 /*
2 * linux/drivers/acorn/net/etherh.c
4 * Copyright (C) 2000-2002 Russell King
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.
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.
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.
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/ethtool.h>
44 #include <linux/skbuff.h>
45 #include <linux/delay.h>
46 #include <linux/device.h>
47 #include <linux/init.h>
48 #include <linux/bitops.h>
50 #include <asm/system.h>
51 #include <asm/ecard.h>
52 #include <asm/io.h>
53 #include <asm/irq.h>
55 #include "../8390.h"
57 #define NET_DEBUG 0
58 #define DEBUG_INIT 2
60 #define DRV_NAME "etherh"
61 #define DRV_VERSION "1.11"
63 static unsigned int net_debug = NET_DEBUG;
65 struct etherh_priv {
66 void __iomem *ioc_fast;
67 void __iomem *memc;
68 void __iomem *dma_base;
69 unsigned int id;
70 void __iomem *ctrl_port;
71 unsigned char ctrl;
72 u32 supported;
75 struct etherh_data {
76 unsigned long ns8390_offset;
77 unsigned long dataport_offset;
78 unsigned long ctrlport_offset;
79 int ctrl_ioc;
80 const char name[16];
81 u32 supported;
82 unsigned char tx_start_page;
83 unsigned char stop_page;
86 MODULE_AUTHOR("Russell King");
87 MODULE_DESCRIPTION("EtherH/EtherM driver");
88 MODULE_LICENSE("GPL");
90 static char version[] __initdata =
91 "EtherH/EtherM Driver (c) 2002-2004 Russell King " DRV_VERSION "\n";
93 #define ETHERH500_DATAPORT 0x800 /* MEMC */
94 #define ETHERH500_NS8390 0x000 /* MEMC */
95 #define ETHERH500_CTRLPORT 0x800 /* IOC */
97 #define ETHERH600_DATAPORT 0x040 /* MEMC */
98 #define ETHERH600_NS8390 0x800 /* MEMC */
99 #define ETHERH600_CTRLPORT 0x200 /* MEMC */
101 #define ETHERH_CP_IE 1
102 #define ETHERH_CP_IF 2
103 #define ETHERH_CP_HEARTBEAT 2
105 #define ETHERH_TX_START_PAGE 1
106 #define ETHERH_STOP_PAGE 127
109 * These came from CK/TEW
111 #define ETHERM_DATAPORT 0x200 /* MEMC */
112 #define ETHERM_NS8390 0x800 /* MEMC */
113 #define ETHERM_CTRLPORT 0x23c /* MEMC */
115 #define ETHERM_TX_START_PAGE 64
116 #define ETHERM_STOP_PAGE 127
118 /* ------------------------------------------------------------------------ */
120 #define etherh_priv(dev) \
121 ((struct etherh_priv *)(((char *)netdev_priv(dev)) + sizeof(struct ei_device)))
123 static inline void etherh_set_ctrl(struct etherh_priv *eh, unsigned char mask)
125 unsigned char ctrl = eh->ctrl | mask;
126 eh->ctrl = ctrl;
127 writeb(ctrl, eh->ctrl_port);
130 static inline void etherh_clr_ctrl(struct etherh_priv *eh, unsigned char mask)
132 unsigned char ctrl = eh->ctrl & ~mask;
133 eh->ctrl = ctrl;
134 writeb(ctrl, eh->ctrl_port);
137 static inline unsigned int etherh_get_stat(struct etherh_priv *eh)
139 return readb(eh->ctrl_port);
145 static void etherh_irq_enable(ecard_t *ec, int irqnr)
147 struct etherh_priv *eh = ec->irq_data;
149 etherh_set_ctrl(eh, ETHERH_CP_IE);
152 static void etherh_irq_disable(ecard_t *ec, int irqnr)
154 struct etherh_priv *eh = ec->irq_data;
156 etherh_clr_ctrl(eh, ETHERH_CP_IE);
159 static expansioncard_ops_t etherh_ops = {
160 .irqenable = etherh_irq_enable,
161 .irqdisable = etherh_irq_disable,
167 static void
168 etherh_setif(struct net_device *dev)
170 struct ei_device *ei_local = netdev_priv(dev);
171 unsigned long flags;
172 void __iomem *addr;
174 local_irq_save(flags);
176 /* set the interface type */
177 switch (etherh_priv(dev)->id) {
178 case PROD_I3_ETHERLAN600:
179 case PROD_I3_ETHERLAN600A:
180 addr = (void *)dev->base_addr + EN0_RCNTHI;
182 switch (dev->if_port) {
183 case IF_PORT_10BASE2:
184 writeb((readb(addr) & 0xf8) | 1, addr);
185 break;
186 case IF_PORT_10BASET:
187 writeb((readb(addr) & 0xf8), addr);
188 break;
190 break;
192 case PROD_I3_ETHERLAN500:
193 switch (dev->if_port) {
194 case IF_PORT_10BASE2:
195 etherh_clr_ctrl(etherh_priv(dev), ETHERH_CP_IF);
196 break;
198 case IF_PORT_10BASET:
199 etherh_set_ctrl(etherh_priv(dev), ETHERH_CP_IF);
200 break;
202 break;
204 default:
205 break;
208 local_irq_restore(flags);
211 static int
212 etherh_getifstat(struct net_device *dev)
214 struct ei_device *ei_local = netdev_priv(dev);
215 void __iomem *addr;
216 int stat = 0;
218 switch (etherh_priv(dev)->id) {
219 case PROD_I3_ETHERLAN600:
220 case PROD_I3_ETHERLAN600A:
221 addr = (void *)dev->base_addr + EN0_RCNTHI;
222 switch (dev->if_port) {
223 case IF_PORT_10BASE2:
224 stat = 1;
225 break;
226 case IF_PORT_10BASET:
227 stat = readb(addr) & 4;
228 break;
230 break;
232 case PROD_I3_ETHERLAN500:
233 switch (dev->if_port) {
234 case IF_PORT_10BASE2:
235 stat = 1;
236 break;
237 case IF_PORT_10BASET:
238 stat = etherh_get_stat(etherh_priv(dev)) & ETHERH_CP_HEARTBEAT;
239 break;
241 break;
243 default:
244 stat = 0;
245 break;
248 return stat != 0;
252 * Configure the interface. Note that we ignore the other
253 * parts of ifmap, since its mostly meaningless for this driver.
255 static int etherh_set_config(struct net_device *dev, struct ifmap *map)
257 switch (map->port) {
258 case IF_PORT_10BASE2:
259 case IF_PORT_10BASET:
261 * If the user explicitly sets the interface
262 * media type, turn off automedia detection.
264 dev->flags &= ~IFF_AUTOMEDIA;
265 dev->if_port = map->port;
266 break;
268 default:
269 return -EINVAL;
272 etherh_setif(dev);
274 return 0;
278 * Reset the 8390 (hard reset). Note that we can't actually do this.
280 static void
281 etherh_reset(struct net_device *dev)
283 struct ei_device *ei_local = netdev_priv(dev);
284 void __iomem *addr = (void *)dev->base_addr;
286 writeb(E8390_NODMA+E8390_PAGE0+E8390_STOP, addr);
289 * See if we need to change the interface type.
290 * Note that we use 'interface_num' as a flag
291 * to indicate that we need to change the media.
293 if (dev->flags & IFF_AUTOMEDIA && ei_local->interface_num) {
294 ei_local->interface_num = 0;
296 if (dev->if_port == IF_PORT_10BASET)
297 dev->if_port = IF_PORT_10BASE2;
298 else
299 dev->if_port = IF_PORT_10BASET;
301 etherh_setif(dev);
306 * Write a block of data out to the 8390
308 static void
309 etherh_block_output (struct net_device *dev, int count, const unsigned char *buf, int start_page)
311 struct ei_device *ei_local = netdev_priv(dev);
312 unsigned long dma_start;
313 void __iomem *dma_base, *addr;
315 if (ei_local->dmaing) {
316 printk(KERN_ERR "%s: DMAing conflict in etherh_block_input: "
317 " DMAstat %d irqlock %d\n", dev->name,
318 ei_local->dmaing, ei_local->irqlock);
319 return;
323 * Make sure we have a round number of bytes if we're in word mode.
325 if (count & 1 && ei_local->word16)
326 count++;
328 ei_local->dmaing = 1;
330 addr = (void *)dev->base_addr;
331 dma_base = etherh_priv(dev)->dma_base;
333 count = (count + 1) & ~1;
334 writeb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD);
336 writeb (0x42, addr + EN0_RCNTLO);
337 writeb (0x00, addr + EN0_RCNTHI);
338 writeb (0x42, addr + EN0_RSARLO);
339 writeb (0x00, addr + EN0_RSARHI);
340 writeb (E8390_RREAD | E8390_START, addr + E8390_CMD);
342 udelay (1);
344 writeb (ENISR_RDC, addr + EN0_ISR);
345 writeb (count, addr + EN0_RCNTLO);
346 writeb (count >> 8, addr + EN0_RCNTHI);
347 writeb (0, addr + EN0_RSARLO);
348 writeb (start_page, addr + EN0_RSARHI);
349 writeb (E8390_RWRITE | E8390_START, addr + E8390_CMD);
351 if (ei_local->word16)
352 writesw (dma_base, buf, count >> 1);
353 else
354 writesb (dma_base, buf, count);
356 dma_start = jiffies;
358 while ((readb (addr + EN0_ISR) & ENISR_RDC) == 0)
359 if (jiffies - dma_start > 2*HZ/100) { /* 20ms */
360 printk(KERN_ERR "%s: timeout waiting for TX RDC\n",
361 dev->name);
362 etherh_reset (dev);
363 NS8390_init (dev, 1);
364 break;
367 writeb (ENISR_RDC, addr + EN0_ISR);
368 ei_local->dmaing = 0;
372 * Read a block of data from the 8390
374 static void
375 etherh_block_input (struct net_device *dev, int count, struct sk_buff *skb, int ring_offset)
377 struct ei_device *ei_local = netdev_priv(dev);
378 unsigned char *buf;
379 void __iomem *dma_base, *addr;
381 if (ei_local->dmaing) {
382 printk(KERN_ERR "%s: DMAing conflict in etherh_block_input: "
383 " DMAstat %d irqlock %d\n", dev->name,
384 ei_local->dmaing, ei_local->irqlock);
385 return;
388 ei_local->dmaing = 1;
390 addr = (void *)dev->base_addr;
391 dma_base = etherh_priv(dev)->dma_base;
393 buf = skb->data;
394 writeb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD);
395 writeb (count, addr + EN0_RCNTLO);
396 writeb (count >> 8, addr + EN0_RCNTHI);
397 writeb (ring_offset, addr + EN0_RSARLO);
398 writeb (ring_offset >> 8, addr + EN0_RSARHI);
399 writeb (E8390_RREAD | E8390_START, addr + E8390_CMD);
401 if (ei_local->word16) {
402 readsw (dma_base, buf, count >> 1);
403 if (count & 1)
404 buf[count - 1] = readb (dma_base);
405 } else
406 readsb (dma_base, buf, count);
408 writeb (ENISR_RDC, addr + EN0_ISR);
409 ei_local->dmaing = 0;
413 * Read a header from the 8390
415 static void
416 etherh_get_header (struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page)
418 struct ei_device *ei_local = netdev_priv(dev);
419 void __iomem *dma_base, *addr;
421 if (ei_local->dmaing) {
422 printk(KERN_ERR "%s: DMAing conflict in etherh_get_header: "
423 " DMAstat %d irqlock %d\n", dev->name,
424 ei_local->dmaing, ei_local->irqlock);
425 return;
428 ei_local->dmaing = 1;
430 addr = (void *)dev->base_addr;
431 dma_base = etherh_priv(dev)->dma_base;
433 writeb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD);
434 writeb (sizeof (*hdr), addr + EN0_RCNTLO);
435 writeb (0, addr + EN0_RCNTHI);
436 writeb (0, addr + EN0_RSARLO);
437 writeb (ring_page, addr + EN0_RSARHI);
438 writeb (E8390_RREAD | E8390_START, addr + E8390_CMD);
440 if (ei_local->word16)
441 readsw (dma_base, hdr, sizeof (*hdr) >> 1);
442 else
443 readsb (dma_base, hdr, sizeof (*hdr));
445 writeb (ENISR_RDC, addr + EN0_ISR);
446 ei_local->dmaing = 0;
450 * Open/initialize the board. This is called (in the current kernel)
451 * sometime after booting when the 'ifconfig' program is run.
453 * This routine should set everything up anew at each open, even
454 * registers that "should" only need to be set once at boot, so that
455 * there is non-reboot way to recover if something goes wrong.
457 static int
458 etherh_open(struct net_device *dev)
460 struct ei_device *ei_local = netdev_priv(dev);
462 if (!is_valid_ether_addr(dev->dev_addr)) {
463 printk(KERN_WARNING "%s: invalid ethernet MAC address\n",
464 dev->name);
465 return -EINVAL;
468 if (request_irq(dev->irq, ei_interrupt, 0, dev->name, dev))
469 return -EAGAIN;
472 * Make sure that we aren't going to change the
473 * media type on the next reset - we are about to
474 * do automedia manually now.
476 ei_local->interface_num = 0;
479 * If we are doing automedia detection, do it now.
480 * This is more reliable than the 8390's detection.
482 if (dev->flags & IFF_AUTOMEDIA) {
483 dev->if_port = IF_PORT_10BASET;
484 etherh_setif(dev);
485 mdelay(1);
486 if (!etherh_getifstat(dev)) {
487 dev->if_port = IF_PORT_10BASE2;
488 etherh_setif(dev);
490 } else
491 etherh_setif(dev);
493 etherh_reset(dev);
494 ei_open(dev);
496 return 0;
500 * The inverse routine to etherh_open().
502 static int
503 etherh_close(struct net_device *dev)
505 ei_close (dev);
506 free_irq (dev->irq, dev);
507 return 0;
511 * Initialisation
514 static void __init etherh_banner(void)
516 static int version_printed;
518 if (net_debug && version_printed++ == 0)
519 printk(KERN_INFO "%s", version);
523 * Read the ethernet address string from the on board rom.
524 * This is an ascii string...
526 static int __init etherh_addr(char *addr, struct expansion_card *ec)
528 struct in_chunk_dir cd;
529 char *s;
531 if (!ecard_readchunk(&cd, ec, 0xf5, 0)) {
532 printk(KERN_ERR "%s: unable to read podule description string\n",
533 ec->dev.bus_id);
534 goto no_addr;
537 s = strchr(cd.d.string, '(');
538 if (s) {
539 int i;
541 for (i = 0; i < 6; i++) {
542 addr[i] = simple_strtoul(s + 1, &s, 0x10);
543 if (*s != (i == 5? ')' : ':'))
544 break;
547 if (i == 6)
548 return 0;
551 printk(KERN_ERR "%s: unable to parse MAC address: %s\n",
552 ec->dev.bus_id, cd.d.string);
554 no_addr:
555 return -ENODEV;
559 * Create an ethernet address from the system serial number.
561 static int __init etherm_addr(char *addr)
563 unsigned int serial;
565 if (system_serial_low == 0 && system_serial_high == 0)
566 return -ENODEV;
568 serial = system_serial_low | system_serial_high;
570 addr[0] = 0;
571 addr[1] = 0;
572 addr[2] = 0xa4;
573 addr[3] = 0x10 + (serial >> 24);
574 addr[4] = serial >> 16;
575 addr[5] = serial >> 8;
576 return 0;
579 static void etherh_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
581 strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
582 strlcpy(info->version, DRV_VERSION, sizeof(info->version));
583 strlcpy(info->bus_info, dev->class_dev.dev->bus_id,
584 sizeof(info->bus_info));
587 static int etherh_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
589 cmd->supported = etherh_priv(dev)->supported;
590 cmd->speed = SPEED_10;
591 cmd->duplex = DUPLEX_HALF;
592 cmd->port = dev->if_port == IF_PORT_10BASET ? PORT_TP : PORT_BNC;
593 cmd->autoneg = dev->flags & IFF_AUTOMEDIA ? AUTONEG_ENABLE : AUTONEG_DISABLE;
594 return 0;
597 static int etherh_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
599 switch (cmd->autoneg) {
600 case AUTONEG_ENABLE:
601 dev->flags |= IFF_AUTOMEDIA;
602 break;
604 case AUTONEG_DISABLE:
605 switch (cmd->port) {
606 case PORT_TP:
607 dev->if_port = IF_PORT_10BASET;
608 break;
610 case PORT_BNC:
611 dev->if_port = IF_PORT_10BASE2;
612 break;
614 default:
615 return -EINVAL;
617 dev->flags &= ~IFF_AUTOMEDIA;
618 break;
620 default:
621 return -EINVAL;
624 etherh_setif(dev);
626 return 0;
629 static struct ethtool_ops etherh_ethtool_ops = {
630 .get_settings = etherh_get_settings,
631 .set_settings = etherh_set_settings,
632 .get_drvinfo = etherh_get_drvinfo,
635 static u32 etherh_regoffsets[16];
636 static u32 etherm_regoffsets[16];
638 static int __init
639 etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
641 const struct etherh_data *data = id->data;
642 struct ei_device *ei_local;
643 struct net_device *dev;
644 struct etherh_priv *eh;
645 int i, ret;
647 etherh_banner();
649 ret = ecard_request_resources(ec);
650 if (ret)
651 goto out;
653 dev = __alloc_ei_netdev(sizeof(struct etherh_priv));
654 if (!dev) {
655 ret = -ENOMEM;
656 goto release;
659 SET_MODULE_OWNER(dev);
660 SET_NETDEV_DEV(dev, &ec->dev);
662 dev->open = etherh_open;
663 dev->stop = etherh_close;
664 dev->set_config = etherh_set_config;
665 dev->irq = ec->irq;
666 dev->ethtool_ops = &etherh_ethtool_ops;
668 if (data->supported & SUPPORTED_Autoneg)
669 dev->flags |= IFF_AUTOMEDIA;
670 if (data->supported & SUPPORTED_TP) {
671 dev->flags |= IFF_PORTSEL;
672 dev->if_port = IF_PORT_10BASET;
673 } else if (data->supported & SUPPORTED_BNC) {
674 dev->flags |= IFF_PORTSEL;
675 dev->if_port = IF_PORT_10BASE2;
676 } else
677 dev->if_port = IF_PORT_UNKNOWN;
679 eh = etherh_priv(dev);
680 eh->supported = data->supported;
681 eh->ctrl = 0;
682 eh->id = ec->cid.product;
683 eh->memc = ioremap(ecard_resource_start(ec, ECARD_RES_MEMC), PAGE_SIZE);
684 if (!eh->memc) {
685 ret = -ENOMEM;
686 goto free;
689 eh->ctrl_port = eh->memc;
690 if (data->ctrl_ioc) {
691 eh->ioc_fast = ioremap(ecard_resource_start(ec, ECARD_RES_IOCFAST), PAGE_SIZE);
692 if (!eh->ioc_fast) {
693 ret = -ENOMEM;
694 goto free;
696 eh->ctrl_port = eh->ioc_fast;
699 dev->base_addr = (unsigned long)eh->memc + data->ns8390_offset;
700 eh->dma_base = eh->memc + data->dataport_offset;
701 eh->ctrl_port += data->ctrlport_offset;
704 * IRQ and control port handling - only for non-NIC slot cards.
706 if (ec->slot_no != 8) {
707 ec->ops = &etherh_ops;
708 ec->irq_data = eh;
709 } else {
711 * If we're in the NIC slot, make sure the IRQ is enabled
713 etherh_set_ctrl(eh, ETHERH_CP_IE);
716 ei_local = netdev_priv(dev);
717 spin_lock_init(&ei_local->page_lock);
719 if (ec->cid.product == PROD_ANT_ETHERM) {
720 etherm_addr(dev->dev_addr);
721 ei_local->reg_offset = etherm_regoffsets;
722 } else {
723 etherh_addr(dev->dev_addr, ec);
724 ei_local->reg_offset = etherh_regoffsets;
727 ei_local->name = dev->name;
728 ei_local->word16 = 1;
729 ei_local->tx_start_page = data->tx_start_page;
730 ei_local->rx_start_page = ei_local->tx_start_page + TX_PAGES;
731 ei_local->stop_page = data->stop_page;
732 ei_local->reset_8390 = etherh_reset;
733 ei_local->block_input = etherh_block_input;
734 ei_local->block_output = etherh_block_output;
735 ei_local->get_8390_hdr = etherh_get_header;
736 ei_local->interface_num = 0;
738 etherh_reset(dev);
739 NS8390_init(dev, 0);
741 ret = register_netdev(dev);
742 if (ret)
743 goto free;
745 printk(KERN_INFO "%s: %s in slot %d, ",
746 dev->name, data->name, ec->slot_no);
748 for (i = 0; i < 6; i++)
749 printk("%2.2x%c", dev->dev_addr[i], i == 5 ? '\n' : ':');
751 ecard_set_drvdata(ec, dev);
753 return 0;
755 free:
756 if (eh->ioc_fast)
757 iounmap(eh->ioc_fast);
758 if (eh->memc)
759 iounmap(eh->memc);
760 free_netdev(dev);
761 release:
762 ecard_release_resources(ec);
763 out:
764 return ret;
767 static void __devexit etherh_remove(struct expansion_card *ec)
769 struct net_device *dev = ecard_get_drvdata(ec);
770 struct etherh_priv *eh = etherh_priv(dev);
772 ecard_set_drvdata(ec, NULL);
774 unregister_netdev(dev);
775 ec->ops = NULL;
777 if (eh->ioc_fast)
778 iounmap(eh->ioc_fast);
779 iounmap(eh->memc);
781 free_netdev(dev);
783 ecard_release_resources(ec);
786 static struct etherh_data etherm_data = {
787 .ns8390_offset = ETHERM_NS8390,
788 .dataport_offset = ETHERM_NS8390 + ETHERM_DATAPORT,
789 .ctrlport_offset = ETHERM_NS8390 + ETHERM_CTRLPORT,
790 .name = "ANT EtherM",
791 .supported = SUPPORTED_10baseT_Half,
792 .tx_start_page = ETHERM_TX_START_PAGE,
793 .stop_page = ETHERM_STOP_PAGE,
796 static struct etherh_data etherlan500_data = {
797 .ns8390_offset = ETHERH500_NS8390,
798 .dataport_offset = ETHERH500_NS8390 + ETHERH500_DATAPORT,
799 .ctrlport_offset = ETHERH500_CTRLPORT,
800 .ctrl_ioc = 1,
801 .name = "i3 EtherH 500",
802 .supported = SUPPORTED_10baseT_Half,
803 .tx_start_page = ETHERH_TX_START_PAGE,
804 .stop_page = ETHERH_STOP_PAGE,
807 static struct etherh_data etherlan600_data = {
808 .ns8390_offset = ETHERH600_NS8390,
809 .dataport_offset = ETHERH600_NS8390 + ETHERH600_DATAPORT,
810 .ctrlport_offset = ETHERH600_NS8390 + ETHERH600_CTRLPORT,
811 .name = "i3 EtherH 600",
812 .supported = SUPPORTED_10baseT_Half | SUPPORTED_TP | SUPPORTED_BNC | SUPPORTED_Autoneg,
813 .tx_start_page = ETHERH_TX_START_PAGE,
814 .stop_page = ETHERH_STOP_PAGE,
817 static struct etherh_data etherlan600a_data = {
818 .ns8390_offset = ETHERH600_NS8390,
819 .dataport_offset = ETHERH600_NS8390 + ETHERH600_DATAPORT,
820 .ctrlport_offset = ETHERH600_NS8390 + ETHERH600_CTRLPORT,
821 .name = "i3 EtherH 600A",
822 .supported = SUPPORTED_10baseT_Half | SUPPORTED_TP | SUPPORTED_BNC | SUPPORTED_Autoneg,
823 .tx_start_page = ETHERH_TX_START_PAGE,
824 .stop_page = ETHERH_STOP_PAGE,
827 static const struct ecard_id etherh_ids[] = {
828 { MANU_ANT, PROD_ANT_ETHERM, &etherm_data },
829 { MANU_I3, PROD_I3_ETHERLAN500, &etherlan500_data },
830 { MANU_I3, PROD_I3_ETHERLAN600, &etherlan600_data },
831 { MANU_I3, PROD_I3_ETHERLAN600A, &etherlan600a_data },
832 { 0xffff, 0xffff }
835 static struct ecard_driver etherh_driver = {
836 .probe = etherh_probe,
837 .remove = __devexit_p(etherh_remove),
838 .id_table = etherh_ids,
839 .drv = {
840 .name = DRV_NAME,
844 static int __init etherh_init(void)
846 int i;
848 for (i = 0; i < 16; i++) {
849 etherh_regoffsets[i] = i << 2;
850 etherm_regoffsets[i] = i << 5;
853 return ecard_register_driver(&etherh_driver);
856 static void __exit etherh_exit(void)
858 ecard_remove_driver(&etherh_driver);
861 module_init(etherh_init);
862 module_exit(etherh_exit);