Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[linux/fpc-iii.git] / drivers / net / ethernet / amd / am79c961a.c
blobfcdf5dda448f9c7acf5a0a537cbbcb0de76b09df
1 /*
2 * linux/drivers/net/ethernet/amd/am79c961a.c
4 * by Russell King <rmk@arm.linux.org.uk> 1995-2001.
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 * Derived from various things including skeleton.c
12 * This is a special driver for the am79c961A Lance chip used in the
13 * Intel (formally Digital Equipment Corp) EBSA110 platform. Please
14 * note that this can not be built as a module (it doesn't make sense).
16 #include <linux/kernel.h>
17 #include <linux/types.h>
18 #include <linux/interrupt.h>
19 #include <linux/ioport.h>
20 #include <linux/slab.h>
21 #include <linux/string.h>
22 #include <linux/errno.h>
23 #include <linux/netdevice.h>
24 #include <linux/etherdevice.h>
25 #include <linux/delay.h>
26 #include <linux/init.h>
27 #include <linux/crc32.h>
28 #include <linux/bitops.h>
29 #include <linux/platform_device.h>
30 #include <linux/io.h>
32 #include <mach/hardware.h>
34 #define TX_BUFFERS 15
35 #define RX_BUFFERS 25
37 #include "am79c961a.h"
39 static irqreturn_t
40 am79c961_interrupt (int irq, void *dev_id);
42 static unsigned int net_debug = NET_DEBUG;
44 static const char version[] =
45 "am79c961 ethernet driver (C) 1995-2001 Russell King v0.04\n";
47 /* --------------------------------------------------------------------------- */
49 #ifdef __arm__
50 static void write_rreg(u_long base, u_int reg, u_int val)
52 asm volatile(
53 "strh %1, [%2] @ NET_RAP\n\t"
54 "strh %0, [%2, #-4] @ NET_RDP"
56 : "r" (val), "r" (reg), "r" (ISAIO_BASE + 0x0464));
59 static inline unsigned short read_rreg(u_long base_addr, u_int reg)
61 unsigned short v;
62 asm volatile(
63 "strh %1, [%2] @ NET_RAP\n\t"
64 "ldrh %0, [%2, #-4] @ NET_RDP"
65 : "=r" (v)
66 : "r" (reg), "r" (ISAIO_BASE + 0x0464));
67 return v;
70 static inline void write_ireg(u_long base, u_int reg, u_int val)
72 asm volatile(
73 "strh %1, [%2] @ NET_RAP\n\t"
74 "strh %0, [%2, #8] @ NET_IDP"
76 : "r" (val), "r" (reg), "r" (ISAIO_BASE + 0x0464));
79 static inline unsigned short read_ireg(u_long base_addr, u_int reg)
81 u_short v;
82 asm volatile(
83 "strh %1, [%2] @ NAT_RAP\n\t"
84 "ldrh %0, [%2, #8] @ NET_IDP\n\t"
85 : "=r" (v)
86 : "r" (reg), "r" (ISAIO_BASE + 0x0464));
87 return v;
90 #define am_writeword(dev,off,val) __raw_writew(val, ISAMEM_BASE + ((off) << 1))
91 #define am_readword(dev,off) __raw_readw(ISAMEM_BASE + ((off) << 1))
93 static void
94 am_writebuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned int length)
96 offset = ISAMEM_BASE + (offset << 1);
97 length = (length + 1) & ~1;
98 if ((int)buf & 2) {
99 asm volatile("strh %2, [%0], #4"
100 : "=&r" (offset) : "0" (offset), "r" (buf[0] | (buf[1] << 8)));
101 buf += 2;
102 length -= 2;
104 while (length > 8) {
105 register unsigned int tmp asm("r2"), tmp2 asm("r3");
106 asm volatile(
107 "ldmia %0!, {%1, %2}"
108 : "+r" (buf), "=&r" (tmp), "=&r" (tmp2));
109 length -= 8;
110 asm volatile(
111 "strh %1, [%0], #4\n\t"
112 "mov %1, %1, lsr #16\n\t"
113 "strh %1, [%0], #4\n\t"
114 "strh %2, [%0], #4\n\t"
115 "mov %2, %2, lsr #16\n\t"
116 "strh %2, [%0], #4"
117 : "+r" (offset), "=&r" (tmp), "=&r" (tmp2));
119 while (length > 0) {
120 asm volatile("strh %2, [%0], #4"
121 : "=&r" (offset) : "0" (offset), "r" (buf[0] | (buf[1] << 8)));
122 buf += 2;
123 length -= 2;
127 static void
128 am_readbuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned int length)
130 offset = ISAMEM_BASE + (offset << 1);
131 length = (length + 1) & ~1;
132 if ((int)buf & 2) {
133 unsigned int tmp;
134 asm volatile(
135 "ldrh %2, [%0], #4\n\t"
136 "strb %2, [%1], #1\n\t"
137 "mov %2, %2, lsr #8\n\t"
138 "strb %2, [%1], #1"
139 : "=&r" (offset), "=&r" (buf), "=r" (tmp): "0" (offset), "1" (buf));
140 length -= 2;
142 while (length > 8) {
143 register unsigned int tmp asm("r2"), tmp2 asm("r3"), tmp3;
144 asm volatile(
145 "ldrh %2, [%0], #4\n\t"
146 "ldrh %4, [%0], #4\n\t"
147 "ldrh %3, [%0], #4\n\t"
148 "orr %2, %2, %4, lsl #16\n\t"
149 "ldrh %4, [%0], #4\n\t"
150 "orr %3, %3, %4, lsl #16\n\t"
151 "stmia %1!, {%2, %3}"
152 : "=&r" (offset), "=&r" (buf), "=r" (tmp), "=r" (tmp2), "=r" (tmp3)
153 : "0" (offset), "1" (buf));
154 length -= 8;
156 while (length > 0) {
157 unsigned int tmp;
158 asm volatile(
159 "ldrh %2, [%0], #4\n\t"
160 "strb %2, [%1], #1\n\t"
161 "mov %2, %2, lsr #8\n\t"
162 "strb %2, [%1], #1"
163 : "=&r" (offset), "=&r" (buf), "=r" (tmp) : "0" (offset), "1" (buf));
164 length -= 2;
167 #else
168 #error Not compatible
169 #endif
171 static int
172 am79c961_ramtest(struct net_device *dev, unsigned int val)
174 unsigned char *buffer = kmalloc (65536, GFP_KERNEL);
175 int i, error = 0, errorcount = 0;
177 if (!buffer)
178 return 0;
179 memset (buffer, val, 65536);
180 am_writebuffer(dev, 0, buffer, 65536);
181 memset (buffer, val ^ 255, 65536);
182 am_readbuffer(dev, 0, buffer, 65536);
183 for (i = 0; i < 65536; i++) {
184 if (buffer[i] != val && !error) {
185 printk ("%s: buffer error (%02X %02X) %05X - ", dev->name, val, buffer[i], i);
186 error = 1;
187 errorcount ++;
188 } else if (error && buffer[i] == val) {
189 printk ("%05X\n", i);
190 error = 0;
193 if (error)
194 printk ("10000\n");
195 kfree (buffer);
196 return errorcount;
199 static void am79c961_mc_hash(char *addr, u16 *hash)
201 int idx, bit;
202 u32 crc;
204 crc = ether_crc_le(ETH_ALEN, addr);
206 idx = crc >> 30;
207 bit = (crc >> 26) & 15;
209 hash[idx] |= 1 << bit;
212 static unsigned int am79c961_get_rx_mode(struct net_device *dev, u16 *hash)
214 unsigned int mode = MODE_PORT_10BT;
216 if (dev->flags & IFF_PROMISC) {
217 mode |= MODE_PROMISC;
218 memset(hash, 0xff, 4 * sizeof(*hash));
219 } else if (dev->flags & IFF_ALLMULTI) {
220 memset(hash, 0xff, 4 * sizeof(*hash));
221 } else {
222 struct netdev_hw_addr *ha;
224 memset(hash, 0, 4 * sizeof(*hash));
226 netdev_for_each_mc_addr(ha, dev)
227 am79c961_mc_hash(ha->addr, hash);
230 return mode;
233 static void
234 am79c961_init_for_open(struct net_device *dev)
236 struct dev_priv *priv = netdev_priv(dev);
237 unsigned long flags;
238 unsigned char *p;
239 u_int hdr_addr, first_free_addr;
240 u16 multi_hash[4], mode = am79c961_get_rx_mode(dev, multi_hash);
241 int i;
244 * Stop the chip.
246 spin_lock_irqsave(&priv->chip_lock, flags);
247 write_rreg (dev->base_addr, CSR0, CSR0_BABL|CSR0_CERR|CSR0_MISS|CSR0_MERR|CSR0_TINT|CSR0_RINT|CSR0_STOP);
248 spin_unlock_irqrestore(&priv->chip_lock, flags);
250 write_ireg (dev->base_addr, 5, 0x00a0); /* Receive address LED */
251 write_ireg (dev->base_addr, 6, 0x0081); /* Collision LED */
252 write_ireg (dev->base_addr, 7, 0x0090); /* XMIT LED */
253 write_ireg (dev->base_addr, 2, 0x0000); /* MODE register selects media */
255 for (i = LADRL; i <= LADRH; i++)
256 write_rreg (dev->base_addr, i, multi_hash[i - LADRL]);
258 for (i = PADRL, p = dev->dev_addr; i <= PADRH; i++, p += 2)
259 write_rreg (dev->base_addr, i, p[0] | (p[1] << 8));
261 write_rreg (dev->base_addr, MODE, mode);
262 write_rreg (dev->base_addr, POLLINT, 0);
263 write_rreg (dev->base_addr, SIZERXR, -RX_BUFFERS);
264 write_rreg (dev->base_addr, SIZETXR, -TX_BUFFERS);
266 first_free_addr = RX_BUFFERS * 8 + TX_BUFFERS * 8 + 16;
267 hdr_addr = 0;
269 priv->rxhead = 0;
270 priv->rxtail = 0;
271 priv->rxhdr = hdr_addr;
273 for (i = 0; i < RX_BUFFERS; i++) {
274 priv->rxbuffer[i] = first_free_addr;
275 am_writeword (dev, hdr_addr, first_free_addr);
276 am_writeword (dev, hdr_addr + 2, RMD_OWN);
277 am_writeword (dev, hdr_addr + 4, (-1600));
278 am_writeword (dev, hdr_addr + 6, 0);
279 first_free_addr += 1600;
280 hdr_addr += 8;
282 priv->txhead = 0;
283 priv->txtail = 0;
284 priv->txhdr = hdr_addr;
285 for (i = 0; i < TX_BUFFERS; i++) {
286 priv->txbuffer[i] = first_free_addr;
287 am_writeword (dev, hdr_addr, first_free_addr);
288 am_writeword (dev, hdr_addr + 2, TMD_STP|TMD_ENP);
289 am_writeword (dev, hdr_addr + 4, 0xf000);
290 am_writeword (dev, hdr_addr + 6, 0);
291 first_free_addr += 1600;
292 hdr_addr += 8;
295 write_rreg (dev->base_addr, BASERXL, priv->rxhdr);
296 write_rreg (dev->base_addr, BASERXH, 0);
297 write_rreg (dev->base_addr, BASETXL, priv->txhdr);
298 write_rreg (dev->base_addr, BASERXH, 0);
299 write_rreg (dev->base_addr, CSR0, CSR0_STOP);
300 write_rreg (dev->base_addr, CSR3, CSR3_IDONM|CSR3_BABLM|CSR3_DXSUFLO);
301 write_rreg (dev->base_addr, CSR4, CSR4_APAD_XMIT|CSR4_MFCOM|CSR4_RCVCCOM|CSR4_TXSTRTM|CSR4_JABM);
302 write_rreg (dev->base_addr, CSR0, CSR0_IENA|CSR0_STRT);
305 static void am79c961_timer(unsigned long data)
307 struct net_device *dev = (struct net_device *)data;
308 struct dev_priv *priv = netdev_priv(dev);
309 unsigned int lnkstat, carrier;
310 unsigned long flags;
312 spin_lock_irqsave(&priv->chip_lock, flags);
313 lnkstat = read_ireg(dev->base_addr, ISALED0) & ISALED0_LNKST;
314 spin_unlock_irqrestore(&priv->chip_lock, flags);
315 carrier = netif_carrier_ok(dev);
317 if (lnkstat && !carrier) {
318 netif_carrier_on(dev);
319 printk("%s: link up\n", dev->name);
320 } else if (!lnkstat && carrier) {
321 netif_carrier_off(dev);
322 printk("%s: link down\n", dev->name);
325 mod_timer(&priv->timer, jiffies + msecs_to_jiffies(500));
329 * Open/initialize the board.
331 static int
332 am79c961_open(struct net_device *dev)
334 struct dev_priv *priv = netdev_priv(dev);
335 int ret;
337 ret = request_irq(dev->irq, am79c961_interrupt, 0, dev->name, dev);
338 if (ret)
339 return ret;
341 am79c961_init_for_open(dev);
343 netif_carrier_off(dev);
345 priv->timer.expires = jiffies;
346 add_timer(&priv->timer);
348 netif_start_queue(dev);
350 return 0;
354 * The inverse routine to am79c961_open().
356 static int
357 am79c961_close(struct net_device *dev)
359 struct dev_priv *priv = netdev_priv(dev);
360 unsigned long flags;
362 del_timer_sync(&priv->timer);
364 netif_stop_queue(dev);
365 netif_carrier_off(dev);
367 spin_lock_irqsave(&priv->chip_lock, flags);
368 write_rreg (dev->base_addr, CSR0, CSR0_STOP);
369 write_rreg (dev->base_addr, CSR3, CSR3_MASKALL);
370 spin_unlock_irqrestore(&priv->chip_lock, flags);
372 free_irq (dev->irq, dev);
374 return 0;
378 * Set or clear promiscuous/multicast mode filter for this adapter.
380 static void am79c961_setmulticastlist (struct net_device *dev)
382 struct dev_priv *priv = netdev_priv(dev);
383 unsigned long flags;
384 u16 multi_hash[4], mode = am79c961_get_rx_mode(dev, multi_hash);
385 int i, stopped;
387 spin_lock_irqsave(&priv->chip_lock, flags);
389 stopped = read_rreg(dev->base_addr, CSR0) & CSR0_STOP;
391 if (!stopped) {
393 * Put the chip into suspend mode
395 write_rreg(dev->base_addr, CTRL1, CTRL1_SPND);
398 * Spin waiting for chip to report suspend mode
400 while ((read_rreg(dev->base_addr, CTRL1) & CTRL1_SPND) == 0) {
401 spin_unlock_irqrestore(&priv->chip_lock, flags);
402 nop();
403 spin_lock_irqsave(&priv->chip_lock, flags);
408 * Update the multicast hash table
410 for (i = 0; i < ARRAY_SIZE(multi_hash); i++)
411 write_rreg(dev->base_addr, i + LADRL, multi_hash[i]);
414 * Write the mode register
416 write_rreg(dev->base_addr, MODE, mode);
418 if (!stopped) {
420 * Put the chip back into running mode
422 write_rreg(dev->base_addr, CTRL1, 0);
425 spin_unlock_irqrestore(&priv->chip_lock, flags);
428 static void am79c961_timeout(struct net_device *dev)
430 printk(KERN_WARNING "%s: transmit timed out, network cable problem?\n",
431 dev->name);
434 * ought to do some setup of the tx side here
437 netif_wake_queue(dev);
441 * Transmit a packet
443 static int
444 am79c961_sendpacket(struct sk_buff *skb, struct net_device *dev)
446 struct dev_priv *priv = netdev_priv(dev);
447 unsigned int hdraddr, bufaddr;
448 unsigned int head;
449 unsigned long flags;
451 head = priv->txhead;
452 hdraddr = priv->txhdr + (head << 3);
453 bufaddr = priv->txbuffer[head];
454 head += 1;
455 if (head >= TX_BUFFERS)
456 head = 0;
458 am_writebuffer (dev, bufaddr, skb->data, skb->len);
459 am_writeword (dev, hdraddr + 4, -skb->len);
460 am_writeword (dev, hdraddr + 2, TMD_OWN|TMD_STP|TMD_ENP);
461 priv->txhead = head;
463 spin_lock_irqsave(&priv->chip_lock, flags);
464 write_rreg (dev->base_addr, CSR0, CSR0_TDMD|CSR0_IENA);
465 spin_unlock_irqrestore(&priv->chip_lock, flags);
468 * If the next packet is owned by the ethernet device,
469 * then the tx ring is full and we can't add another
470 * packet.
472 if (am_readword(dev, priv->txhdr + (priv->txhead << 3) + 2) & TMD_OWN)
473 netif_stop_queue(dev);
475 dev_consume_skb_any(skb);
477 return NETDEV_TX_OK;
481 * If we have a good packet(s), get it/them out of the buffers.
483 static void
484 am79c961_rx(struct net_device *dev, struct dev_priv *priv)
486 do {
487 struct sk_buff *skb;
488 u_int hdraddr;
489 u_int pktaddr;
490 u_int status;
491 int len;
493 hdraddr = priv->rxhdr + (priv->rxtail << 3);
494 pktaddr = priv->rxbuffer[priv->rxtail];
496 status = am_readword (dev, hdraddr + 2);
497 if (status & RMD_OWN) /* do we own it? */
498 break;
500 priv->rxtail ++;
501 if (priv->rxtail >= RX_BUFFERS)
502 priv->rxtail = 0;
504 if ((status & (RMD_ERR|RMD_STP|RMD_ENP)) != (RMD_STP|RMD_ENP)) {
505 am_writeword (dev, hdraddr + 2, RMD_OWN);
506 dev->stats.rx_errors++;
507 if (status & RMD_ERR) {
508 if (status & RMD_FRAM)
509 dev->stats.rx_frame_errors++;
510 if (status & RMD_CRC)
511 dev->stats.rx_crc_errors++;
512 } else if (status & RMD_STP)
513 dev->stats.rx_length_errors++;
514 continue;
517 len = am_readword(dev, hdraddr + 6);
518 skb = netdev_alloc_skb(dev, len + 2);
520 if (skb) {
521 skb_reserve(skb, 2);
523 am_readbuffer(dev, pktaddr, skb_put(skb, len), len);
524 am_writeword(dev, hdraddr + 2, RMD_OWN);
525 skb->protocol = eth_type_trans(skb, dev);
526 netif_rx(skb);
527 dev->stats.rx_bytes += len;
528 dev->stats.rx_packets++;
529 } else {
530 am_writeword (dev, hdraddr + 2, RMD_OWN);
531 dev->stats.rx_dropped++;
532 break;
534 } while (1);
538 * Update stats for the transmitted packet
540 static void
541 am79c961_tx(struct net_device *dev, struct dev_priv *priv)
543 do {
544 short len;
545 u_int hdraddr;
546 u_int status;
548 hdraddr = priv->txhdr + (priv->txtail << 3);
549 status = am_readword (dev, hdraddr + 2);
550 if (status & TMD_OWN)
551 break;
553 priv->txtail ++;
554 if (priv->txtail >= TX_BUFFERS)
555 priv->txtail = 0;
557 if (status & TMD_ERR) {
558 u_int status2;
560 dev->stats.tx_errors++;
562 status2 = am_readword (dev, hdraddr + 6);
565 * Clear the error byte
567 am_writeword (dev, hdraddr + 6, 0);
569 if (status2 & TST_RTRY)
570 dev->stats.collisions += 16;
571 if (status2 & TST_LCOL)
572 dev->stats.tx_window_errors++;
573 if (status2 & TST_LCAR)
574 dev->stats.tx_carrier_errors++;
575 if (status2 & TST_UFLO)
576 dev->stats.tx_fifo_errors++;
577 continue;
579 dev->stats.tx_packets++;
580 len = am_readword (dev, hdraddr + 4);
581 dev->stats.tx_bytes += -len;
582 } while (priv->txtail != priv->txhead);
584 netif_wake_queue(dev);
587 static irqreturn_t
588 am79c961_interrupt(int irq, void *dev_id)
590 struct net_device *dev = (struct net_device *)dev_id;
591 struct dev_priv *priv = netdev_priv(dev);
592 u_int status, n = 100;
593 int handled = 0;
595 do {
596 status = read_rreg(dev->base_addr, CSR0);
597 write_rreg(dev->base_addr, CSR0, status &
598 (CSR0_IENA|CSR0_TINT|CSR0_RINT|
599 CSR0_MERR|CSR0_MISS|CSR0_CERR|CSR0_BABL));
601 if (status & CSR0_RINT) {
602 handled = 1;
603 am79c961_rx(dev, priv);
605 if (status & CSR0_TINT) {
606 handled = 1;
607 am79c961_tx(dev, priv);
609 if (status & CSR0_MISS) {
610 handled = 1;
611 dev->stats.rx_dropped++;
613 if (status & CSR0_CERR) {
614 handled = 1;
615 mod_timer(&priv->timer, jiffies);
617 } while (--n && status & (CSR0_RINT | CSR0_TINT));
619 return IRQ_RETVAL(handled);
622 #ifdef CONFIG_NET_POLL_CONTROLLER
623 static void am79c961_poll_controller(struct net_device *dev)
625 unsigned long flags;
626 local_irq_save(flags);
627 am79c961_interrupt(dev->irq, dev);
628 local_irq_restore(flags);
630 #endif
633 * Initialise the chip. Note that we always expect
634 * to be entered with interrupts enabled.
636 static int
637 am79c961_hw_init(struct net_device *dev)
639 struct dev_priv *priv = netdev_priv(dev);
641 spin_lock_irq(&priv->chip_lock);
642 write_rreg (dev->base_addr, CSR0, CSR0_STOP);
643 write_rreg (dev->base_addr, CSR3, CSR3_MASKALL);
644 spin_unlock_irq(&priv->chip_lock);
646 am79c961_ramtest(dev, 0x66);
647 am79c961_ramtest(dev, 0x99);
649 return 0;
652 static void __init am79c961_banner(void)
654 static unsigned version_printed;
656 if (net_debug && version_printed++ == 0)
657 printk(KERN_INFO "%s", version);
659 static const struct net_device_ops am79c961_netdev_ops = {
660 .ndo_open = am79c961_open,
661 .ndo_stop = am79c961_close,
662 .ndo_start_xmit = am79c961_sendpacket,
663 .ndo_set_rx_mode = am79c961_setmulticastlist,
664 .ndo_tx_timeout = am79c961_timeout,
665 .ndo_validate_addr = eth_validate_addr,
666 .ndo_change_mtu = eth_change_mtu,
667 .ndo_set_mac_address = eth_mac_addr,
668 #ifdef CONFIG_NET_POLL_CONTROLLER
669 .ndo_poll_controller = am79c961_poll_controller,
670 #endif
673 static int am79c961_probe(struct platform_device *pdev)
675 struct resource *res;
676 struct net_device *dev;
677 struct dev_priv *priv;
678 int i, ret;
680 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
681 if (!res)
682 return -ENODEV;
684 dev = alloc_etherdev(sizeof(struct dev_priv));
685 ret = -ENOMEM;
686 if (!dev)
687 goto out;
689 SET_NETDEV_DEV(dev, &pdev->dev);
691 priv = netdev_priv(dev);
694 * Fixed address and IRQ lines here.
695 * The PNP initialisation should have been
696 * done by the ether bootp loader.
698 dev->base_addr = res->start;
699 ret = platform_get_irq(pdev, 0);
701 if (ret < 0) {
702 ret = -ENODEV;
703 goto nodev;
705 dev->irq = ret;
707 ret = -ENODEV;
708 if (!request_region(dev->base_addr, 0x18, dev->name))
709 goto nodev;
712 * Reset the device.
714 inb(dev->base_addr + NET_RESET);
715 udelay(5);
718 * Check the manufacturer part of the
719 * ether address.
721 if (inb(dev->base_addr) != 0x08 ||
722 inb(dev->base_addr + 2) != 0x00 ||
723 inb(dev->base_addr + 4) != 0x2b)
724 goto release;
726 for (i = 0; i < 6; i++)
727 dev->dev_addr[i] = inb(dev->base_addr + i * 2) & 0xff;
729 am79c961_banner();
731 spin_lock_init(&priv->chip_lock);
732 init_timer(&priv->timer);
733 priv->timer.data = (unsigned long)dev;
734 priv->timer.function = am79c961_timer;
736 if (am79c961_hw_init(dev))
737 goto release;
739 dev->netdev_ops = &am79c961_netdev_ops;
741 ret = register_netdev(dev);
742 if (ret == 0) {
743 printk(KERN_INFO "%s: ether address %pM\n",
744 dev->name, dev->dev_addr);
745 return 0;
748 release:
749 release_region(dev->base_addr, 0x18);
750 nodev:
751 free_netdev(dev);
752 out:
753 return ret;
756 static struct platform_driver am79c961_driver = {
757 .probe = am79c961_probe,
758 .driver = {
759 .name = "am79c961",
763 static int __init am79c961_init(void)
765 return platform_driver_register(&am79c961_driver);
768 __initcall(am79c961_init);