| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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/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> | 
| Marcelo Feitoza Parisi | ff5688a | 2006-01-09 18:37:15 -0800 | [diff] [blame] | 49 | #include <linux/jiffies.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 |  | 
|  | 51 | #include <asm/system.h> | 
|  | 52 | #include <asm/ecard.h> | 
|  | 53 | #include <asm/io.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 |  | 
| Al Viro | 6c3561b | 2006-10-10 00:19:36 +0100 | [diff] [blame] | 55 | #define EI_SHIFT(x)	(ei_local->reg_offset[x]) | 
|  | 56 |  | 
| Al Viro | b936889 | 2006-10-10 00:19:36 +0100 | [diff] [blame] | 57 | #define ei_inb(_p)	 readb((void __iomem *)_p) | 
|  | 58 | #define ei_outb(_v,_p)	 writeb(_v,(void __iomem *)_p) | 
|  | 59 | #define ei_inb_p(_p)	 readb((void __iomem *)_p) | 
|  | 60 | #define ei_outb_p(_v,_p) writeb(_v,(void __iomem *)_p) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 |  | 
|  | 62 | #define NET_DEBUG  0 | 
|  | 63 | #define DEBUG_INIT 2 | 
|  | 64 |  | 
|  | 65 | #define DRV_NAME	"etherh" | 
|  | 66 | #define DRV_VERSION	"1.11" | 
|  | 67 |  | 
| Al Viro | 6c3561b | 2006-10-10 00:19:36 +0100 | [diff] [blame] | 68 | static char version[] __initdata = | 
|  | 69 | "EtherH/EtherM Driver (c) 2002-2004 Russell King " DRV_VERSION "\n"; | 
|  | 70 |  | 
|  | 71 | #include "../lib8390.c" | 
|  | 72 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | static unsigned int net_debug = NET_DEBUG; | 
|  | 74 |  | 
|  | 75 | struct etherh_priv { | 
|  | 76 | void __iomem	*ioc_fast; | 
|  | 77 | void __iomem	*memc; | 
|  | 78 | void __iomem	*dma_base; | 
|  | 79 | unsigned int	id; | 
|  | 80 | void __iomem	*ctrl_port; | 
|  | 81 | unsigned char	ctrl; | 
|  | 82 | u32		supported; | 
|  | 83 | }; | 
|  | 84 |  | 
|  | 85 | struct etherh_data { | 
|  | 86 | unsigned long	ns8390_offset; | 
|  | 87 | unsigned long	dataport_offset; | 
|  | 88 | unsigned long	ctrlport_offset; | 
|  | 89 | int		ctrl_ioc; | 
|  | 90 | const char	name[16]; | 
|  | 91 | u32		supported; | 
|  | 92 | unsigned char	tx_start_page; | 
|  | 93 | unsigned char	stop_page; | 
|  | 94 | }; | 
|  | 95 |  | 
|  | 96 | MODULE_AUTHOR("Russell King"); | 
|  | 97 | MODULE_DESCRIPTION("EtherH/EtherM driver"); | 
|  | 98 | MODULE_LICENSE("GPL"); | 
|  | 99 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | #define ETHERH500_DATAPORT	0x800	/* MEMC */ | 
|  | 101 | #define ETHERH500_NS8390	0x000	/* MEMC */ | 
|  | 102 | #define ETHERH500_CTRLPORT	0x800	/* IOC  */ | 
|  | 103 |  | 
|  | 104 | #define ETHERH600_DATAPORT	0x040	/* MEMC */ | 
|  | 105 | #define ETHERH600_NS8390	0x800	/* MEMC */ | 
|  | 106 | #define ETHERH600_CTRLPORT	0x200	/* MEMC */ | 
|  | 107 |  | 
|  | 108 | #define ETHERH_CP_IE		1 | 
|  | 109 | #define ETHERH_CP_IF		2 | 
|  | 110 | #define ETHERH_CP_HEARTBEAT	2 | 
|  | 111 |  | 
|  | 112 | #define ETHERH_TX_START_PAGE	1 | 
|  | 113 | #define ETHERH_STOP_PAGE	127 | 
|  | 114 |  | 
|  | 115 | /* | 
|  | 116 | * These came from CK/TEW | 
|  | 117 | */ | 
|  | 118 | #define ETHERM_DATAPORT		0x200	/* MEMC */ | 
|  | 119 | #define ETHERM_NS8390		0x800	/* MEMC */ | 
|  | 120 | #define ETHERM_CTRLPORT		0x23c	/* MEMC */ | 
|  | 121 |  | 
|  | 122 | #define ETHERM_TX_START_PAGE	64 | 
|  | 123 | #define ETHERM_STOP_PAGE	127 | 
|  | 124 |  | 
|  | 125 | /* ------------------------------------------------------------------------ */ | 
|  | 126 |  | 
|  | 127 | #define etherh_priv(dev) \ | 
|  | 128 | ((struct etherh_priv *)(((char *)netdev_priv(dev)) + sizeof(struct ei_device))) | 
|  | 129 |  | 
|  | 130 | static inline void etherh_set_ctrl(struct etherh_priv *eh, unsigned char mask) | 
|  | 131 | { | 
|  | 132 | unsigned char ctrl = eh->ctrl | mask; | 
|  | 133 | eh->ctrl = ctrl; | 
|  | 134 | writeb(ctrl, eh->ctrl_port); | 
|  | 135 | } | 
|  | 136 |  | 
|  | 137 | static inline void etherh_clr_ctrl(struct etherh_priv *eh, unsigned char mask) | 
|  | 138 | { | 
|  | 139 | unsigned char ctrl = eh->ctrl & ~mask; | 
|  | 140 | eh->ctrl = ctrl; | 
|  | 141 | writeb(ctrl, eh->ctrl_port); | 
|  | 142 | } | 
|  | 143 |  | 
|  | 144 | static inline unsigned int etherh_get_stat(struct etherh_priv *eh) | 
|  | 145 | { | 
|  | 146 | return readb(eh->ctrl_port); | 
|  | 147 | } | 
|  | 148 |  | 
|  | 149 |  | 
|  | 150 |  | 
|  | 151 |  | 
|  | 152 | static void etherh_irq_enable(ecard_t *ec, int irqnr) | 
|  | 153 | { | 
|  | 154 | struct etherh_priv *eh = ec->irq_data; | 
|  | 155 |  | 
|  | 156 | etherh_set_ctrl(eh, ETHERH_CP_IE); | 
|  | 157 | } | 
|  | 158 |  | 
|  | 159 | static void etherh_irq_disable(ecard_t *ec, int irqnr) | 
|  | 160 | { | 
|  | 161 | struct etherh_priv *eh = ec->irq_data; | 
|  | 162 |  | 
|  | 163 | etherh_clr_ctrl(eh, ETHERH_CP_IE); | 
|  | 164 | } | 
|  | 165 |  | 
|  | 166 | static expansioncard_ops_t etherh_ops = { | 
|  | 167 | .irqenable	= etherh_irq_enable, | 
|  | 168 | .irqdisable	= etherh_irq_disable, | 
|  | 169 | }; | 
|  | 170 |  | 
|  | 171 |  | 
|  | 172 |  | 
|  | 173 |  | 
|  | 174 | static void | 
|  | 175 | etherh_setif(struct net_device *dev) | 
|  | 176 | { | 
|  | 177 | struct ei_device *ei_local = netdev_priv(dev); | 
|  | 178 | unsigned long flags; | 
|  | 179 | void __iomem *addr; | 
|  | 180 |  | 
|  | 181 | local_irq_save(flags); | 
|  | 182 |  | 
|  | 183 | /* set the interface type */ | 
|  | 184 | switch (etherh_priv(dev)->id) { | 
|  | 185 | case PROD_I3_ETHERLAN600: | 
|  | 186 | case PROD_I3_ETHERLAN600A: | 
| Al Viro | b936889 | 2006-10-10 00:19:36 +0100 | [diff] [blame] | 187 | addr = (void __iomem *)dev->base_addr + EN0_RCNTHI; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 |  | 
|  | 189 | switch (dev->if_port) { | 
|  | 190 | case IF_PORT_10BASE2: | 
|  | 191 | writeb((readb(addr) & 0xf8) | 1, addr); | 
|  | 192 | break; | 
|  | 193 | case IF_PORT_10BASET: | 
|  | 194 | writeb((readb(addr) & 0xf8), addr); | 
|  | 195 | break; | 
|  | 196 | } | 
|  | 197 | break; | 
|  | 198 |  | 
|  | 199 | case PROD_I3_ETHERLAN500: | 
|  | 200 | switch (dev->if_port) { | 
|  | 201 | case IF_PORT_10BASE2: | 
|  | 202 | etherh_clr_ctrl(etherh_priv(dev), ETHERH_CP_IF); | 
|  | 203 | break; | 
|  | 204 |  | 
|  | 205 | case IF_PORT_10BASET: | 
|  | 206 | etherh_set_ctrl(etherh_priv(dev), ETHERH_CP_IF); | 
|  | 207 | break; | 
|  | 208 | } | 
|  | 209 | break; | 
|  | 210 |  | 
|  | 211 | default: | 
|  | 212 | break; | 
|  | 213 | } | 
|  | 214 |  | 
|  | 215 | local_irq_restore(flags); | 
|  | 216 | } | 
|  | 217 |  | 
|  | 218 | static int | 
|  | 219 | etherh_getifstat(struct net_device *dev) | 
|  | 220 | { | 
|  | 221 | struct ei_device *ei_local = netdev_priv(dev); | 
|  | 222 | void __iomem *addr; | 
|  | 223 | int stat = 0; | 
|  | 224 |  | 
|  | 225 | switch (etherh_priv(dev)->id) { | 
|  | 226 | case PROD_I3_ETHERLAN600: | 
|  | 227 | case PROD_I3_ETHERLAN600A: | 
| Al Viro | b936889 | 2006-10-10 00:19:36 +0100 | [diff] [blame] | 228 | addr = (void __iomem *)dev->base_addr + EN0_RCNTHI; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 229 | switch (dev->if_port) { | 
|  | 230 | case IF_PORT_10BASE2: | 
|  | 231 | stat = 1; | 
|  | 232 | break; | 
|  | 233 | case IF_PORT_10BASET: | 
|  | 234 | stat = readb(addr) & 4; | 
|  | 235 | break; | 
|  | 236 | } | 
|  | 237 | break; | 
|  | 238 |  | 
|  | 239 | case PROD_I3_ETHERLAN500: | 
|  | 240 | switch (dev->if_port) { | 
|  | 241 | case IF_PORT_10BASE2: | 
|  | 242 | stat = 1; | 
|  | 243 | break; | 
|  | 244 | case IF_PORT_10BASET: | 
|  | 245 | stat = etherh_get_stat(etherh_priv(dev)) & ETHERH_CP_HEARTBEAT; | 
|  | 246 | break; | 
|  | 247 | } | 
|  | 248 | break; | 
|  | 249 |  | 
|  | 250 | default: | 
|  | 251 | stat = 0; | 
|  | 252 | break; | 
|  | 253 | } | 
|  | 254 |  | 
|  | 255 | return stat != 0; | 
|  | 256 | } | 
|  | 257 |  | 
|  | 258 | /* | 
|  | 259 | * Configure the interface.  Note that we ignore the other | 
|  | 260 | * parts of ifmap, since its mostly meaningless for this driver. | 
|  | 261 | */ | 
|  | 262 | static int etherh_set_config(struct net_device *dev, struct ifmap *map) | 
|  | 263 | { | 
|  | 264 | switch (map->port) { | 
|  | 265 | case IF_PORT_10BASE2: | 
|  | 266 | case IF_PORT_10BASET: | 
|  | 267 | /* | 
|  | 268 | * If the user explicitly sets the interface | 
|  | 269 | * media type, turn off automedia detection. | 
|  | 270 | */ | 
|  | 271 | dev->flags &= ~IFF_AUTOMEDIA; | 
|  | 272 | dev->if_port = map->port; | 
|  | 273 | break; | 
|  | 274 |  | 
|  | 275 | default: | 
|  | 276 | return -EINVAL; | 
|  | 277 | } | 
|  | 278 |  | 
|  | 279 | etherh_setif(dev); | 
|  | 280 |  | 
|  | 281 | return 0; | 
|  | 282 | } | 
|  | 283 |  | 
|  | 284 | /* | 
|  | 285 | * Reset the 8390 (hard reset).  Note that we can't actually do this. | 
|  | 286 | */ | 
|  | 287 | static void | 
|  | 288 | etherh_reset(struct net_device *dev) | 
|  | 289 | { | 
|  | 290 | struct ei_device *ei_local = netdev_priv(dev); | 
| Al Viro | b936889 | 2006-10-10 00:19:36 +0100 | [diff] [blame] | 291 | void __iomem *addr = (void __iomem *)dev->base_addr; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 |  | 
|  | 293 | writeb(E8390_NODMA+E8390_PAGE0+E8390_STOP, addr); | 
|  | 294 |  | 
|  | 295 | /* | 
|  | 296 | * See if we need to change the interface type. | 
|  | 297 | * Note that we use 'interface_num' as a flag | 
|  | 298 | * to indicate that we need to change the media. | 
|  | 299 | */ | 
|  | 300 | if (dev->flags & IFF_AUTOMEDIA && ei_local->interface_num) { | 
|  | 301 | ei_local->interface_num = 0; | 
|  | 302 |  | 
|  | 303 | if (dev->if_port == IF_PORT_10BASET) | 
|  | 304 | dev->if_port = IF_PORT_10BASE2; | 
|  | 305 | else | 
|  | 306 | dev->if_port = IF_PORT_10BASET; | 
|  | 307 |  | 
|  | 308 | etherh_setif(dev); | 
|  | 309 | } | 
|  | 310 | } | 
|  | 311 |  | 
|  | 312 | /* | 
|  | 313 | * Write a block of data out to the 8390 | 
|  | 314 | */ | 
|  | 315 | static void | 
|  | 316 | etherh_block_output (struct net_device *dev, int count, const unsigned char *buf, int start_page) | 
|  | 317 | { | 
|  | 318 | struct ei_device *ei_local = netdev_priv(dev); | 
|  | 319 | unsigned long dma_start; | 
|  | 320 | void __iomem *dma_base, *addr; | 
|  | 321 |  | 
|  | 322 | if (ei_local->dmaing) { | 
|  | 323 | printk(KERN_ERR "%s: DMAing conflict in etherh_block_input: " | 
|  | 324 | " DMAstat %d irqlock %d\n", dev->name, | 
|  | 325 | ei_local->dmaing, ei_local->irqlock); | 
|  | 326 | return; | 
|  | 327 | } | 
|  | 328 |  | 
|  | 329 | /* | 
|  | 330 | * Make sure we have a round number of bytes if we're in word mode. | 
|  | 331 | */ | 
|  | 332 | if (count & 1 && ei_local->word16) | 
|  | 333 | count++; | 
|  | 334 |  | 
|  | 335 | ei_local->dmaing = 1; | 
|  | 336 |  | 
| Al Viro | b936889 | 2006-10-10 00:19:36 +0100 | [diff] [blame] | 337 | addr = (void __iomem *)dev->base_addr; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | dma_base = etherh_priv(dev)->dma_base; | 
|  | 339 |  | 
|  | 340 | count = (count + 1) & ~1; | 
|  | 341 | writeb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD); | 
|  | 342 |  | 
|  | 343 | writeb (0x42, addr + EN0_RCNTLO); | 
|  | 344 | writeb (0x00, addr + EN0_RCNTHI); | 
|  | 345 | writeb (0x42, addr + EN0_RSARLO); | 
|  | 346 | writeb (0x00, addr + EN0_RSARHI); | 
|  | 347 | writeb (E8390_RREAD | E8390_START, addr + E8390_CMD); | 
|  | 348 |  | 
|  | 349 | udelay (1); | 
|  | 350 |  | 
|  | 351 | writeb (ENISR_RDC, addr + EN0_ISR); | 
|  | 352 | writeb (count, addr + EN0_RCNTLO); | 
|  | 353 | writeb (count >> 8, addr + EN0_RCNTHI); | 
|  | 354 | writeb (0, addr + EN0_RSARLO); | 
|  | 355 | writeb (start_page, addr + EN0_RSARHI); | 
|  | 356 | writeb (E8390_RWRITE | E8390_START, addr + E8390_CMD); | 
|  | 357 |  | 
|  | 358 | if (ei_local->word16) | 
|  | 359 | writesw (dma_base, buf, count >> 1); | 
|  | 360 | else | 
|  | 361 | writesb (dma_base, buf, count); | 
|  | 362 |  | 
|  | 363 | dma_start = jiffies; | 
|  | 364 |  | 
|  | 365 | while ((readb (addr + EN0_ISR) & ENISR_RDC) == 0) | 
| Marcelo Feitoza Parisi | ff5688a | 2006-01-09 18:37:15 -0800 | [diff] [blame] | 366 | if (time_after(jiffies, dma_start + 2*HZ/100)) { /* 20ms */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 | printk(KERN_ERR "%s: timeout waiting for TX RDC\n", | 
|  | 368 | dev->name); | 
|  | 369 | etherh_reset (dev); | 
| Al Viro | 6c3561b | 2006-10-10 00:19:36 +0100 | [diff] [blame] | 370 | __NS8390_init (dev, 1); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | break; | 
|  | 372 | } | 
|  | 373 |  | 
|  | 374 | writeb (ENISR_RDC, addr + EN0_ISR); | 
|  | 375 | ei_local->dmaing = 0; | 
|  | 376 | } | 
|  | 377 |  | 
|  | 378 | /* | 
|  | 379 | * Read a block of data from the 8390 | 
|  | 380 | */ | 
|  | 381 | static void | 
|  | 382 | etherh_block_input (struct net_device *dev, int count, struct sk_buff *skb, int ring_offset) | 
|  | 383 | { | 
|  | 384 | struct ei_device *ei_local = netdev_priv(dev); | 
|  | 385 | unsigned char *buf; | 
|  | 386 | void __iomem *dma_base, *addr; | 
|  | 387 |  | 
|  | 388 | if (ei_local->dmaing) { | 
|  | 389 | printk(KERN_ERR "%s: DMAing conflict in etherh_block_input: " | 
|  | 390 | " DMAstat %d irqlock %d\n", dev->name, | 
|  | 391 | ei_local->dmaing, ei_local->irqlock); | 
|  | 392 | return; | 
|  | 393 | } | 
|  | 394 |  | 
|  | 395 | ei_local->dmaing = 1; | 
|  | 396 |  | 
| Al Viro | b936889 | 2006-10-10 00:19:36 +0100 | [diff] [blame] | 397 | addr = (void __iomem *)dev->base_addr; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 398 | dma_base = etherh_priv(dev)->dma_base; | 
|  | 399 |  | 
|  | 400 | buf = skb->data; | 
|  | 401 | writeb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD); | 
|  | 402 | writeb (count, addr + EN0_RCNTLO); | 
|  | 403 | writeb (count >> 8, addr + EN0_RCNTHI); | 
|  | 404 | writeb (ring_offset, addr + EN0_RSARLO); | 
|  | 405 | writeb (ring_offset >> 8, addr + EN0_RSARHI); | 
|  | 406 | writeb (E8390_RREAD | E8390_START, addr + E8390_CMD); | 
|  | 407 |  | 
|  | 408 | if (ei_local->word16) { | 
|  | 409 | readsw (dma_base, buf, count >> 1); | 
|  | 410 | if (count & 1) | 
|  | 411 | buf[count - 1] = readb (dma_base); | 
|  | 412 | } else | 
|  | 413 | readsb (dma_base, buf, count); | 
|  | 414 |  | 
|  | 415 | writeb (ENISR_RDC, addr + EN0_ISR); | 
|  | 416 | ei_local->dmaing = 0; | 
|  | 417 | } | 
|  | 418 |  | 
|  | 419 | /* | 
|  | 420 | * Read a header from the 8390 | 
|  | 421 | */ | 
|  | 422 | static void | 
|  | 423 | etherh_get_header (struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page) | 
|  | 424 | { | 
|  | 425 | struct ei_device *ei_local = netdev_priv(dev); | 
|  | 426 | void __iomem *dma_base, *addr; | 
|  | 427 |  | 
|  | 428 | if (ei_local->dmaing) { | 
|  | 429 | printk(KERN_ERR "%s: DMAing conflict in etherh_get_header: " | 
|  | 430 | " DMAstat %d irqlock %d\n", dev->name, | 
|  | 431 | ei_local->dmaing, ei_local->irqlock); | 
|  | 432 | return; | 
|  | 433 | } | 
|  | 434 |  | 
|  | 435 | ei_local->dmaing = 1; | 
|  | 436 |  | 
| Al Viro | b936889 | 2006-10-10 00:19:36 +0100 | [diff] [blame] | 437 | addr = (void __iomem *)dev->base_addr; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 438 | dma_base = etherh_priv(dev)->dma_base; | 
|  | 439 |  | 
|  | 440 | writeb (E8390_NODMA | E8390_PAGE0 | E8390_START, addr + E8390_CMD); | 
|  | 441 | writeb (sizeof (*hdr), addr + EN0_RCNTLO); | 
|  | 442 | writeb (0, addr + EN0_RCNTHI); | 
|  | 443 | writeb (0, addr + EN0_RSARLO); | 
|  | 444 | writeb (ring_page, addr + EN0_RSARHI); | 
|  | 445 | writeb (E8390_RREAD | E8390_START, addr + E8390_CMD); | 
|  | 446 |  | 
|  | 447 | if (ei_local->word16) | 
|  | 448 | readsw (dma_base, hdr, sizeof (*hdr) >> 1); | 
|  | 449 | else | 
|  | 450 | readsb (dma_base, hdr, sizeof (*hdr)); | 
|  | 451 |  | 
|  | 452 | writeb (ENISR_RDC, addr + EN0_ISR); | 
|  | 453 | ei_local->dmaing = 0; | 
|  | 454 | } | 
|  | 455 |  | 
|  | 456 | /* | 
|  | 457 | * Open/initialize the board.  This is called (in the current kernel) | 
|  | 458 | * sometime after booting when the 'ifconfig' program is run. | 
|  | 459 | * | 
|  | 460 | * This routine should set everything up anew at each open, even | 
|  | 461 | * registers that "should" only need to be set once at boot, so that | 
|  | 462 | * there is non-reboot way to recover if something goes wrong. | 
|  | 463 | */ | 
|  | 464 | static int | 
|  | 465 | etherh_open(struct net_device *dev) | 
|  | 466 | { | 
|  | 467 | struct ei_device *ei_local = netdev_priv(dev); | 
|  | 468 |  | 
|  | 469 | if (!is_valid_ether_addr(dev->dev_addr)) { | 
|  | 470 | printk(KERN_WARNING "%s: invalid ethernet MAC address\n", | 
|  | 471 | dev->name); | 
|  | 472 | return -EINVAL; | 
|  | 473 | } | 
|  | 474 |  | 
| Al Viro | 6c3561b | 2006-10-10 00:19:36 +0100 | [diff] [blame] | 475 | if (request_irq(dev->irq, __ei_interrupt, 0, dev->name, dev)) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 476 | return -EAGAIN; | 
|  | 477 |  | 
|  | 478 | /* | 
|  | 479 | * Make sure that we aren't going to change the | 
|  | 480 | * media type on the next reset - we are about to | 
|  | 481 | * do automedia manually now. | 
|  | 482 | */ | 
|  | 483 | ei_local->interface_num = 0; | 
|  | 484 |  | 
|  | 485 | /* | 
|  | 486 | * If we are doing automedia detection, do it now. | 
|  | 487 | * This is more reliable than the 8390's detection. | 
|  | 488 | */ | 
|  | 489 | if (dev->flags & IFF_AUTOMEDIA) { | 
|  | 490 | dev->if_port = IF_PORT_10BASET; | 
|  | 491 | etherh_setif(dev); | 
|  | 492 | mdelay(1); | 
|  | 493 | if (!etherh_getifstat(dev)) { | 
|  | 494 | dev->if_port = IF_PORT_10BASE2; | 
|  | 495 | etherh_setif(dev); | 
|  | 496 | } | 
|  | 497 | } else | 
|  | 498 | etherh_setif(dev); | 
|  | 499 |  | 
|  | 500 | etherh_reset(dev); | 
| Al Viro | 6c3561b | 2006-10-10 00:19:36 +0100 | [diff] [blame] | 501 | __ei_open(dev); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 502 |  | 
|  | 503 | return 0; | 
|  | 504 | } | 
|  | 505 |  | 
|  | 506 | /* | 
|  | 507 | * The inverse routine to etherh_open(). | 
|  | 508 | */ | 
|  | 509 | static int | 
|  | 510 | etherh_close(struct net_device *dev) | 
|  | 511 | { | 
| Al Viro | 6c3561b | 2006-10-10 00:19:36 +0100 | [diff] [blame] | 512 | __ei_close (dev); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 513 | free_irq (dev->irq, dev); | 
|  | 514 | return 0; | 
|  | 515 | } | 
|  | 516 |  | 
|  | 517 | /* | 
|  | 518 | * Initialisation | 
|  | 519 | */ | 
|  | 520 |  | 
|  | 521 | static void __init etherh_banner(void) | 
|  | 522 | { | 
|  | 523 | static int version_printed; | 
|  | 524 |  | 
|  | 525 | if (net_debug && version_printed++ == 0) | 
|  | 526 | printk(KERN_INFO "%s", version); | 
|  | 527 | } | 
|  | 528 |  | 
|  | 529 | /* | 
|  | 530 | * Read the ethernet address string from the on board rom. | 
|  | 531 | * This is an ascii string... | 
|  | 532 | */ | 
|  | 533 | static int __init etherh_addr(char *addr, struct expansion_card *ec) | 
|  | 534 | { | 
|  | 535 | struct in_chunk_dir cd; | 
|  | 536 | char *s; | 
|  | 537 |  | 
|  | 538 | if (!ecard_readchunk(&cd, ec, 0xf5, 0)) { | 
|  | 539 | printk(KERN_ERR "%s: unable to read podule description string\n", | 
|  | 540 | ec->dev.bus_id); | 
|  | 541 | goto no_addr; | 
|  | 542 | } | 
|  | 543 |  | 
|  | 544 | s = strchr(cd.d.string, '('); | 
|  | 545 | if (s) { | 
|  | 546 | int i; | 
|  | 547 |  | 
|  | 548 | for (i = 0; i < 6; i++) { | 
|  | 549 | addr[i] = simple_strtoul(s + 1, &s, 0x10); | 
|  | 550 | if (*s != (i == 5? ')' : ':')) | 
|  | 551 | break; | 
|  | 552 | } | 
|  | 553 |  | 
|  | 554 | if (i == 6) | 
|  | 555 | return 0; | 
|  | 556 | } | 
|  | 557 |  | 
|  | 558 | printk(KERN_ERR "%s: unable to parse MAC address: %s\n", | 
|  | 559 | ec->dev.bus_id, cd.d.string); | 
|  | 560 |  | 
|  | 561 | no_addr: | 
|  | 562 | return -ENODEV; | 
|  | 563 | } | 
|  | 564 |  | 
|  | 565 | /* | 
|  | 566 | * Create an ethernet address from the system serial number. | 
|  | 567 | */ | 
|  | 568 | static int __init etherm_addr(char *addr) | 
|  | 569 | { | 
|  | 570 | unsigned int serial; | 
|  | 571 |  | 
|  | 572 | if (system_serial_low == 0 && system_serial_high == 0) | 
|  | 573 | return -ENODEV; | 
|  | 574 |  | 
|  | 575 | serial = system_serial_low | system_serial_high; | 
|  | 576 |  | 
|  | 577 | addr[0] = 0; | 
|  | 578 | addr[1] = 0; | 
|  | 579 | addr[2] = 0xa4; | 
|  | 580 | addr[3] = 0x10 + (serial >> 24); | 
|  | 581 | addr[4] = serial >> 16; | 
|  | 582 | addr[5] = serial >> 8; | 
|  | 583 | return 0; | 
|  | 584 | } | 
|  | 585 |  | 
|  | 586 | static void etherh_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 
|  | 587 | { | 
|  | 588 | strlcpy(info->driver, DRV_NAME, sizeof(info->driver)); | 
|  | 589 | strlcpy(info->version, DRV_VERSION, sizeof(info->version)); | 
| Greg Kroah-Hartman | 43cb76d | 2002-04-09 12:14:34 -0700 | [diff] [blame] | 590 | strlcpy(info->bus_info, dev->dev.parent->bus_id, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 591 | sizeof(info->bus_info)); | 
|  | 592 | } | 
|  | 593 |  | 
|  | 594 | static int etherh_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 
|  | 595 | { | 
|  | 596 | cmd->supported	= etherh_priv(dev)->supported; | 
|  | 597 | cmd->speed	= SPEED_10; | 
|  | 598 | cmd->duplex	= DUPLEX_HALF; | 
|  | 599 | cmd->port	= dev->if_port == IF_PORT_10BASET ? PORT_TP : PORT_BNC; | 
|  | 600 | cmd->autoneg	= dev->flags & IFF_AUTOMEDIA ? AUTONEG_ENABLE : AUTONEG_DISABLE; | 
|  | 601 | return 0; | 
|  | 602 | } | 
|  | 603 |  | 
|  | 604 | static int etherh_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | 
|  | 605 | { | 
|  | 606 | switch (cmd->autoneg) { | 
|  | 607 | case AUTONEG_ENABLE: | 
|  | 608 | dev->flags |= IFF_AUTOMEDIA; | 
|  | 609 | break; | 
|  | 610 |  | 
|  | 611 | case AUTONEG_DISABLE: | 
|  | 612 | switch (cmd->port) { | 
|  | 613 | case PORT_TP: | 
|  | 614 | dev->if_port = IF_PORT_10BASET; | 
|  | 615 | break; | 
|  | 616 |  | 
|  | 617 | case PORT_BNC: | 
|  | 618 | dev->if_port = IF_PORT_10BASE2; | 
|  | 619 | break; | 
|  | 620 |  | 
|  | 621 | default: | 
|  | 622 | return -EINVAL; | 
|  | 623 | } | 
|  | 624 | dev->flags &= ~IFF_AUTOMEDIA; | 
|  | 625 | break; | 
|  | 626 |  | 
|  | 627 | default: | 
|  | 628 | return -EINVAL; | 
|  | 629 | } | 
|  | 630 |  | 
|  | 631 | etherh_setif(dev); | 
|  | 632 |  | 
|  | 633 | return 0; | 
|  | 634 | } | 
|  | 635 |  | 
| Jeff Garzik | 7282d49 | 2006-09-13 14:30:00 -0400 | [diff] [blame] | 636 | static const struct ethtool_ops etherh_ethtool_ops = { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 637 | .get_settings	= etherh_get_settings, | 
|  | 638 | .set_settings	= etherh_set_settings, | 
|  | 639 | .get_drvinfo	= etherh_get_drvinfo, | 
|  | 640 | }; | 
|  | 641 |  | 
|  | 642 | static u32 etherh_regoffsets[16]; | 
|  | 643 | static u32 etherm_regoffsets[16]; | 
|  | 644 |  | 
|  | 645 | static int __init | 
|  | 646 | etherh_probe(struct expansion_card *ec, const struct ecard_id *id) | 
|  | 647 | { | 
|  | 648 | const struct etherh_data *data = id->data; | 
|  | 649 | struct ei_device *ei_local; | 
|  | 650 | struct net_device *dev; | 
|  | 651 | struct etherh_priv *eh; | 
|  | 652 | int i, ret; | 
|  | 653 |  | 
|  | 654 | etherh_banner(); | 
|  | 655 |  | 
|  | 656 | ret = ecard_request_resources(ec); | 
|  | 657 | if (ret) | 
|  | 658 | goto out; | 
|  | 659 |  | 
| Al Viro | 6c3561b | 2006-10-10 00:19:36 +0100 | [diff] [blame] | 660 | dev = ____alloc_ei_netdev(sizeof(struct etherh_priv)); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 661 | if (!dev) { | 
|  | 662 | ret = -ENOMEM; | 
|  | 663 | goto release; | 
|  | 664 | } | 
|  | 665 |  | 
|  | 666 | SET_MODULE_OWNER(dev); | 
|  | 667 | SET_NETDEV_DEV(dev, &ec->dev); | 
|  | 668 |  | 
|  | 669 | dev->open		= etherh_open; | 
|  | 670 | dev->stop		= etherh_close; | 
|  | 671 | dev->set_config		= etherh_set_config; | 
|  | 672 | dev->irq		= ec->irq; | 
|  | 673 | dev->ethtool_ops	= ðerh_ethtool_ops; | 
|  | 674 |  | 
|  | 675 | if (data->supported & SUPPORTED_Autoneg) | 
|  | 676 | dev->flags |= IFF_AUTOMEDIA; | 
|  | 677 | if (data->supported & SUPPORTED_TP) { | 
|  | 678 | dev->flags |= IFF_PORTSEL; | 
|  | 679 | dev->if_port = IF_PORT_10BASET; | 
|  | 680 | } else if (data->supported & SUPPORTED_BNC) { | 
|  | 681 | dev->flags |= IFF_PORTSEL; | 
|  | 682 | dev->if_port = IF_PORT_10BASE2; | 
|  | 683 | } else | 
|  | 684 | dev->if_port = IF_PORT_UNKNOWN; | 
|  | 685 |  | 
|  | 686 | eh = etherh_priv(dev); | 
|  | 687 | eh->supported		= data->supported; | 
|  | 688 | eh->ctrl		= 0; | 
|  | 689 | eh->id			= ec->cid.product; | 
|  | 690 | eh->memc		= ioremap(ecard_resource_start(ec, ECARD_RES_MEMC), PAGE_SIZE); | 
|  | 691 | if (!eh->memc) { | 
|  | 692 | ret = -ENOMEM; | 
|  | 693 | goto free; | 
|  | 694 | } | 
|  | 695 |  | 
|  | 696 | eh->ctrl_port = eh->memc; | 
|  | 697 | if (data->ctrl_ioc) { | 
|  | 698 | eh->ioc_fast = ioremap(ecard_resource_start(ec, ECARD_RES_IOCFAST), PAGE_SIZE); | 
|  | 699 | if (!eh->ioc_fast) { | 
|  | 700 | ret = -ENOMEM; | 
|  | 701 | goto free; | 
|  | 702 | } | 
|  | 703 | eh->ctrl_port = eh->ioc_fast; | 
|  | 704 | } | 
|  | 705 |  | 
| Nicolas Pitre | c7e7887 | 2005-06-29 18:10:54 +0100 | [diff] [blame] | 706 | dev->base_addr = (unsigned long)eh->memc + data->ns8390_offset; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 707 | eh->dma_base = eh->memc + data->dataport_offset; | 
|  | 708 | eh->ctrl_port += data->ctrlport_offset; | 
|  | 709 |  | 
|  | 710 | /* | 
|  | 711 | * IRQ and control port handling - only for non-NIC slot cards. | 
|  | 712 | */ | 
|  | 713 | if (ec->slot_no != 8) { | 
|  | 714 | ec->ops		= ðerh_ops; | 
|  | 715 | ec->irq_data	= eh; | 
|  | 716 | } else { | 
|  | 717 | /* | 
|  | 718 | * If we're in the NIC slot, make sure the IRQ is enabled | 
|  | 719 | */ | 
|  | 720 | etherh_set_ctrl(eh, ETHERH_CP_IE); | 
|  | 721 | } | 
|  | 722 |  | 
|  | 723 | ei_local = netdev_priv(dev); | 
|  | 724 | spin_lock_init(&ei_local->page_lock); | 
|  | 725 |  | 
|  | 726 | if (ec->cid.product == PROD_ANT_ETHERM) { | 
|  | 727 | etherm_addr(dev->dev_addr); | 
|  | 728 | ei_local->reg_offset = etherm_regoffsets; | 
|  | 729 | } else { | 
|  | 730 | etherh_addr(dev->dev_addr, ec); | 
|  | 731 | ei_local->reg_offset = etherh_regoffsets; | 
|  | 732 | } | 
|  | 733 |  | 
|  | 734 | ei_local->name          = dev->name; | 
|  | 735 | ei_local->word16        = 1; | 
|  | 736 | ei_local->tx_start_page = data->tx_start_page; | 
|  | 737 | ei_local->rx_start_page = ei_local->tx_start_page + TX_PAGES; | 
|  | 738 | ei_local->stop_page     = data->stop_page; | 
|  | 739 | ei_local->reset_8390    = etherh_reset; | 
|  | 740 | ei_local->block_input   = etherh_block_input; | 
|  | 741 | ei_local->block_output  = etherh_block_output; | 
|  | 742 | ei_local->get_8390_hdr  = etherh_get_header; | 
|  | 743 | ei_local->interface_num = 0; | 
|  | 744 |  | 
|  | 745 | etherh_reset(dev); | 
| Al Viro | 6c3561b | 2006-10-10 00:19:36 +0100 | [diff] [blame] | 746 | __NS8390_init(dev, 0); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 747 |  | 
|  | 748 | ret = register_netdev(dev); | 
|  | 749 | if (ret) | 
|  | 750 | goto free; | 
|  | 751 |  | 
|  | 752 | printk(KERN_INFO "%s: %s in slot %d, ", | 
|  | 753 | dev->name, data->name, ec->slot_no); | 
|  | 754 |  | 
|  | 755 | for (i = 0; i < 6; i++) | 
|  | 756 | printk("%2.2x%c", dev->dev_addr[i], i == 5 ? '\n' : ':'); | 
|  | 757 |  | 
|  | 758 | ecard_set_drvdata(ec, dev); | 
|  | 759 |  | 
|  | 760 | return 0; | 
|  | 761 |  | 
|  | 762 | free: | 
|  | 763 | if (eh->ioc_fast) | 
|  | 764 | iounmap(eh->ioc_fast); | 
|  | 765 | if (eh->memc) | 
|  | 766 | iounmap(eh->memc); | 
|  | 767 | free_netdev(dev); | 
|  | 768 | release: | 
|  | 769 | ecard_release_resources(ec); | 
|  | 770 | out: | 
|  | 771 | return ret; | 
|  | 772 | } | 
|  | 773 |  | 
|  | 774 | static void __devexit etherh_remove(struct expansion_card *ec) | 
|  | 775 | { | 
|  | 776 | struct net_device *dev = ecard_get_drvdata(ec); | 
|  | 777 | struct etherh_priv *eh = etherh_priv(dev); | 
|  | 778 |  | 
|  | 779 | ecard_set_drvdata(ec, NULL); | 
|  | 780 |  | 
|  | 781 | unregister_netdev(dev); | 
|  | 782 | ec->ops = NULL; | 
|  | 783 |  | 
|  | 784 | if (eh->ioc_fast) | 
|  | 785 | iounmap(eh->ioc_fast); | 
|  | 786 | iounmap(eh->memc); | 
|  | 787 |  | 
|  | 788 | free_netdev(dev); | 
|  | 789 |  | 
|  | 790 | ecard_release_resources(ec); | 
|  | 791 | } | 
|  | 792 |  | 
|  | 793 | static struct etherh_data etherm_data = { | 
|  | 794 | .ns8390_offset		= ETHERM_NS8390, | 
|  | 795 | .dataport_offset	= ETHERM_NS8390 + ETHERM_DATAPORT, | 
|  | 796 | .ctrlport_offset	= ETHERM_NS8390 + ETHERM_CTRLPORT, | 
|  | 797 | .name			= "ANT EtherM", | 
|  | 798 | .supported		= SUPPORTED_10baseT_Half, | 
|  | 799 | .tx_start_page		= ETHERM_TX_START_PAGE, | 
|  | 800 | .stop_page		= ETHERM_STOP_PAGE, | 
|  | 801 | }; | 
|  | 802 |  | 
|  | 803 | static struct etherh_data etherlan500_data = { | 
|  | 804 | .ns8390_offset		= ETHERH500_NS8390, | 
|  | 805 | .dataport_offset	= ETHERH500_NS8390 + ETHERH500_DATAPORT, | 
|  | 806 | .ctrlport_offset	= ETHERH500_CTRLPORT, | 
|  | 807 | .ctrl_ioc		= 1, | 
|  | 808 | .name			= "i3 EtherH 500", | 
|  | 809 | .supported		= SUPPORTED_10baseT_Half, | 
|  | 810 | .tx_start_page		= ETHERH_TX_START_PAGE, | 
|  | 811 | .stop_page		= ETHERH_STOP_PAGE, | 
|  | 812 | }; | 
|  | 813 |  | 
|  | 814 | static struct etherh_data etherlan600_data = { | 
|  | 815 | .ns8390_offset		= ETHERH600_NS8390, | 
|  | 816 | .dataport_offset	= ETHERH600_NS8390 + ETHERH600_DATAPORT, | 
|  | 817 | .ctrlport_offset	= ETHERH600_NS8390 + ETHERH600_CTRLPORT, | 
|  | 818 | .name			= "i3 EtherH 600", | 
|  | 819 | .supported		= SUPPORTED_10baseT_Half | SUPPORTED_TP | SUPPORTED_BNC | SUPPORTED_Autoneg, | 
|  | 820 | .tx_start_page		= ETHERH_TX_START_PAGE, | 
|  | 821 | .stop_page		= ETHERH_STOP_PAGE, | 
|  | 822 | }; | 
|  | 823 |  | 
|  | 824 | static struct etherh_data etherlan600a_data = { | 
|  | 825 | .ns8390_offset		= ETHERH600_NS8390, | 
|  | 826 | .dataport_offset	= ETHERH600_NS8390 + ETHERH600_DATAPORT, | 
|  | 827 | .ctrlport_offset	= ETHERH600_NS8390 + ETHERH600_CTRLPORT, | 
|  | 828 | .name			= "i3 EtherH 600A", | 
|  | 829 | .supported		= SUPPORTED_10baseT_Half | SUPPORTED_TP | SUPPORTED_BNC | SUPPORTED_Autoneg, | 
|  | 830 | .tx_start_page		= ETHERH_TX_START_PAGE, | 
|  | 831 | .stop_page		= ETHERH_STOP_PAGE, | 
|  | 832 | }; | 
|  | 833 |  | 
|  | 834 | static const struct ecard_id etherh_ids[] = { | 
|  | 835 | { MANU_ANT, PROD_ANT_ETHERM,      ðerm_data       }, | 
|  | 836 | { MANU_I3,  PROD_I3_ETHERLAN500,  ðerlan500_data  }, | 
|  | 837 | { MANU_I3,  PROD_I3_ETHERLAN600,  ðerlan600_data  }, | 
|  | 838 | { MANU_I3,  PROD_I3_ETHERLAN600A, ðerlan600a_data }, | 
|  | 839 | { 0xffff,   0xffff } | 
|  | 840 | }; | 
|  | 841 |  | 
|  | 842 | static struct ecard_driver etherh_driver = { | 
|  | 843 | .probe		= etherh_probe, | 
|  | 844 | .remove		= __devexit_p(etherh_remove), | 
|  | 845 | .id_table	= etherh_ids, | 
|  | 846 | .drv = { | 
|  | 847 | .name	= DRV_NAME, | 
|  | 848 | }, | 
|  | 849 | }; | 
|  | 850 |  | 
|  | 851 | static int __init etherh_init(void) | 
|  | 852 | { | 
|  | 853 | int i; | 
|  | 854 |  | 
|  | 855 | for (i = 0; i < 16; i++) { | 
|  | 856 | etherh_regoffsets[i] = i << 2; | 
|  | 857 | etherm_regoffsets[i] = i << 5; | 
|  | 858 | } | 
|  | 859 |  | 
|  | 860 | return ecard_register_driver(ðerh_driver); | 
|  | 861 | } | 
|  | 862 |  | 
|  | 863 | static void __exit etherh_exit(void) | 
|  | 864 | { | 
|  | 865 | ecard_remove_driver(ðerh_driver); | 
|  | 866 | } | 
|  | 867 |  | 
|  | 868 | module_init(etherh_init); | 
|  | 869 | module_exit(etherh_exit); |