2 * Amiga Linux/68k A2065 Ethernet Driver
4 * (C) Copyright 1995-2003 by Geert Uytterhoeven <geert@linux-m68k.org>
7 * - Janos Farkas (CHEXUM@sparta.banki.hu)
8 * - Jes Degn Soerensen (jds@kom.auc.dk)
9 * - Matt Domsch (Matt_Domsch@dell.com)
11 * ----------------------------------------------------------------------------
13 * This program is based on
15 * ariadne.?: Amiga Linux/68k Ariadne Ethernet Driver
16 * (C) Copyright 1995 by Geert Uytterhoeven,
19 * lance.c: An AMD LANCE ethernet driver for linux.
20 * Written 1993-94 by Donald Becker.
22 * Am79C960: PCnet(tm)-ISA Single-Chip Ethernet Controller
23 * Advanced Micro Devices
24 * Publication #16907, Rev. B, Amendment/0, May 1994
26 * ----------------------------------------------------------------------------
28 * This file is subject to the terms and conditions of the GNU General Public
29 * License. See the file COPYING in the main directory of the Linux
30 * distribution for more details.
32 * ----------------------------------------------------------------------------
34 * The A2065 is a Zorro-II board made by Commodore/Ameristar. It contains:
36 * - an Am7990 Local Area Network Controller for Ethernet (LANCE) with
37 * both 10BASE-2 (thin coax) and AUI (DB-15) connectors
40 #include <linux/errno.h>
41 #include <linux/netdevice.h>
42 #include <linux/etherdevice.h>
43 #include <linux/module.h>
44 #include <linux/stddef.h>
45 #include <linux/kernel.h>
46 #include <linux/interrupt.h>
47 #include <linux/ioport.h>
48 #include <linux/skbuff.h>
49 #include <linux/slab.h>
50 #include <linux/string.h>
51 #include <linux/init.h>
52 #include <linux/crc32.h>
53 #include <linux/zorro.h>
54 #include <linux/bitops.h>
57 #include <asm/amigaints.h>
58 #include <asm/amigahw.h>
64 * Transmit/Receive Ring Definitions
67 #define LANCE_LOG_TX_BUFFERS (2)
68 #define LANCE_LOG_RX_BUFFERS (4)
70 #define TX_RING_SIZE (1<<LANCE_LOG_TX_BUFFERS)
71 #define RX_RING_SIZE (1<<LANCE_LOG_RX_BUFFERS)
73 #define TX_RING_MOD_MASK (TX_RING_SIZE-1)
74 #define RX_RING_MOD_MASK (RX_RING_SIZE-1)
76 #define PKT_BUF_SIZE (1544)
77 #define RX_BUFF_SIZE PKT_BUF_SIZE
78 #define TX_BUFF_SIZE PKT_BUF_SIZE
82 * Layout of the Lance's RAM Buffer
86 struct lance_init_block
{
87 unsigned short mode
; /* Pre-set mode (reg. 15) */
88 unsigned char phys_addr
[6]; /* Physical ethernet address */
89 unsigned filter
[2]; /* Multicast filter. */
91 /* Receive and transmit ring base, along with extra bits. */
92 unsigned short rx_ptr
; /* receive descriptor addr */
93 unsigned short rx_len
; /* receive len and high addr */
94 unsigned short tx_ptr
; /* transmit descriptor addr */
95 unsigned short tx_len
; /* transmit len and high addr */
97 /* The Tx and Rx ring entries must aligned on 8-byte boundaries. */
98 struct lance_rx_desc brx_ring
[RX_RING_SIZE
];
99 struct lance_tx_desc btx_ring
[TX_RING_SIZE
];
101 char rx_buf
[RX_RING_SIZE
][RX_BUFF_SIZE
];
102 char tx_buf
[TX_RING_SIZE
][TX_BUFF_SIZE
];
107 * Private Device Data
110 struct lance_private
{
112 volatile struct lance_regs
*ll
;
113 volatile struct lance_init_block
*init_block
; /* Hosts view */
114 volatile struct lance_init_block
*lance_init_block
; /* Lance view */
119 int lance_log_rx_bufs
, lance_log_tx_bufs
;
120 int rx_ring_mod_mask
, tx_ring_mod_mask
;
122 struct net_device_stats stats
;
123 int tpe
; /* cable-selection is TPE */
124 int auto_select
; /* cable-selection by carrier */
125 unsigned short busmaster_regval
;
127 #ifdef CONFIG_SUNLANCE
128 struct Linux_SBus_DMA
*ledma
; /* if set this points to ledma and arch=4m */
129 int burst_sizes
; /* ledma SBus burst sizes */
131 struct timer_list multicast_timer
;
134 #define TX_BUFFS_AVAIL ((lp->tx_old<=lp->tx_new)?\
135 lp->tx_old+lp->tx_ring_mod_mask-lp->tx_new:\
136 lp->tx_old - lp->tx_new-1)
139 #define LANCE_ADDR(x) ((int)(x) & ~0xff000000)
141 /* Load the CSR registers */
142 static void load_csrs (struct lance_private
*lp
)
144 volatile struct lance_regs
*ll
= lp
->ll
;
145 volatile struct lance_init_block
*aib
= lp
->lance_init_block
;
148 leptr
= LANCE_ADDR (aib
);
151 ll
->rdp
= (leptr
& 0xFFFF);
153 ll
->rdp
= leptr
>> 16;
155 ll
->rdp
= lp
->busmaster_regval
;
157 /* Point back to csr0 */
163 /* Setup the Lance Rx and Tx rings */
164 static void lance_init_ring (struct net_device
*dev
)
166 struct lance_private
*lp
= netdev_priv(dev
);
167 volatile struct lance_init_block
*ib
= lp
->init_block
;
168 volatile struct lance_init_block
*aib
; /* for LANCE_ADDR computations */
172 aib
= lp
->lance_init_block
;
174 /* Lock out other processes while setting up hardware */
175 netif_stop_queue(dev
);
176 lp
->rx_new
= lp
->tx_new
= 0;
177 lp
->rx_old
= lp
->tx_old
= 0;
181 /* Copy the ethernet address to the lance init block
182 * Note that on the sparc you need to swap the ethernet address.
184 ib
->phys_addr
[0] = dev
->dev_addr
[1];
185 ib
->phys_addr
[1] = dev
->dev_addr
[0];
186 ib
->phys_addr
[2] = dev
->dev_addr
[3];
187 ib
->phys_addr
[3] = dev
->dev_addr
[2];
188 ib
->phys_addr
[4] = dev
->dev_addr
[5];
189 ib
->phys_addr
[5] = dev
->dev_addr
[4];
192 printk(KERN_DEBUG
"TX rings:\n");
194 /* Setup the Tx ring entries */
195 for (i
= 0; i
<= (1<<lp
->lance_log_tx_bufs
); i
++) {
196 leptr
= LANCE_ADDR(&aib
->tx_buf
[i
][0]);
197 ib
->btx_ring
[i
].tmd0
= leptr
;
198 ib
->btx_ring
[i
].tmd1_hadr
= leptr
>> 16;
199 ib
->btx_ring
[i
].tmd1_bits
= 0;
200 ib
->btx_ring
[i
].length
= 0xf000; /* The ones required by tmd2 */
201 ib
->btx_ring
[i
].misc
= 0;
203 printk(KERN_DEBUG
"%d: 0x%8.8x\n", i
, leptr
);
206 /* Setup the Rx ring entries */
208 printk(KERN_DEBUG
"RX rings:\n");
209 for (i
= 0; i
< (1<<lp
->lance_log_rx_bufs
); i
++) {
210 leptr
= LANCE_ADDR(&aib
->rx_buf
[i
][0]);
212 ib
->brx_ring
[i
].rmd0
= leptr
;
213 ib
->brx_ring
[i
].rmd1_hadr
= leptr
>> 16;
214 ib
->brx_ring
[i
].rmd1_bits
= LE_R1_OWN
;
215 ib
->brx_ring
[i
].length
= -RX_BUFF_SIZE
| 0xf000;
216 ib
->brx_ring
[i
].mblength
= 0;
218 printk(KERN_DEBUG
"%d: 0x%8.8x\n", i
, leptr
);
221 /* Setup the initialization block */
223 /* Setup rx descriptor pointer */
224 leptr
= LANCE_ADDR(&aib
->brx_ring
);
225 ib
->rx_len
= (lp
->lance_log_rx_bufs
<< 13) | (leptr
>> 16);
228 printk(KERN_DEBUG
"RX ptr: %8.8x\n", leptr
);
230 /* Setup tx descriptor pointer */
231 leptr
= LANCE_ADDR(&aib
->btx_ring
);
232 ib
->tx_len
= (lp
->lance_log_tx_bufs
<< 13) | (leptr
>> 16);
235 printk(KERN_DEBUG
"TX ptr: %8.8x\n", leptr
);
237 /* Clear the multicast filter */
242 static int init_restart_lance (struct lance_private
*lp
)
244 volatile struct lance_regs
*ll
= lp
->ll
;
248 ll
->rdp
= LE_C0_INIT
;
250 /* Wait for the lance to complete initialization */
251 for (i
= 0; (i
< 100) && !(ll
->rdp
& (LE_C0_ERR
| LE_C0_IDON
)); i
++)
253 if ((i
== 100) || (ll
->rdp
& LE_C0_ERR
)) {
254 printk(KERN_ERR
"LANCE unopened after %d ticks, csr0=%4.4x.\n",
259 /* Clear IDON by writing a "1", enable interrupts and start lance */
260 ll
->rdp
= LE_C0_IDON
;
261 ll
->rdp
= LE_C0_INEA
| LE_C0_STRT
;
266 static int lance_rx (struct net_device
*dev
)
268 struct lance_private
*lp
= netdev_priv(dev
);
269 volatile struct lance_init_block
*ib
= lp
->init_block
;
270 volatile struct lance_regs
*ll
= lp
->ll
;
271 volatile struct lance_rx_desc
*rd
;
273 int len
= 0; /* XXX shut up gcc warnings */
274 struct sk_buff
*skb
= 0; /* XXX shut up gcc warnings */
278 printk(KERN_DEBUG
"[");
279 for (i
= 0; i
< RX_RING_SIZE
; i
++) {
282 ib
->brx_ring
[i
].rmd1_bits
& LE_R1_OWN
? "_" : "X");
285 ib
->brx_ring
[i
].rmd1_bits
& LE_R1_OWN
? "." : "1");
290 ll
->rdp
= LE_C0_RINT
|LE_C0_INEA
;
291 for (rd
= &ib
->brx_ring
[lp
->rx_new
];
292 !((bits
= rd
->rmd1_bits
) & LE_R1_OWN
);
293 rd
= &ib
->brx_ring
[lp
->rx_new
]) {
295 /* We got an incomplete frame? */
296 if ((bits
& LE_R1_POK
) != LE_R1_POK
) {
297 lp
->stats
.rx_over_errors
++;
298 lp
->stats
.rx_errors
++;
300 } else if (bits
& LE_R1_ERR
) {
301 /* Count only the end frame as a rx error,
304 if (bits
& LE_R1_BUF
) lp
->stats
.rx_fifo_errors
++;
305 if (bits
& LE_R1_CRC
) lp
->stats
.rx_crc_errors
++;
306 if (bits
& LE_R1_OFL
) lp
->stats
.rx_over_errors
++;
307 if (bits
& LE_R1_FRA
) lp
->stats
.rx_frame_errors
++;
308 if (bits
& LE_R1_EOP
) lp
->stats
.rx_errors
++;
310 len
= (rd
->mblength
& 0xfff) - 4;
311 skb
= dev_alloc_skb (len
+2);
314 printk(KERN_WARNING
"%s: Memory squeeze, "
315 "deferring packet.\n", dev
->name
);
316 lp
->stats
.rx_dropped
++;
318 rd
->rmd1_bits
= LE_R1_OWN
;
319 lp
->rx_new
= (lp
->rx_new
+ 1) & lp
->rx_ring_mod_mask
;
323 skb_reserve (skb
, 2); /* 16 byte align */
324 skb_put (skb
, len
); /* make room */
325 skb_copy_to_linear_data(skb
,
326 (unsigned char *)&(ib
->rx_buf
[lp
->rx_new
][0]),
328 skb
->protocol
= eth_type_trans (skb
, dev
);
330 dev
->last_rx
= jiffies
;
331 lp
->stats
.rx_packets
++;
332 lp
->stats
.rx_bytes
+= len
;
335 /* Return the packet to the pool */
337 rd
->rmd1_bits
= LE_R1_OWN
;
338 lp
->rx_new
= (lp
->rx_new
+ 1) & lp
->rx_ring_mod_mask
;
343 static int lance_tx (struct net_device
*dev
)
345 struct lance_private
*lp
= netdev_priv(dev
);
346 volatile struct lance_init_block
*ib
= lp
->init_block
;
347 volatile struct lance_regs
*ll
= lp
->ll
;
348 volatile struct lance_tx_desc
*td
;
353 ll
->rdp
= LE_C0_TINT
| LE_C0_INEA
;
357 for (i
= j
; i
!= lp
->tx_new
; i
= j
) {
358 td
= &ib
->btx_ring
[i
];
360 /* If we hit a packet not owned by us, stop */
361 if (td
->tmd1_bits
& LE_T1_OWN
)
364 if (td
->tmd1_bits
& LE_T1_ERR
) {
367 lp
->stats
.tx_errors
++;
368 if (status
& LE_T3_RTY
) lp
->stats
.tx_aborted_errors
++;
369 if (status
& LE_T3_LCOL
) lp
->stats
.tx_window_errors
++;
371 if (status
& LE_T3_CLOS
) {
372 lp
->stats
.tx_carrier_errors
++;
373 if (lp
->auto_select
) {
374 lp
->tpe
= 1 - lp
->tpe
;
375 printk(KERN_ERR
"%s: Carrier Lost, "
376 "trying %s\n", dev
->name
,
377 lp
->tpe
?"TPE":"AUI");
380 ll
->rdp
= LE_C0_STOP
;
381 lance_init_ring (dev
);
383 init_restart_lance (lp
);
388 /* buffer errors and underflows turn off the transmitter */
389 /* Restart the adapter */
390 if (status
& (LE_T3_BUF
|LE_T3_UFL
)) {
391 lp
->stats
.tx_fifo_errors
++;
393 printk(KERN_ERR
"%s: Tx: ERR_BUF|ERR_UFL, "
394 "restarting\n", dev
->name
);
397 ll
->rdp
= LE_C0_STOP
;
398 lance_init_ring (dev
);
400 init_restart_lance (lp
);
403 } else if ((td
->tmd1_bits
& LE_T1_POK
) == LE_T1_POK
) {
405 * So we don't count the packet more than once.
407 td
->tmd1_bits
&= ~(LE_T1_POK
);
409 /* One collision before packet was sent. */
410 if (td
->tmd1_bits
& LE_T1_EONE
)
411 lp
->stats
.collisions
++;
413 /* More than one collision, be optimistic. */
414 if (td
->tmd1_bits
& LE_T1_EMORE
)
415 lp
->stats
.collisions
+= 2;
417 lp
->stats
.tx_packets
++;
420 j
= (j
+ 1) & lp
->tx_ring_mod_mask
;
423 ll
->rdp
= LE_C0_TINT
| LE_C0_INEA
;
427 static irqreturn_t
lance_interrupt (int irq
, void *dev_id
)
429 struct net_device
*dev
;
430 struct lance_private
*lp
;
431 volatile struct lance_regs
*ll
;
434 dev
= (struct net_device
*) dev_id
;
436 lp
= netdev_priv(dev
);
439 ll
->rap
= LE_CSR0
; /* LANCE Controller Status */
442 if (!(csr0
& LE_C0_INTR
)) /* Check if any interrupt has */
443 return IRQ_NONE
; /* been generated by the Lance. */
445 /* Acknowledge all the interrupt sources ASAP */
446 ll
->rdp
= csr0
& ~(LE_C0_INEA
|LE_C0_TDMD
|LE_C0_STOP
|LE_C0_STRT
|
449 if ((csr0
& LE_C0_ERR
)) {
450 /* Clear the error condition */
451 ll
->rdp
= LE_C0_BABL
|LE_C0_ERR
|LE_C0_MISS
|LE_C0_INEA
;
454 if (csr0
& LE_C0_RINT
)
457 if (csr0
& LE_C0_TINT
)
460 /* Log misc errors. */
461 if (csr0
& LE_C0_BABL
)
462 lp
->stats
.tx_errors
++; /* Tx babble. */
463 if (csr0
& LE_C0_MISS
)
464 lp
->stats
.rx_errors
++; /* Missed a Rx frame. */
465 if (csr0
& LE_C0_MERR
) {
466 printk(KERN_ERR
"%s: Bus master arbitration failure, status "
467 "%4.4x.\n", dev
->name
, csr0
);
468 /* Restart the chip. */
469 ll
->rdp
= LE_C0_STRT
;
472 if (netif_queue_stopped(dev
) && TX_BUFFS_AVAIL
> 0)
473 netif_wake_queue(dev
);
476 ll
->rdp
= LE_C0_BABL
|LE_C0_CERR
|LE_C0_MISS
|LE_C0_MERR
|
477 LE_C0_IDON
|LE_C0_INEA
;
481 struct net_device
*last_dev
= 0;
483 static int lance_open (struct net_device
*dev
)
485 struct lance_private
*lp
= netdev_priv(dev
);
486 volatile struct lance_regs
*ll
= lp
->ll
;
493 ll
->rdp
= LE_C0_STOP
;
495 /* Install the Interrupt handler */
496 ret
= request_irq(IRQ_AMIGA_PORTS
, lance_interrupt
, IRQF_SHARED
,
501 lance_init_ring (dev
);
503 netif_start_queue(dev
);
505 return init_restart_lance (lp
);
508 static int lance_close (struct net_device
*dev
)
510 struct lance_private
*lp
= netdev_priv(dev
);
511 volatile struct lance_regs
*ll
= lp
->ll
;
513 netif_stop_queue(dev
);
514 del_timer_sync(&lp
->multicast_timer
);
518 ll
->rdp
= LE_C0_STOP
;
520 free_irq(IRQ_AMIGA_PORTS
, dev
);
524 static inline int lance_reset (struct net_device
*dev
)
526 struct lance_private
*lp
= netdev_priv(dev
);
527 volatile struct lance_regs
*ll
= lp
->ll
;
532 ll
->rdp
= LE_C0_STOP
;
536 lance_init_ring (dev
);
537 dev
->trans_start
= jiffies
;
538 netif_start_queue(dev
);
540 status
= init_restart_lance (lp
);
542 printk(KERN_DEBUG
"Lance restart=%d\n", status
);
547 static void lance_tx_timeout(struct net_device
*dev
)
549 struct lance_private
*lp
= netdev_priv(dev
);
550 volatile struct lance_regs
*ll
= lp
->ll
;
552 printk(KERN_ERR
"%s: transmit timed out, status %04x, reset\n",
555 netif_wake_queue(dev
);
558 static int lance_start_xmit (struct sk_buff
*skb
, struct net_device
*dev
)
560 struct lance_private
*lp
= netdev_priv(dev
);
561 volatile struct lance_regs
*ll
= lp
->ll
;
562 volatile struct lance_init_block
*ib
= lp
->init_block
;
563 int entry
, skblen
, len
;
570 if (len
< ETH_ZLEN
) {
572 if (skb_padto(skb
, ETH_ZLEN
))
576 local_irq_save(flags
);
578 if (!TX_BUFFS_AVAIL
){
579 local_irq_restore(flags
);
584 /* dump the packet */
588 for (i
= 0; i
< 64; i
++) {
590 printk("\n" KERN_DEBUG
);
591 printk ("%2.2x ", skb
->data
[i
]);
596 entry
= lp
->tx_new
& lp
->tx_ring_mod_mask
;
597 ib
->btx_ring
[entry
].length
= (-len
) | 0xf000;
598 ib
->btx_ring
[entry
].misc
= 0;
600 skb_copy_from_linear_data(skb
, (void *)&ib
->tx_buf
[entry
][0], skblen
);
602 /* Clear the slack of the packet, do I need this? */
604 memset ((void *) &ib
->tx_buf
[entry
][skblen
], 0, len
- skblen
);
606 /* Now, give the packet to the lance */
607 ib
->btx_ring
[entry
].tmd1_bits
= (LE_T1_POK
|LE_T1_OWN
);
608 lp
->tx_new
= (lp
->tx_new
+1) & lp
->tx_ring_mod_mask
;
609 lp
->stats
.tx_bytes
+= skblen
;
611 if (TX_BUFFS_AVAIL
<= 0)
612 netif_stop_queue(dev
);
614 /* Kick the lance: transmit now */
615 ll
->rdp
= LE_C0_INEA
| LE_C0_TDMD
;
616 dev
->trans_start
= jiffies
;
619 local_irq_restore(flags
);
624 static struct net_device_stats
*lance_get_stats (struct net_device
*dev
)
626 struct lance_private
*lp
= netdev_priv(dev
);
631 /* taken from the depca driver */
632 static void lance_load_multicast (struct net_device
*dev
)
634 struct lance_private
*lp
= netdev_priv(dev
);
635 volatile struct lance_init_block
*ib
= lp
->init_block
;
636 volatile u16
*mcast_table
= (u16
*)&ib
->filter
;
637 struct dev_mc_list
*dmi
=dev
->mc_list
;
642 /* set all multicast bits */
643 if (dev
->flags
& IFF_ALLMULTI
){
644 ib
->filter
[0] = 0xffffffff;
645 ib
->filter
[1] = 0xffffffff;
648 /* clear the multicast filter */
653 for (i
= 0; i
< dev
->mc_count
; i
++){
654 addrs
= dmi
->dmi_addr
;
657 /* multicast address? */
661 crc
= ether_crc_le(6, addrs
);
663 mcast_table
[crc
>> 4] |= 1 << (crc
& 0xf);
668 static void lance_set_multicast (struct net_device
*dev
)
670 struct lance_private
*lp
= netdev_priv(dev
);
671 volatile struct lance_init_block
*ib
= lp
->init_block
;
672 volatile struct lance_regs
*ll
= lp
->ll
;
674 if (!netif_running(dev
))
677 if (lp
->tx_old
!= lp
->tx_new
) {
678 mod_timer(&lp
->multicast_timer
, jiffies
+ 4);
679 netif_wake_queue(dev
);
683 netif_stop_queue(dev
);
686 ll
->rdp
= LE_C0_STOP
;
687 lance_init_ring (dev
);
689 if (dev
->flags
& IFF_PROMISC
) {
690 ib
->mode
|= LE_MO_PROM
;
692 ib
->mode
&= ~LE_MO_PROM
;
693 lance_load_multicast (dev
);
696 init_restart_lance (lp
);
697 netif_wake_queue(dev
);
700 static int __devinit
a2065_init_one(struct zorro_dev
*z
,
701 const struct zorro_device_id
*ent
);
702 static void __devexit
a2065_remove_one(struct zorro_dev
*z
);
705 static struct zorro_device_id a2065_zorro_tbl
[] __devinitdata
= {
706 { ZORRO_PROD_CBM_A2065_1
},
707 { ZORRO_PROD_CBM_A2065_2
},
708 { ZORRO_PROD_AMERISTAR_A2065
},
712 static struct zorro_driver a2065_driver
= {
714 .id_table
= a2065_zorro_tbl
,
715 .probe
= a2065_init_one
,
716 .remove
= __devexit_p(a2065_remove_one
),
719 static int __devinit
a2065_init_one(struct zorro_dev
*z
,
720 const struct zorro_device_id
*ent
)
722 struct net_device
*dev
;
723 struct lance_private
*priv
;
724 unsigned long board
, base_addr
, mem_start
;
725 struct resource
*r1
, *r2
;
728 board
= z
->resource
.start
;
729 base_addr
= board
+A2065_LANCE
;
730 mem_start
= board
+A2065_RAM
;
732 r1
= request_mem_region(base_addr
, sizeof(struct lance_regs
),
736 r2
= request_mem_region(mem_start
, A2065_RAM_SIZE
, "RAM");
738 release_resource(r1
);
742 dev
= alloc_etherdev(sizeof(struct lance_private
));
744 release_resource(r1
);
745 release_resource(r2
);
749 SET_MODULE_OWNER(dev
);
750 priv
= netdev_priv(dev
);
752 r1
->name
= dev
->name
;
753 r2
->name
= dev
->name
;
755 dev
->dev_addr
[0] = 0x00;
756 if (z
->id
!= ZORRO_PROD_AMERISTAR_A2065
) { /* Commodore */
757 dev
->dev_addr
[1] = 0x80;
758 dev
->dev_addr
[2] = 0x10;
759 } else { /* Ameristar */
760 dev
->dev_addr
[1] = 0x00;
761 dev
->dev_addr
[2] = 0x9f;
763 dev
->dev_addr
[3] = (z
->rom
.er_SerialNumber
>>16) & 0xff;
764 dev
->dev_addr
[4] = (z
->rom
.er_SerialNumber
>>8) & 0xff;
765 dev
->dev_addr
[5] = z
->rom
.er_SerialNumber
& 0xff;
766 dev
->base_addr
= ZTWO_VADDR(base_addr
);
767 dev
->mem_start
= ZTWO_VADDR(mem_start
);
768 dev
->mem_end
= dev
->mem_start
+A2065_RAM_SIZE
;
770 priv
->ll
= (volatile struct lance_regs
*)dev
->base_addr
;
771 priv
->init_block
= (struct lance_init_block
*)dev
->mem_start
;
772 priv
->lance_init_block
= (struct lance_init_block
*)A2065_RAM
;
773 priv
->auto_select
= 0;
774 priv
->busmaster_regval
= LE_C3_BSWP
;
776 priv
->lance_log_rx_bufs
= LANCE_LOG_RX_BUFFERS
;
777 priv
->lance_log_tx_bufs
= LANCE_LOG_TX_BUFFERS
;
778 priv
->rx_ring_mod_mask
= RX_RING_MOD_MASK
;
779 priv
->tx_ring_mod_mask
= TX_RING_MOD_MASK
;
781 dev
->open
= &lance_open
;
782 dev
->stop
= &lance_close
;
783 dev
->hard_start_xmit
= &lance_start_xmit
;
784 dev
->tx_timeout
= &lance_tx_timeout
;
785 dev
->watchdog_timeo
= 5*HZ
;
786 dev
->get_stats
= &lance_get_stats
;
787 dev
->set_multicast_list
= &lance_set_multicast
;
790 init_timer(&priv
->multicast_timer
);
791 priv
->multicast_timer
.data
= (unsigned long) dev
;
792 priv
->multicast_timer
.function
=
793 (void (*)(unsigned long)) &lance_set_multicast
;
795 err
= register_netdev(dev
);
797 release_resource(r1
);
798 release_resource(r2
);
802 zorro_set_drvdata(z
, dev
);
804 printk(KERN_INFO
"%s: A2065 at 0x%08lx, Ethernet Address "
805 "%02x:%02x:%02x:%02x:%02x:%02x\n", dev
->name
, board
,
806 dev
->dev_addr
[0], dev
->dev_addr
[1], dev
->dev_addr
[2],
807 dev
->dev_addr
[3], dev
->dev_addr
[4], dev
->dev_addr
[5]);
813 static void __devexit
a2065_remove_one(struct zorro_dev
*z
)
815 struct net_device
*dev
= zorro_get_drvdata(z
);
817 unregister_netdev(dev
);
818 release_mem_region(ZTWO_PADDR(dev
->base_addr
),
819 sizeof(struct lance_regs
));
820 release_mem_region(ZTWO_PADDR(dev
->mem_start
), A2065_RAM_SIZE
);
824 static int __init
a2065_init_module(void)
826 return zorro_register_driver(&a2065_driver
);
829 static void __exit
a2065_cleanup_module(void)
831 zorro_unregister_driver(&a2065_driver
);
834 module_init(a2065_init_module
);
835 module_exit(a2065_cleanup_module
);
837 MODULE_LICENSE("GPL");