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/string.h>
50 #include <linux/init.h>
51 #include <linux/crc32.h>
52 #include <linux/zorro.h>
53 #include <linux/bitops.h>
56 #include <asm/amigaints.h>
57 #include <asm/amigahw.h>
63 * Transmit/Receive Ring Definitions
66 #define LANCE_LOG_TX_BUFFERS (2)
67 #define LANCE_LOG_RX_BUFFERS (4)
69 #define TX_RING_SIZE (1<<LANCE_LOG_TX_BUFFERS)
70 #define RX_RING_SIZE (1<<LANCE_LOG_RX_BUFFERS)
72 #define TX_RING_MOD_MASK (TX_RING_SIZE-1)
73 #define RX_RING_MOD_MASK (RX_RING_SIZE-1)
75 #define PKT_BUF_SIZE (1544)
76 #define RX_BUFF_SIZE PKT_BUF_SIZE
77 #define TX_BUFF_SIZE PKT_BUF_SIZE
81 * Layout of the Lance's RAM Buffer
85 struct lance_init_block
{
86 unsigned short mode
; /* Pre-set mode (reg. 15) */
87 unsigned char phys_addr
[6]; /* Physical ethernet address */
88 unsigned filter
[2]; /* Multicast filter. */
90 /* Receive and transmit ring base, along with extra bits. */
91 unsigned short rx_ptr
; /* receive descriptor addr */
92 unsigned short rx_len
; /* receive len and high addr */
93 unsigned short tx_ptr
; /* transmit descriptor addr */
94 unsigned short tx_len
; /* transmit len and high addr */
96 /* The Tx and Rx ring entries must aligned on 8-byte boundaries. */
97 struct lance_rx_desc brx_ring
[RX_RING_SIZE
];
98 struct lance_tx_desc btx_ring
[TX_RING_SIZE
];
100 char rx_buf
[RX_RING_SIZE
][RX_BUFF_SIZE
];
101 char tx_buf
[TX_RING_SIZE
][TX_BUFF_SIZE
];
106 * Private Device Data
109 struct lance_private
{
111 volatile struct lance_regs
*ll
;
112 volatile struct lance_init_block
*init_block
; /* Hosts view */
113 volatile struct lance_init_block
*lance_init_block
; /* Lance view */
118 int lance_log_rx_bufs
, lance_log_tx_bufs
;
119 int rx_ring_mod_mask
, tx_ring_mod_mask
;
121 int tpe
; /* cable-selection is TPE */
122 int auto_select
; /* cable-selection by carrier */
123 unsigned short busmaster_regval
;
125 #ifdef CONFIG_SUNLANCE
126 struct Linux_SBus_DMA
*ledma
; /* if set this points to ledma and arch=4m */
127 int burst_sizes
; /* ledma SBus burst sizes */
129 struct timer_list multicast_timer
;
132 #define TX_BUFFS_AVAIL ((lp->tx_old<=lp->tx_new)?\
133 lp->tx_old+lp->tx_ring_mod_mask-lp->tx_new:\
134 lp->tx_old - lp->tx_new-1)
137 #define LANCE_ADDR(x) ((int)(x) & ~0xff000000)
139 /* Load the CSR registers */
140 static void load_csrs (struct lance_private
*lp
)
142 volatile struct lance_regs
*ll
= lp
->ll
;
143 volatile struct lance_init_block
*aib
= lp
->lance_init_block
;
146 leptr
= LANCE_ADDR (aib
);
149 ll
->rdp
= (leptr
& 0xFFFF);
151 ll
->rdp
= leptr
>> 16;
153 ll
->rdp
= lp
->busmaster_regval
;
155 /* Point back to csr0 */
161 /* Setup the Lance Rx and Tx rings */
162 static void lance_init_ring (struct net_device
*dev
)
164 struct lance_private
*lp
= netdev_priv(dev
);
165 volatile struct lance_init_block
*ib
= lp
->init_block
;
166 volatile struct lance_init_block
*aib
; /* for LANCE_ADDR computations */
170 aib
= lp
->lance_init_block
;
172 /* Lock out other processes while setting up hardware */
173 netif_stop_queue(dev
);
174 lp
->rx_new
= lp
->tx_new
= 0;
175 lp
->rx_old
= lp
->tx_old
= 0;
179 /* Copy the ethernet address to the lance init block
180 * Note that on the sparc you need to swap the ethernet address.
182 ib
->phys_addr
[0] = dev
->dev_addr
[1];
183 ib
->phys_addr
[1] = dev
->dev_addr
[0];
184 ib
->phys_addr
[2] = dev
->dev_addr
[3];
185 ib
->phys_addr
[3] = dev
->dev_addr
[2];
186 ib
->phys_addr
[4] = dev
->dev_addr
[5];
187 ib
->phys_addr
[5] = dev
->dev_addr
[4];
190 printk(KERN_DEBUG
"TX rings:\n");
192 /* Setup the Tx ring entries */
193 for (i
= 0; i
<= (1<<lp
->lance_log_tx_bufs
); i
++) {
194 leptr
= LANCE_ADDR(&aib
->tx_buf
[i
][0]);
195 ib
->btx_ring
[i
].tmd0
= leptr
;
196 ib
->btx_ring
[i
].tmd1_hadr
= leptr
>> 16;
197 ib
->btx_ring
[i
].tmd1_bits
= 0;
198 ib
->btx_ring
[i
].length
= 0xf000; /* The ones required by tmd2 */
199 ib
->btx_ring
[i
].misc
= 0;
201 printk(KERN_DEBUG
"%d: 0x%8.8x\n", i
, leptr
);
204 /* Setup the Rx ring entries */
206 printk(KERN_DEBUG
"RX rings:\n");
207 for (i
= 0; i
< (1<<lp
->lance_log_rx_bufs
); i
++) {
208 leptr
= LANCE_ADDR(&aib
->rx_buf
[i
][0]);
210 ib
->brx_ring
[i
].rmd0
= leptr
;
211 ib
->brx_ring
[i
].rmd1_hadr
= leptr
>> 16;
212 ib
->brx_ring
[i
].rmd1_bits
= LE_R1_OWN
;
213 ib
->brx_ring
[i
].length
= -RX_BUFF_SIZE
| 0xf000;
214 ib
->brx_ring
[i
].mblength
= 0;
216 printk(KERN_DEBUG
"%d: 0x%8.8x\n", i
, leptr
);
219 /* Setup the initialization block */
221 /* Setup rx descriptor pointer */
222 leptr
= LANCE_ADDR(&aib
->brx_ring
);
223 ib
->rx_len
= (lp
->lance_log_rx_bufs
<< 13) | (leptr
>> 16);
226 printk(KERN_DEBUG
"RX ptr: %8.8x\n", leptr
);
228 /* Setup tx descriptor pointer */
229 leptr
= LANCE_ADDR(&aib
->btx_ring
);
230 ib
->tx_len
= (lp
->lance_log_tx_bufs
<< 13) | (leptr
>> 16);
233 printk(KERN_DEBUG
"TX ptr: %8.8x\n", leptr
);
235 /* Clear the multicast filter */
240 static int init_restart_lance (struct lance_private
*lp
)
242 volatile struct lance_regs
*ll
= lp
->ll
;
246 ll
->rdp
= LE_C0_INIT
;
248 /* Wait for the lance to complete initialization */
249 for (i
= 0; (i
< 100) && !(ll
->rdp
& (LE_C0_ERR
| LE_C0_IDON
)); i
++)
251 if ((i
== 100) || (ll
->rdp
& LE_C0_ERR
)) {
252 printk(KERN_ERR
"LANCE unopened after %d ticks, csr0=%4.4x.\n",
257 /* Clear IDON by writing a "1", enable interrupts and start lance */
258 ll
->rdp
= LE_C0_IDON
;
259 ll
->rdp
= LE_C0_INEA
| LE_C0_STRT
;
264 static int lance_rx (struct net_device
*dev
)
266 struct lance_private
*lp
= netdev_priv(dev
);
267 volatile struct lance_init_block
*ib
= lp
->init_block
;
268 volatile struct lance_regs
*ll
= lp
->ll
;
269 volatile struct lance_rx_desc
*rd
;
274 printk(KERN_DEBUG
"[");
275 for (i
= 0; i
< RX_RING_SIZE
; i
++) {
278 ib
->brx_ring
[i
].rmd1_bits
& LE_R1_OWN
? "_" : "X");
281 ib
->brx_ring
[i
].rmd1_bits
& LE_R1_OWN
? "." : "1");
286 ll
->rdp
= LE_C0_RINT
|LE_C0_INEA
;
287 for (rd
= &ib
->brx_ring
[lp
->rx_new
];
288 !((bits
= rd
->rmd1_bits
) & LE_R1_OWN
);
289 rd
= &ib
->brx_ring
[lp
->rx_new
]) {
291 /* We got an incomplete frame? */
292 if ((bits
& LE_R1_POK
) != LE_R1_POK
) {
293 dev
->stats
.rx_over_errors
++;
294 dev
->stats
.rx_errors
++;
296 } else if (bits
& LE_R1_ERR
) {
297 /* Count only the end frame as a rx error,
300 if (bits
& LE_R1_BUF
) dev
->stats
.rx_fifo_errors
++;
301 if (bits
& LE_R1_CRC
) dev
->stats
.rx_crc_errors
++;
302 if (bits
& LE_R1_OFL
) dev
->stats
.rx_over_errors
++;
303 if (bits
& LE_R1_FRA
) dev
->stats
.rx_frame_errors
++;
304 if (bits
& LE_R1_EOP
) dev
->stats
.rx_errors
++;
306 int len
= (rd
->mblength
& 0xfff) - 4;
307 struct sk_buff
*skb
= dev_alloc_skb (len
+2);
310 printk(KERN_WARNING
"%s: Memory squeeze, "
311 "deferring packet.\n", dev
->name
);
312 dev
->stats
.rx_dropped
++;
314 rd
->rmd1_bits
= LE_R1_OWN
;
315 lp
->rx_new
= (lp
->rx_new
+ 1) & lp
->rx_ring_mod_mask
;
319 skb_reserve (skb
, 2); /* 16 byte align */
320 skb_put (skb
, len
); /* make room */
321 skb_copy_to_linear_data(skb
,
322 (unsigned char *)&(ib
->rx_buf
[lp
->rx_new
][0]),
324 skb
->protocol
= eth_type_trans (skb
, dev
);
326 dev
->stats
.rx_packets
++;
327 dev
->stats
.rx_bytes
+= len
;
330 /* Return the packet to the pool */
332 rd
->rmd1_bits
= LE_R1_OWN
;
333 lp
->rx_new
= (lp
->rx_new
+ 1) & lp
->rx_ring_mod_mask
;
338 static int lance_tx (struct net_device
*dev
)
340 struct lance_private
*lp
= netdev_priv(dev
);
341 volatile struct lance_init_block
*ib
= lp
->init_block
;
342 volatile struct lance_regs
*ll
= lp
->ll
;
343 volatile struct lance_tx_desc
*td
;
348 ll
->rdp
= LE_C0_TINT
| LE_C0_INEA
;
352 for (i
= j
; i
!= lp
->tx_new
; i
= j
) {
353 td
= &ib
->btx_ring
[i
];
355 /* If we hit a packet not owned by us, stop */
356 if (td
->tmd1_bits
& LE_T1_OWN
)
359 if (td
->tmd1_bits
& LE_T1_ERR
) {
362 dev
->stats
.tx_errors
++;
363 if (status
& LE_T3_RTY
) dev
->stats
.tx_aborted_errors
++;
364 if (status
& LE_T3_LCOL
) dev
->stats
.tx_window_errors
++;
366 if (status
& LE_T3_CLOS
) {
367 dev
->stats
.tx_carrier_errors
++;
368 if (lp
->auto_select
) {
369 lp
->tpe
= 1 - lp
->tpe
;
370 printk(KERN_ERR
"%s: Carrier Lost, "
371 "trying %s\n", dev
->name
,
372 lp
->tpe
?"TPE":"AUI");
375 ll
->rdp
= LE_C0_STOP
;
376 lance_init_ring (dev
);
378 init_restart_lance (lp
);
383 /* buffer errors and underflows turn off the transmitter */
384 /* Restart the adapter */
385 if (status
& (LE_T3_BUF
|LE_T3_UFL
)) {
386 dev
->stats
.tx_fifo_errors
++;
388 printk(KERN_ERR
"%s: Tx: ERR_BUF|ERR_UFL, "
389 "restarting\n", dev
->name
);
392 ll
->rdp
= LE_C0_STOP
;
393 lance_init_ring (dev
);
395 init_restart_lance (lp
);
398 } else if ((td
->tmd1_bits
& LE_T1_POK
) == LE_T1_POK
) {
400 * So we don't count the packet more than once.
402 td
->tmd1_bits
&= ~(LE_T1_POK
);
404 /* One collision before packet was sent. */
405 if (td
->tmd1_bits
& LE_T1_EONE
)
406 dev
->stats
.collisions
++;
408 /* More than one collision, be optimistic. */
409 if (td
->tmd1_bits
& LE_T1_EMORE
)
410 dev
->stats
.collisions
+= 2;
412 dev
->stats
.tx_packets
++;
415 j
= (j
+ 1) & lp
->tx_ring_mod_mask
;
418 ll
->rdp
= LE_C0_TINT
| LE_C0_INEA
;
422 static irqreturn_t
lance_interrupt (int irq
, void *dev_id
)
424 struct net_device
*dev
= dev_id
;
425 struct lance_private
*lp
= netdev_priv(dev
);
426 volatile struct lance_regs
*ll
= lp
->ll
;
429 ll
->rap
= LE_CSR0
; /* LANCE Controller Status */
432 if (!(csr0
& LE_C0_INTR
)) /* Check if any interrupt has */
433 return IRQ_NONE
; /* been generated by the Lance. */
435 /* Acknowledge all the interrupt sources ASAP */
436 ll
->rdp
= csr0
& ~(LE_C0_INEA
|LE_C0_TDMD
|LE_C0_STOP
|LE_C0_STRT
|
439 if ((csr0
& LE_C0_ERR
)) {
440 /* Clear the error condition */
441 ll
->rdp
= LE_C0_BABL
|LE_C0_ERR
|LE_C0_MISS
|LE_C0_INEA
;
444 if (csr0
& LE_C0_RINT
)
447 if (csr0
& LE_C0_TINT
)
450 /* Log misc errors. */
451 if (csr0
& LE_C0_BABL
)
452 dev
->stats
.tx_errors
++; /* Tx babble. */
453 if (csr0
& LE_C0_MISS
)
454 dev
->stats
.rx_errors
++; /* Missed a Rx frame. */
455 if (csr0
& LE_C0_MERR
) {
456 printk(KERN_ERR
"%s: Bus master arbitration failure, status "
457 "%4.4x.\n", dev
->name
, csr0
);
458 /* Restart the chip. */
459 ll
->rdp
= LE_C0_STRT
;
462 if (netif_queue_stopped(dev
) && TX_BUFFS_AVAIL
> 0)
463 netif_wake_queue(dev
);
466 ll
->rdp
= LE_C0_BABL
|LE_C0_CERR
|LE_C0_MISS
|LE_C0_MERR
|
467 LE_C0_IDON
|LE_C0_INEA
;
471 static int lance_open (struct net_device
*dev
)
473 struct lance_private
*lp
= netdev_priv(dev
);
474 volatile struct lance_regs
*ll
= lp
->ll
;
479 ll
->rdp
= LE_C0_STOP
;
481 /* Install the Interrupt handler */
482 ret
= request_irq(IRQ_AMIGA_PORTS
, lance_interrupt
, IRQF_SHARED
,
487 lance_init_ring (dev
);
489 netif_start_queue(dev
);
491 return init_restart_lance (lp
);
494 static int lance_close (struct net_device
*dev
)
496 struct lance_private
*lp
= netdev_priv(dev
);
497 volatile struct lance_regs
*ll
= lp
->ll
;
499 netif_stop_queue(dev
);
500 del_timer_sync(&lp
->multicast_timer
);
504 ll
->rdp
= LE_C0_STOP
;
506 free_irq(IRQ_AMIGA_PORTS
, dev
);
510 static inline int lance_reset (struct net_device
*dev
)
512 struct lance_private
*lp
= netdev_priv(dev
);
513 volatile struct lance_regs
*ll
= lp
->ll
;
518 ll
->rdp
= LE_C0_STOP
;
522 lance_init_ring (dev
);
523 dev
->trans_start
= jiffies
; /* prevent tx timeout */
524 netif_start_queue(dev
);
526 status
= init_restart_lance (lp
);
528 printk(KERN_DEBUG
"Lance restart=%d\n", status
);
533 static void lance_tx_timeout(struct net_device
*dev
)
535 struct lance_private
*lp
= netdev_priv(dev
);
536 volatile struct lance_regs
*ll
= lp
->ll
;
538 printk(KERN_ERR
"%s: transmit timed out, status %04x, reset\n",
541 netif_wake_queue(dev
);
544 static netdev_tx_t
lance_start_xmit (struct sk_buff
*skb
,
545 struct net_device
*dev
)
547 struct lance_private
*lp
= netdev_priv(dev
);
548 volatile struct lance_regs
*ll
= lp
->ll
;
549 volatile struct lance_init_block
*ib
= lp
->init_block
;
551 int status
= NETDEV_TX_OK
;
554 if (skb_padto(skb
, ETH_ZLEN
))
556 skblen
= max_t(unsigned, skb
->len
, ETH_ZLEN
);
558 local_irq_save(flags
);
560 if (!TX_BUFFS_AVAIL
){
561 local_irq_restore(flags
);
562 return NETDEV_TX_LOCKED
;
566 /* dump the packet */
567 print_hex_dump(KERN_DEBUG
, "skb->data: ", DUMP_PREFIX_NONE
,
568 16, 1, skb
->data
, 64, true);
570 entry
= lp
->tx_new
& lp
->tx_ring_mod_mask
;
571 ib
->btx_ring
[entry
].length
= (-skblen
) | 0xf000;
572 ib
->btx_ring
[entry
].misc
= 0;
574 skb_copy_from_linear_data(skb
, (void *)&ib
->tx_buf
[entry
][0], skblen
);
576 /* Now, give the packet to the lance */
577 ib
->btx_ring
[entry
].tmd1_bits
= (LE_T1_POK
|LE_T1_OWN
);
578 lp
->tx_new
= (lp
->tx_new
+1) & lp
->tx_ring_mod_mask
;
579 dev
->stats
.tx_bytes
+= skblen
;
581 if (TX_BUFFS_AVAIL
<= 0)
582 netif_stop_queue(dev
);
584 /* Kick the lance: transmit now */
585 ll
->rdp
= LE_C0_INEA
| LE_C0_TDMD
;
588 local_irq_restore(flags
);
593 /* taken from the depca driver */
594 static void lance_load_multicast (struct net_device
*dev
)
596 struct lance_private
*lp
= netdev_priv(dev
);
597 volatile struct lance_init_block
*ib
= lp
->init_block
;
598 volatile u16
*mcast_table
= (u16
*)&ib
->filter
;
599 struct netdev_hw_addr
*ha
;
603 /* set all multicast bits */
604 if (dev
->flags
& IFF_ALLMULTI
){
605 ib
->filter
[0] = 0xffffffff;
606 ib
->filter
[1] = 0xffffffff;
609 /* clear the multicast filter */
614 netdev_for_each_mc_addr(ha
, dev
) {
617 /* multicast address? */
621 crc
= ether_crc_le(6, addrs
);
623 mcast_table
[crc
>> 4] |= 1 << (crc
& 0xf);
627 static void lance_set_multicast (struct net_device
*dev
)
629 struct lance_private
*lp
= netdev_priv(dev
);
630 volatile struct lance_init_block
*ib
= lp
->init_block
;
631 volatile struct lance_regs
*ll
= lp
->ll
;
633 if (!netif_running(dev
))
636 if (lp
->tx_old
!= lp
->tx_new
) {
637 mod_timer(&lp
->multicast_timer
, jiffies
+ 4);
638 netif_wake_queue(dev
);
642 netif_stop_queue(dev
);
645 ll
->rdp
= LE_C0_STOP
;
646 lance_init_ring (dev
);
648 if (dev
->flags
& IFF_PROMISC
) {
649 ib
->mode
|= LE_MO_PROM
;
651 ib
->mode
&= ~LE_MO_PROM
;
652 lance_load_multicast (dev
);
655 init_restart_lance (lp
);
656 netif_wake_queue(dev
);
659 static int __devinit
a2065_init_one(struct zorro_dev
*z
,
660 const struct zorro_device_id
*ent
);
661 static void __devexit
a2065_remove_one(struct zorro_dev
*z
);
664 static struct zorro_device_id a2065_zorro_tbl
[] __devinitdata
= {
665 { ZORRO_PROD_CBM_A2065_1
},
666 { ZORRO_PROD_CBM_A2065_2
},
667 { ZORRO_PROD_AMERISTAR_A2065
},
670 MODULE_DEVICE_TABLE(zorro
, a2065_zorro_tbl
);
672 static struct zorro_driver a2065_driver
= {
674 .id_table
= a2065_zorro_tbl
,
675 .probe
= a2065_init_one
,
676 .remove
= __devexit_p(a2065_remove_one
),
679 static const struct net_device_ops lance_netdev_ops
= {
680 .ndo_open
= lance_open
,
681 .ndo_stop
= lance_close
,
682 .ndo_start_xmit
= lance_start_xmit
,
683 .ndo_tx_timeout
= lance_tx_timeout
,
684 .ndo_set_multicast_list
= lance_set_multicast
,
685 .ndo_validate_addr
= eth_validate_addr
,
686 .ndo_change_mtu
= eth_change_mtu
,
687 .ndo_set_mac_address
= eth_mac_addr
,
690 static int __devinit
a2065_init_one(struct zorro_dev
*z
,
691 const struct zorro_device_id
*ent
)
693 struct net_device
*dev
;
694 struct lance_private
*priv
;
695 unsigned long board
, base_addr
, mem_start
;
696 struct resource
*r1
, *r2
;
699 board
= z
->resource
.start
;
700 base_addr
= board
+A2065_LANCE
;
701 mem_start
= board
+A2065_RAM
;
703 r1
= request_mem_region(base_addr
, sizeof(struct lance_regs
),
707 r2
= request_mem_region(mem_start
, A2065_RAM_SIZE
, "RAM");
709 release_mem_region(base_addr
, sizeof(struct lance_regs
));
713 dev
= alloc_etherdev(sizeof(struct lance_private
));
715 release_mem_region(base_addr
, sizeof(struct lance_regs
));
716 release_mem_region(mem_start
, A2065_RAM_SIZE
);
720 priv
= netdev_priv(dev
);
722 r1
->name
= dev
->name
;
723 r2
->name
= dev
->name
;
725 dev
->dev_addr
[0] = 0x00;
726 if (z
->id
!= ZORRO_PROD_AMERISTAR_A2065
) { /* Commodore */
727 dev
->dev_addr
[1] = 0x80;
728 dev
->dev_addr
[2] = 0x10;
729 } else { /* Ameristar */
730 dev
->dev_addr
[1] = 0x00;
731 dev
->dev_addr
[2] = 0x9f;
733 dev
->dev_addr
[3] = (z
->rom
.er_SerialNumber
>>16) & 0xff;
734 dev
->dev_addr
[4] = (z
->rom
.er_SerialNumber
>>8) & 0xff;
735 dev
->dev_addr
[5] = z
->rom
.er_SerialNumber
& 0xff;
736 dev
->base_addr
= ZTWO_VADDR(base_addr
);
737 dev
->mem_start
= ZTWO_VADDR(mem_start
);
738 dev
->mem_end
= dev
->mem_start
+A2065_RAM_SIZE
;
740 priv
->ll
= (volatile struct lance_regs
*)dev
->base_addr
;
741 priv
->init_block
= (struct lance_init_block
*)dev
->mem_start
;
742 priv
->lance_init_block
= (struct lance_init_block
*)A2065_RAM
;
743 priv
->auto_select
= 0;
744 priv
->busmaster_regval
= LE_C3_BSWP
;
746 priv
->lance_log_rx_bufs
= LANCE_LOG_RX_BUFFERS
;
747 priv
->lance_log_tx_bufs
= LANCE_LOG_TX_BUFFERS
;
748 priv
->rx_ring_mod_mask
= RX_RING_MOD_MASK
;
749 priv
->tx_ring_mod_mask
= TX_RING_MOD_MASK
;
751 dev
->netdev_ops
= &lance_netdev_ops
;
752 dev
->watchdog_timeo
= 5*HZ
;
755 init_timer(&priv
->multicast_timer
);
756 priv
->multicast_timer
.data
= (unsigned long) dev
;
757 priv
->multicast_timer
.function
=
758 (void (*)(unsigned long)) &lance_set_multicast
;
760 err
= register_netdev(dev
);
762 release_mem_region(base_addr
, sizeof(struct lance_regs
));
763 release_mem_region(mem_start
, A2065_RAM_SIZE
);
767 zorro_set_drvdata(z
, dev
);
769 printk(KERN_INFO
"%s: A2065 at 0x%08lx, Ethernet Address "
770 "%pM\n", dev
->name
, board
, dev
->dev_addr
);
776 static void __devexit
a2065_remove_one(struct zorro_dev
*z
)
778 struct net_device
*dev
= zorro_get_drvdata(z
);
780 unregister_netdev(dev
);
781 release_mem_region(ZTWO_PADDR(dev
->base_addr
),
782 sizeof(struct lance_regs
));
783 release_mem_region(ZTWO_PADDR(dev
->mem_start
), A2065_RAM_SIZE
);
787 static int __init
a2065_init_module(void)
789 return zorro_register_driver(&a2065_driver
);
792 static void __exit
a2065_cleanup_module(void)
794 zorro_unregister_driver(&a2065_driver
);
797 module_init(a2065_init_module
);
798 module_exit(a2065_cleanup_module
);
800 MODULE_LICENSE("GPL");