NET: am79c961: ensure asm() statements are marked volatile
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / net / arm / am79c961a.c
blob084b67fbe7aac7d8b396d8b97bae2b8e90cfb9c8
1 /*
2 * linux/drivers/net/am79c961.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>
33 #include <asm/system.h>
35 #define TX_BUFFERS 15
36 #define RX_BUFFERS 25
38 #include "am79c961a.h"
40 static irqreturn_t
41 am79c961_interrupt (int irq, void *dev_id);
43 static unsigned int net_debug = NET_DEBUG;
45 static const char version[] =
46 "am79c961 ethernet driver (C) 1995-2001 Russell King v0.04\n";
48 /* --------------------------------------------------------------------------- */
50 #ifdef __arm__
51 static void write_rreg(u_long base, u_int reg, u_int val)
53 asm volatile(
54 "str%?h %1, [%2] @ NET_RAP\n\t"
55 "str%?h %0, [%2, #-4] @ NET_RDP"
57 : "r" (val), "r" (reg), "r" (ISAIO_BASE + 0x0464));
60 static inline unsigned short read_rreg(u_long base_addr, u_int reg)
62 unsigned short v;
63 asm volatile(
64 "str%?h %1, [%2] @ NET_RAP\n\t"
65 "ldr%?h %0, [%2, #-4] @ NET_RDP"
66 : "=r" (v)
67 : "r" (reg), "r" (ISAIO_BASE + 0x0464));
68 return v;
71 static inline void write_ireg(u_long base, u_int reg, u_int val)
73 asm volatile(
74 "str%?h %1, [%2] @ NET_RAP\n\t"
75 "str%?h %0, [%2, #8] @ NET_IDP"
77 : "r" (val), "r" (reg), "r" (ISAIO_BASE + 0x0464));
80 static inline unsigned short read_ireg(u_long base_addr, u_int reg)
82 u_short v;
83 asm volatile(
84 "str%?h %1, [%2] @ NAT_RAP\n\t"
85 "ldr%?h %0, [%2, #8] @ NET_IDP\n\t"
86 : "=r" (v)
87 : "r" (reg), "r" (ISAIO_BASE + 0x0464));
88 return v;
91 #define am_writeword(dev,off,val) __raw_writew(val, ISAMEM_BASE + ((off) << 1))
92 #define am_readword(dev,off) __raw_readw(ISAMEM_BASE + ((off) << 1))
94 static inline void
95 am_writebuffer(struct net_device *dev, u_int offset, unsigned char *buf, unsigned int length)
97 offset = ISAMEM_BASE + (offset << 1);
98 length = (length + 1) & ~1;
99 if ((int)buf & 2) {
100 __asm__ __volatile__("str%?h %2, [%0], #4"
101 : "=&r" (offset) : "0" (offset), "r" (buf[0] | (buf[1] << 8)));
102 buf += 2;
103 length -= 2;
105 while (length > 8) {
106 unsigned int tmp, tmp2;
107 __asm__ __volatile__(
108 "ldm%?ia %1!, {%2, %3}\n\t"
109 "str%?h %2, [%0], #4\n\t"
110 "mov%? %2, %2, lsr #16\n\t"
111 "str%?h %2, [%0], #4\n\t"
112 "str%?h %3, [%0], #4\n\t"
113 "mov%? %3, %3, lsr #16\n\t"
114 "str%?h %3, [%0], #4"
115 : "=&r" (offset), "=&r" (buf), "=r" (tmp), "=r" (tmp2)
116 : "0" (offset), "1" (buf));
117 length -= 8;
119 while (length > 0) {
120 __asm__ __volatile__("str%?h %2, [%0], #4"
121 : "=&r" (offset) : "0" (offset), "r" (buf[0] | (buf[1] << 8)));
122 buf += 2;
123 length -= 2;
127 static inline 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 "ldr%?h %2, [%0], #4\n\t"
136 "str%?b %2, [%1], #1\n\t"
137 "mov%? %2, %2, lsr #8\n\t"
138 "str%?b %2, [%1], #1"
139 : "=&r" (offset), "=&r" (buf), "=r" (tmp): "0" (offset), "1" (buf));
140 length -= 2;
142 while (length > 8) {
143 unsigned int tmp, tmp2, tmp3;
144 asm volatile(
145 "ldr%?h %2, [%0], #4\n\t"
146 "ldr%?h %3, [%0], #4\n\t"
147 "orr%? %2, %2, %3, lsl #16\n\t"
148 "ldr%?h %3, [%0], #4\n\t"
149 "ldr%?h %4, [%0], #4\n\t"
150 "orr%? %3, %3, %4, lsl #16\n\t"
151 "stm%?ia %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 "ldr%?h %2, [%0], #4\n\t"
160 "str%?b %2, [%1], #1\n\t"
161 "mov%? %2, %2, lsr #8\n\t"
162 "str%?b %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
200 am79c961_init_for_open(struct net_device *dev)
202 struct dev_priv *priv = netdev_priv(dev);
203 unsigned long flags;
204 unsigned char *p;
205 u_int hdr_addr, first_free_addr;
206 int i;
209 * Stop the chip.
211 spin_lock_irqsave(&priv->chip_lock, flags);
212 write_rreg (dev->base_addr, CSR0, CSR0_BABL|CSR0_CERR|CSR0_MISS|CSR0_MERR|CSR0_TINT|CSR0_RINT|CSR0_STOP);
213 spin_unlock_irqrestore(&priv->chip_lock, flags);
215 write_ireg (dev->base_addr, 5, 0x00a0); /* Receive address LED */
216 write_ireg (dev->base_addr, 6, 0x0081); /* Collision LED */
217 write_ireg (dev->base_addr, 7, 0x0090); /* XMIT LED */
218 write_ireg (dev->base_addr, 2, 0x0000); /* MODE register selects media */
220 for (i = LADRL; i <= LADRH; i++)
221 write_rreg (dev->base_addr, i, 0);
223 for (i = PADRL, p = dev->dev_addr; i <= PADRH; i++, p += 2)
224 write_rreg (dev->base_addr, i, p[0] | (p[1] << 8));
226 i = MODE_PORT_10BT;
227 if (dev->flags & IFF_PROMISC)
228 i |= MODE_PROMISC;
230 write_rreg (dev->base_addr, MODE, i);
231 write_rreg (dev->base_addr, POLLINT, 0);
232 write_rreg (dev->base_addr, SIZERXR, -RX_BUFFERS);
233 write_rreg (dev->base_addr, SIZETXR, -TX_BUFFERS);
235 first_free_addr = RX_BUFFERS * 8 + TX_BUFFERS * 8 + 16;
236 hdr_addr = 0;
238 priv->rxhead = 0;
239 priv->rxtail = 0;
240 priv->rxhdr = hdr_addr;
242 for (i = 0; i < RX_BUFFERS; i++) {
243 priv->rxbuffer[i] = first_free_addr;
244 am_writeword (dev, hdr_addr, first_free_addr);
245 am_writeword (dev, hdr_addr + 2, RMD_OWN);
246 am_writeword (dev, hdr_addr + 4, (-1600));
247 am_writeword (dev, hdr_addr + 6, 0);
248 first_free_addr += 1600;
249 hdr_addr += 8;
251 priv->txhead = 0;
252 priv->txtail = 0;
253 priv->txhdr = hdr_addr;
254 for (i = 0; i < TX_BUFFERS; i++) {
255 priv->txbuffer[i] = first_free_addr;
256 am_writeword (dev, hdr_addr, first_free_addr);
257 am_writeword (dev, hdr_addr + 2, TMD_STP|TMD_ENP);
258 am_writeword (dev, hdr_addr + 4, 0xf000);
259 am_writeword (dev, hdr_addr + 6, 0);
260 first_free_addr += 1600;
261 hdr_addr += 8;
264 write_rreg (dev->base_addr, BASERXL, priv->rxhdr);
265 write_rreg (dev->base_addr, BASERXH, 0);
266 write_rreg (dev->base_addr, BASETXL, priv->txhdr);
267 write_rreg (dev->base_addr, BASERXH, 0);
268 write_rreg (dev->base_addr, CSR0, CSR0_STOP);
269 write_rreg (dev->base_addr, CSR3, CSR3_IDONM|CSR3_BABLM|CSR3_DXSUFLO);
270 write_rreg (dev->base_addr, CSR4, CSR4_APAD_XMIT|CSR4_MFCOM|CSR4_RCVCCOM|CSR4_TXSTRTM|CSR4_JABM);
271 write_rreg (dev->base_addr, CSR0, CSR0_IENA|CSR0_STRT);
274 static void am79c961_timer(unsigned long data)
276 struct net_device *dev = (struct net_device *)data;
277 struct dev_priv *priv = netdev_priv(dev);
278 unsigned int lnkstat, carrier;
280 lnkstat = read_ireg(dev->base_addr, ISALED0) & ISALED0_LNKST;
281 carrier = netif_carrier_ok(dev);
283 if (lnkstat && !carrier) {
284 netif_carrier_on(dev);
285 printk("%s: link up\n", dev->name);
286 } else if (!lnkstat && carrier) {
287 netif_carrier_off(dev);
288 printk("%s: link down\n", dev->name);
291 mod_timer(&priv->timer, jiffies + msecs_to_jiffies(500));
295 * Open/initialize the board.
297 static int
298 am79c961_open(struct net_device *dev)
300 struct dev_priv *priv = netdev_priv(dev);
301 int ret;
303 ret = request_irq(dev->irq, am79c961_interrupt, 0, dev->name, dev);
304 if (ret)
305 return ret;
307 am79c961_init_for_open(dev);
309 netif_carrier_off(dev);
311 priv->timer.expires = jiffies;
312 add_timer(&priv->timer);
314 netif_start_queue(dev);
316 return 0;
320 * The inverse routine to am79c961_open().
322 static int
323 am79c961_close(struct net_device *dev)
325 struct dev_priv *priv = netdev_priv(dev);
326 unsigned long flags;
328 del_timer_sync(&priv->timer);
330 netif_stop_queue(dev);
331 netif_carrier_off(dev);
333 spin_lock_irqsave(&priv->chip_lock, flags);
334 write_rreg (dev->base_addr, CSR0, CSR0_STOP);
335 write_rreg (dev->base_addr, CSR3, CSR3_MASKALL);
336 spin_unlock_irqrestore(&priv->chip_lock, flags);
338 free_irq (dev->irq, dev);
340 return 0;
343 static void am79c961_mc_hash(char *addr, unsigned short *hash)
345 if (addr[0] & 0x01) {
346 int idx, bit;
347 u32 crc;
349 crc = ether_crc_le(ETH_ALEN, addr);
351 idx = crc >> 30;
352 bit = (crc >> 26) & 15;
354 hash[idx] |= 1 << bit;
359 * Set or clear promiscuous/multicast mode filter for this adapter.
361 static void am79c961_setmulticastlist (struct net_device *dev)
363 struct dev_priv *priv = netdev_priv(dev);
364 unsigned long flags;
365 unsigned short multi_hash[4], mode;
366 int i, stopped;
368 mode = MODE_PORT_10BT;
370 if (dev->flags & IFF_PROMISC) {
371 mode |= MODE_PROMISC;
372 } else if (dev->flags & IFF_ALLMULTI) {
373 memset(multi_hash, 0xff, sizeof(multi_hash));
374 } else {
375 struct netdev_hw_addr *ha;
377 memset(multi_hash, 0x00, sizeof(multi_hash));
379 netdev_for_each_mc_addr(ha, dev)
380 am79c961_mc_hash(ha->addr, multi_hash);
383 spin_lock_irqsave(&priv->chip_lock, flags);
385 stopped = read_rreg(dev->base_addr, CSR0) & CSR0_STOP;
387 if (!stopped) {
389 * Put the chip into suspend mode
391 write_rreg(dev->base_addr, CTRL1, CTRL1_SPND);
394 * Spin waiting for chip to report suspend mode
396 while ((read_rreg(dev->base_addr, CTRL1) & CTRL1_SPND) == 0) {
397 spin_unlock_irqrestore(&priv->chip_lock, flags);
398 nop();
399 spin_lock_irqsave(&priv->chip_lock, flags);
404 * Update the multicast hash table
406 for (i = 0; i < ARRAY_SIZE(multi_hash); i++)
407 write_rreg(dev->base_addr, i + LADRL, multi_hash[i]);
410 * Write the mode register
412 write_rreg(dev->base_addr, MODE, mode);
414 if (!stopped) {
416 * Put the chip back into running mode
418 write_rreg(dev->base_addr, CTRL1, 0);
421 spin_unlock_irqrestore(&priv->chip_lock, flags);
424 static void am79c961_timeout(struct net_device *dev)
426 printk(KERN_WARNING "%s: transmit timed out, network cable problem?\n",
427 dev->name);
430 * ought to do some setup of the tx side here
433 netif_wake_queue(dev);
437 * Transmit a packet
439 static int
440 am79c961_sendpacket(struct sk_buff *skb, struct net_device *dev)
442 struct dev_priv *priv = netdev_priv(dev);
443 unsigned int hdraddr, bufaddr;
444 unsigned int head;
445 unsigned long flags;
447 head = priv->txhead;
448 hdraddr = priv->txhdr + (head << 3);
449 bufaddr = priv->txbuffer[head];
450 head += 1;
451 if (head >= TX_BUFFERS)
452 head = 0;
454 am_writebuffer (dev, bufaddr, skb->data, skb->len);
455 am_writeword (dev, hdraddr + 4, -skb->len);
456 am_writeword (dev, hdraddr + 2, TMD_OWN|TMD_STP|TMD_ENP);
457 priv->txhead = head;
459 spin_lock_irqsave(&priv->chip_lock, flags);
460 write_rreg (dev->base_addr, CSR0, CSR0_TDMD|CSR0_IENA);
461 spin_unlock_irqrestore(&priv->chip_lock, flags);
464 * If the next packet is owned by the ethernet device,
465 * then the tx ring is full and we can't add another
466 * packet.
468 if (am_readword(dev, priv->txhdr + (priv->txhead << 3) + 2) & TMD_OWN)
469 netif_stop_queue(dev);
471 dev_kfree_skb(skb);
473 return NETDEV_TX_OK;
477 * If we have a good packet(s), get it/them out of the buffers.
479 static void
480 am79c961_rx(struct net_device *dev, struct dev_priv *priv)
482 do {
483 struct sk_buff *skb;
484 u_int hdraddr;
485 u_int pktaddr;
486 u_int status;
487 int len;
489 hdraddr = priv->rxhdr + (priv->rxtail << 3);
490 pktaddr = priv->rxbuffer[priv->rxtail];
492 status = am_readword (dev, hdraddr + 2);
493 if (status & RMD_OWN) /* do we own it? */
494 break;
496 priv->rxtail ++;
497 if (priv->rxtail >= RX_BUFFERS)
498 priv->rxtail = 0;
500 if ((status & (RMD_ERR|RMD_STP|RMD_ENP)) != (RMD_STP|RMD_ENP)) {
501 am_writeword (dev, hdraddr + 2, RMD_OWN);
502 dev->stats.rx_errors++;
503 if (status & RMD_ERR) {
504 if (status & RMD_FRAM)
505 dev->stats.rx_frame_errors++;
506 if (status & RMD_CRC)
507 dev->stats.rx_crc_errors++;
508 } else if (status & RMD_STP)
509 dev->stats.rx_length_errors++;
510 continue;
513 len = am_readword(dev, hdraddr + 6);
514 skb = dev_alloc_skb(len + 2);
516 if (skb) {
517 skb_reserve(skb, 2);
519 am_readbuffer(dev, pktaddr, skb_put(skb, len), len);
520 am_writeword(dev, hdraddr + 2, RMD_OWN);
521 skb->protocol = eth_type_trans(skb, dev);
522 netif_rx(skb);
523 dev->stats.rx_bytes += len;
524 dev->stats.rx_packets++;
525 } else {
526 am_writeword (dev, hdraddr + 2, RMD_OWN);
527 printk (KERN_WARNING "%s: memory squeeze, dropping packet.\n", dev->name);
528 dev->stats.rx_dropped++;
529 break;
531 } while (1);
535 * Update stats for the transmitted packet
537 static void
538 am79c961_tx(struct net_device *dev, struct dev_priv *priv)
540 do {
541 short len;
542 u_int hdraddr;
543 u_int status;
545 hdraddr = priv->txhdr + (priv->txtail << 3);
546 status = am_readword (dev, hdraddr + 2);
547 if (status & TMD_OWN)
548 break;
550 priv->txtail ++;
551 if (priv->txtail >= TX_BUFFERS)
552 priv->txtail = 0;
554 if (status & TMD_ERR) {
555 u_int status2;
557 dev->stats.tx_errors++;
559 status2 = am_readword (dev, hdraddr + 6);
562 * Clear the error byte
564 am_writeword (dev, hdraddr + 6, 0);
566 if (status2 & TST_RTRY)
567 dev->stats.collisions += 16;
568 if (status2 & TST_LCOL)
569 dev->stats.tx_window_errors++;
570 if (status2 & TST_LCAR)
571 dev->stats.tx_carrier_errors++;
572 if (status2 & TST_UFLO)
573 dev->stats.tx_fifo_errors++;
574 continue;
576 dev->stats.tx_packets++;
577 len = am_readword (dev, hdraddr + 4);
578 dev->stats.tx_bytes += -len;
579 } while (priv->txtail != priv->txhead);
581 netif_wake_queue(dev);
584 static irqreturn_t
585 am79c961_interrupt(int irq, void *dev_id)
587 struct net_device *dev = (struct net_device *)dev_id;
588 struct dev_priv *priv = netdev_priv(dev);
589 u_int status, n = 100;
590 int handled = 0;
592 do {
593 status = read_rreg(dev->base_addr, CSR0);
594 write_rreg(dev->base_addr, CSR0, status &
595 (CSR0_IENA|CSR0_TINT|CSR0_RINT|
596 CSR0_MERR|CSR0_MISS|CSR0_CERR|CSR0_BABL));
598 if (status & CSR0_RINT) {
599 handled = 1;
600 am79c961_rx(dev, priv);
602 if (status & CSR0_TINT) {
603 handled = 1;
604 am79c961_tx(dev, priv);
606 if (status & CSR0_MISS) {
607 handled = 1;
608 dev->stats.rx_dropped++;
610 if (status & CSR0_CERR) {
611 handled = 1;
612 mod_timer(&priv->timer, jiffies);
614 } while (--n && status & (CSR0_RINT | CSR0_TINT));
616 return IRQ_RETVAL(handled);
619 #ifdef CONFIG_NET_POLL_CONTROLLER
620 static void am79c961_poll_controller(struct net_device *dev)
622 unsigned long flags;
623 local_irq_save(flags);
624 am79c961_interrupt(dev->irq, dev);
625 local_irq_restore(flags);
627 #endif
630 * Initialise the chip. Note that we always expect
631 * to be entered with interrupts enabled.
633 static int
634 am79c961_hw_init(struct net_device *dev)
636 struct dev_priv *priv = netdev_priv(dev);
638 spin_lock_irq(&priv->chip_lock);
639 write_rreg (dev->base_addr, CSR0, CSR0_STOP);
640 write_rreg (dev->base_addr, CSR3, CSR3_MASKALL);
641 spin_unlock_irq(&priv->chip_lock);
643 am79c961_ramtest(dev, 0x66);
644 am79c961_ramtest(dev, 0x99);
646 return 0;
649 static void __init am79c961_banner(void)
651 static unsigned version_printed;
653 if (net_debug && version_printed++ == 0)
654 printk(KERN_INFO "%s", version);
656 static const struct net_device_ops am79c961_netdev_ops = {
657 .ndo_open = am79c961_open,
658 .ndo_stop = am79c961_close,
659 .ndo_start_xmit = am79c961_sendpacket,
660 .ndo_set_multicast_list = am79c961_setmulticastlist,
661 .ndo_tx_timeout = am79c961_timeout,
662 .ndo_validate_addr = eth_validate_addr,
663 .ndo_change_mtu = eth_change_mtu,
664 .ndo_set_mac_address = eth_mac_addr,
665 #ifdef CONFIG_NET_POLL_CONTROLLER
666 .ndo_poll_controller = am79c961_poll_controller,
667 #endif
670 static int __devinit am79c961_probe(struct platform_device *pdev)
672 struct resource *res;
673 struct net_device *dev;
674 struct dev_priv *priv;
675 int i, ret;
677 res = platform_get_resource(pdev, IORESOURCE_IO, 0);
678 if (!res)
679 return -ENODEV;
681 dev = alloc_etherdev(sizeof(struct dev_priv));
682 ret = -ENOMEM;
683 if (!dev)
684 goto out;
686 SET_NETDEV_DEV(dev, &pdev->dev);
688 priv = netdev_priv(dev);
691 * Fixed address and IRQ lines here.
692 * The PNP initialisation should have been
693 * done by the ether bootp loader.
695 dev->base_addr = res->start;
696 ret = platform_get_irq(pdev, 0);
698 if (ret < 0) {
699 ret = -ENODEV;
700 goto nodev;
702 dev->irq = ret;
704 ret = -ENODEV;
705 if (!request_region(dev->base_addr, 0x18, dev->name))
706 goto nodev;
709 * Reset the device.
711 inb(dev->base_addr + NET_RESET);
712 udelay(5);
715 * Check the manufacturer part of the
716 * ether address.
718 if (inb(dev->base_addr) != 0x08 ||
719 inb(dev->base_addr + 2) != 0x00 ||
720 inb(dev->base_addr + 4) != 0x2b)
721 goto release;
723 for (i = 0; i < 6; i++)
724 dev->dev_addr[i] = inb(dev->base_addr + i * 2) & 0xff;
726 am79c961_banner();
728 spin_lock_init(&priv->chip_lock);
729 init_timer(&priv->timer);
730 priv->timer.data = (unsigned long)dev;
731 priv->timer.function = am79c961_timer;
733 if (am79c961_hw_init(dev))
734 goto release;
736 dev->netdev_ops = &am79c961_netdev_ops;
738 ret = register_netdev(dev);
739 if (ret == 0) {
740 printk(KERN_INFO "%s: ether address %pM\n",
741 dev->name, dev->dev_addr);
742 return 0;
745 release:
746 release_region(dev->base_addr, 0x18);
747 nodev:
748 free_netdev(dev);
749 out:
750 return ret;
753 static struct platform_driver am79c961_driver = {
754 .probe = am79c961_probe,
755 .driver = {
756 .name = "am79c961",
760 static int __init am79c961_init(void)
762 return platform_driver_register(&am79c961_driver);
765 __initcall(am79c961_init);