2 * Amiga Linux/68k A2065 Ethernet Driver
4 * (C) Copyright 1995 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/config.h>
52 #include <linux/init.h>
53 #include <linux/crc32.h>
54 #include <linux/zorro.h>
56 #include <asm/bitops.h>
58 #include <asm/amigaints.h>
59 #include <asm/amigahw.h>
65 * Transmit/Receive Ring Definitions
68 #define LANCE_LOG_TX_BUFFERS (2)
69 #define LANCE_LOG_RX_BUFFERS (4)
71 #define TX_RING_SIZE (1<<LANCE_LOG_TX_BUFFERS)
72 #define RX_RING_SIZE (1<<LANCE_LOG_RX_BUFFERS)
74 #define TX_RING_MOD_MASK (TX_RING_SIZE-1)
75 #define RX_RING_MOD_MASK (RX_RING_SIZE-1)
77 #define PKT_BUF_SIZE (1544)
78 #define RX_BUFF_SIZE PKT_BUF_SIZE
79 #define TX_BUFF_SIZE PKT_BUF_SIZE
83 * Layout of the Lance's RAM Buffer
87 struct lance_init_block
{
88 unsigned short mode
; /* Pre-set mode (reg. 15) */
89 unsigned char phys_addr
[6]; /* Physical ethernet address */
90 unsigned filter
[2]; /* Multicast filter. */
92 /* Receive and transmit ring base, along with extra bits. */
93 unsigned short rx_ptr
; /* receive descriptor addr */
94 unsigned short rx_len
; /* receive len and high addr */
95 unsigned short tx_ptr
; /* transmit descriptor addr */
96 unsigned short tx_len
; /* transmit len and high addr */
98 /* The Tx and Rx ring entries must aligned on 8-byte boundaries. */
99 struct lance_rx_desc brx_ring
[RX_RING_SIZE
];
100 struct lance_tx_desc btx_ring
[TX_RING_SIZE
];
102 char rx_buf
[RX_RING_SIZE
][RX_BUFF_SIZE
];
103 char tx_buf
[TX_RING_SIZE
][TX_BUFF_SIZE
];
108 * Private Device Data
111 struct lance_private
{
113 volatile struct lance_regs
*ll
;
114 volatile struct lance_init_block
*init_block
; /* Hosts view */
115 volatile struct lance_init_block
*lance_init_block
; /* Lance view */
120 int lance_log_rx_bufs
, lance_log_tx_bufs
;
121 int rx_ring_mod_mask
, tx_ring_mod_mask
;
123 struct net_device_stats stats
;
124 int tpe
; /* cable-selection is TPE */
125 int auto_select
; /* cable-selection by carrier */
126 unsigned short busmaster_regval
;
128 #ifdef CONFIG_SUNLANCE
129 struct Linux_SBus_DMA
*ledma
; /* if set this points to ledma and arch=4m */
130 int burst_sizes
; /* ledma SBus burst sizes */
132 struct timer_list multicast_timer
;
133 struct net_device
*dev
; /* Backpointer */
134 struct lance_private
*next_module
;
138 static struct lance_private
*root_a2065_dev
;
141 #define TX_BUFFS_AVAIL ((lp->tx_old<=lp->tx_new)?\
142 lp->tx_old+lp->tx_ring_mod_mask-lp->tx_new:\
143 lp->tx_old - lp->tx_new-1)
146 #define LANCE_ADDR(x) ((int)(x) & ~0xff000000)
148 /* Load the CSR registers */
149 static void load_csrs (struct lance_private
*lp
)
151 volatile struct lance_regs
*ll
= lp
->ll
;
152 volatile struct lance_init_block
*aib
= lp
->lance_init_block
;
155 leptr
= LANCE_ADDR (aib
);
158 ll
->rdp
= (leptr
& 0xFFFF);
160 ll
->rdp
= leptr
>> 16;
162 ll
->rdp
= lp
->busmaster_regval
;
164 /* Point back to csr0 */
170 /* Setup the Lance Rx and Tx rings */
171 static void lance_init_ring (struct net_device
*dev
)
173 struct lance_private
*lp
= (struct lance_private
*) dev
->priv
;
174 volatile struct lance_init_block
*ib
= lp
->init_block
;
175 volatile struct lance_init_block
*aib
; /* for LANCE_ADDR computations */
179 aib
= lp
->lance_init_block
;
181 /* Lock out other processes while setting up hardware */
182 netif_stop_queue(dev
);
183 lp
->rx_new
= lp
->tx_new
= 0;
184 lp
->rx_old
= lp
->tx_old
= 0;
188 /* Copy the ethernet address to the lance init block
189 * Note that on the sparc you need to swap the ethernet address.
191 ib
->phys_addr
[0] = dev
->dev_addr
[1];
192 ib
->phys_addr
[1] = dev
->dev_addr
[0];
193 ib
->phys_addr
[2] = dev
->dev_addr
[3];
194 ib
->phys_addr
[3] = dev
->dev_addr
[2];
195 ib
->phys_addr
[4] = dev
->dev_addr
[5];
196 ib
->phys_addr
[5] = dev
->dev_addr
[4];
199 printk ("TX rings:\n");
201 /* Setup the Tx ring entries */
202 for (i
= 0; i
<= (1<<lp
->lance_log_tx_bufs
); i
++) {
203 leptr
= LANCE_ADDR(&aib
->tx_buf
[i
][0]);
204 ib
->btx_ring
[i
].tmd0
= leptr
;
205 ib
->btx_ring
[i
].tmd1_hadr
= leptr
>> 16;
206 ib
->btx_ring
[i
].tmd1_bits
= 0;
207 ib
->btx_ring
[i
].length
= 0xf000; /* The ones required by tmd2 */
208 ib
->btx_ring
[i
].misc
= 0;
210 if (ZERO
) printk ("%d: 0x%8.8x\n", i
, leptr
);
213 /* Setup the Rx ring entries */
215 printk ("RX rings:\n");
216 for (i
= 0; i
< (1<<lp
->lance_log_rx_bufs
); i
++) {
217 leptr
= LANCE_ADDR(&aib
->rx_buf
[i
][0]);
219 ib
->brx_ring
[i
].rmd0
= leptr
;
220 ib
->brx_ring
[i
].rmd1_hadr
= leptr
>> 16;
221 ib
->brx_ring
[i
].rmd1_bits
= LE_R1_OWN
;
222 ib
->brx_ring
[i
].length
= -RX_BUFF_SIZE
| 0xf000;
223 ib
->brx_ring
[i
].mblength
= 0;
225 printk ("%d: 0x%8.8x\n", i
, leptr
);
228 /* Setup the initialization block */
230 /* Setup rx descriptor pointer */
231 leptr
= LANCE_ADDR(&aib
->brx_ring
);
232 ib
->rx_len
= (lp
->lance_log_rx_bufs
<< 13) | (leptr
>> 16);
235 printk ("RX ptr: %8.8x\n", leptr
);
237 /* Setup tx descriptor pointer */
238 leptr
= LANCE_ADDR(&aib
->btx_ring
);
239 ib
->tx_len
= (lp
->lance_log_tx_bufs
<< 13) | (leptr
>> 16);
242 printk ("TX ptr: %8.8x\n", leptr
);
244 /* Clear the multicast filter */
249 static int init_restart_lance (struct lance_private
*lp
)
251 volatile struct lance_regs
*ll
= lp
->ll
;
255 ll
->rdp
= LE_C0_INIT
;
257 /* Wait for the lance to complete initialization */
258 for (i
= 0; (i
< 100) && !(ll
->rdp
& (LE_C0_ERR
| LE_C0_IDON
)); i
++)
260 if ((i
== 100) || (ll
->rdp
& LE_C0_ERR
)) {
261 printk ("LANCE unopened after %d ticks, csr0=%4.4x.\n", i
, ll
->rdp
);
265 /* Clear IDON by writing a "1", enable interrupts and start lance */
266 ll
->rdp
= LE_C0_IDON
;
267 ll
->rdp
= LE_C0_INEA
| LE_C0_STRT
;
272 static int lance_rx (struct net_device
*dev
)
274 struct lance_private
*lp
= (struct lance_private
*) dev
->priv
;
275 volatile struct lance_init_block
*ib
= lp
->init_block
;
276 volatile struct lance_regs
*ll
= lp
->ll
;
277 volatile struct lance_rx_desc
*rd
;
279 int len
= 0; /* XXX shut up gcc warnings */
280 struct sk_buff
*skb
= 0; /* XXX shut up gcc warnings */
284 for (i
= 0; i
< RX_RING_SIZE
; i
++) {
287 ib
->brx_ring
[i
].rmd1_bits
& LE_R1_OWN
? "_" : "X");
290 ib
->brx_ring
[i
].rmd1_bits
& LE_R1_OWN
? "." : "1");
295 ll
->rdp
= LE_C0_RINT
|LE_C0_INEA
;
296 for (rd
= &ib
->brx_ring
[lp
->rx_new
];
297 !((bits
= rd
->rmd1_bits
) & LE_R1_OWN
);
298 rd
= &ib
->brx_ring
[lp
->rx_new
]) {
300 /* We got an incomplete frame? */
301 if ((bits
& LE_R1_POK
) != LE_R1_POK
) {
302 lp
->stats
.rx_over_errors
++;
303 lp
->stats
.rx_errors
++;
305 } else if (bits
& LE_R1_ERR
) {
306 /* Count only the end frame as a rx error,
309 if (bits
& LE_R1_BUF
) lp
->stats
.rx_fifo_errors
++;
310 if (bits
& LE_R1_CRC
) lp
->stats
.rx_crc_errors
++;
311 if (bits
& LE_R1_OFL
) lp
->stats
.rx_over_errors
++;
312 if (bits
& LE_R1_FRA
) lp
->stats
.rx_frame_errors
++;
313 if (bits
& LE_R1_EOP
) lp
->stats
.rx_errors
++;
315 len
= (rd
->mblength
& 0xfff) - 4;
316 skb
= dev_alloc_skb (len
+2);
319 printk ("%s: Memory squeeze, deferring packet.\n",
321 lp
->stats
.rx_dropped
++;
323 rd
->rmd1_bits
= LE_R1_OWN
;
324 lp
->rx_new
= (lp
->rx_new
+ 1) & lp
->rx_ring_mod_mask
;
329 skb_reserve (skb
, 2); /* 16 byte align */
330 skb_put (skb
, len
); /* make room */
331 eth_copy_and_sum(skb
,
332 (unsigned char *)&(ib
->rx_buf
[lp
->rx_new
][0]),
334 skb
->protocol
= eth_type_trans (skb
, dev
);
336 dev
->last_rx
= jiffies
;
337 lp
->stats
.rx_packets
++;
338 lp
->stats
.rx_bytes
+= len
;
341 /* Return the packet to the pool */
343 rd
->rmd1_bits
= LE_R1_OWN
;
344 lp
->rx_new
= (lp
->rx_new
+ 1) & lp
->rx_ring_mod_mask
;
349 static int lance_tx (struct net_device
*dev
)
351 struct lance_private
*lp
= (struct lance_private
*) dev
->priv
;
352 volatile struct lance_init_block
*ib
= lp
->init_block
;
353 volatile struct lance_regs
*ll
= lp
->ll
;
354 volatile struct lance_tx_desc
*td
;
359 ll
->rdp
= LE_C0_TINT
| LE_C0_INEA
;
363 for (i
= j
; i
!= lp
->tx_new
; i
= j
) {
364 td
= &ib
->btx_ring
[i
];
366 /* If we hit a packet not owned by us, stop */
367 if (td
->tmd1_bits
& LE_T1_OWN
)
370 if (td
->tmd1_bits
& LE_T1_ERR
) {
373 lp
->stats
.tx_errors
++;
374 if (status
& LE_T3_RTY
) lp
->stats
.tx_aborted_errors
++;
375 if (status
& LE_T3_LCOL
) lp
->stats
.tx_window_errors
++;
377 if (status
& LE_T3_CLOS
) {
378 lp
->stats
.tx_carrier_errors
++;
379 if (lp
->auto_select
) {
380 lp
->tpe
= 1 - lp
->tpe
;
381 printk("%s: Carrier Lost, trying %s\n",
382 dev
->name
, lp
->tpe
?"TPE":"AUI");
385 ll
->rdp
= LE_C0_STOP
;
386 lance_init_ring (dev
);
388 init_restart_lance (lp
);
393 /* buffer errors and underflows turn off the transmitter */
394 /* Restart the adapter */
395 if (status
& (LE_T3_BUF
|LE_T3_UFL
)) {
396 lp
->stats
.tx_fifo_errors
++;
398 printk ("%s: Tx: ERR_BUF|ERR_UFL, restarting\n",
402 ll
->rdp
= LE_C0_STOP
;
403 lance_init_ring (dev
);
405 init_restart_lance (lp
);
408 } else if ((td
->tmd1_bits
& LE_T1_POK
) == LE_T1_POK
) {
410 * So we don't count the packet more than once.
412 td
->tmd1_bits
&= ~(LE_T1_POK
);
414 /* One collision before packet was sent. */
415 if (td
->tmd1_bits
& LE_T1_EONE
)
416 lp
->stats
.collisions
++;
418 /* More than one collision, be optimistic. */
419 if (td
->tmd1_bits
& LE_T1_EMORE
)
420 lp
->stats
.collisions
+= 2;
422 lp
->stats
.tx_packets
++;
425 j
= (j
+ 1) & lp
->tx_ring_mod_mask
;
428 ll
->rdp
= LE_C0_TINT
| LE_C0_INEA
;
433 lance_interrupt (int irq
, void *dev_id
, struct pt_regs
*regs
)
435 struct net_device
*dev
;
436 struct lance_private
*lp
;
437 volatile struct lance_regs
*ll
;
440 dev
= (struct net_device
*) dev_id
;
442 lp
= (struct lance_private
*) dev
->priv
;
445 ll
->rap
= LE_CSR0
; /* LANCE Controller Status */
448 if (!(csr0
& LE_C0_INTR
)) /* Check if any interrupt has */
449 return IRQ_NONE
; /* been generated by the Lance. */
451 /* Acknowledge all the interrupt sources ASAP */
452 ll
->rdp
= csr0
& ~(LE_C0_INEA
|LE_C0_TDMD
|LE_C0_STOP
|LE_C0_STRT
|
455 if ((csr0
& LE_C0_ERR
)) {
456 /* Clear the error condition */
457 ll
->rdp
= LE_C0_BABL
|LE_C0_ERR
|LE_C0_MISS
|LE_C0_INEA
;
460 if (csr0
& LE_C0_RINT
)
463 if (csr0
& LE_C0_TINT
)
466 /* Log misc errors. */
467 if (csr0
& LE_C0_BABL
)
468 lp
->stats
.tx_errors
++; /* Tx babble. */
469 if (csr0
& LE_C0_MISS
)
470 lp
->stats
.rx_errors
++; /* Missed a Rx frame. */
471 if (csr0
& LE_C0_MERR
) {
472 printk("%s: Bus master arbitration failure, status %4.4x.\n", dev
->name
, csr0
);
473 /* Restart the chip. */
474 ll
->rdp
= LE_C0_STRT
;
477 if (netif_queue_stopped(dev
) && TX_BUFFS_AVAIL
> 0)
478 netif_wake_queue(dev
);
481 ll
->rdp
= LE_C0_BABL
|LE_C0_CERR
|LE_C0_MISS
|LE_C0_MERR
|
482 LE_C0_IDON
|LE_C0_INEA
;
486 struct net_device
*last_dev
= 0;
488 static int lance_open (struct net_device
*dev
)
490 struct lance_private
*lp
= (struct lance_private
*)dev
->priv
;
491 volatile struct lance_regs
*ll
= lp
->ll
;
498 ll
->rdp
= LE_C0_STOP
;
500 /* Install the Interrupt handler */
501 ret
= request_irq(IRQ_AMIGA_PORTS
, lance_interrupt
, SA_SHIRQ
,
506 lance_init_ring (dev
);
508 netif_start_queue(dev
);
510 return init_restart_lance (lp
);
513 static int lance_close (struct net_device
*dev
)
515 struct lance_private
*lp
= (struct lance_private
*) dev
->priv
;
516 volatile struct lance_regs
*ll
= lp
->ll
;
518 netif_stop_queue(dev
);
519 del_timer_sync(&lp
->multicast_timer
);
523 ll
->rdp
= LE_C0_STOP
;
525 free_irq(IRQ_AMIGA_PORTS
, dev
);
529 static inline int lance_reset (struct net_device
*dev
)
531 struct lance_private
*lp
= (struct lance_private
*)dev
->priv
;
532 volatile struct lance_regs
*ll
= lp
->ll
;
537 ll
->rdp
= LE_C0_STOP
;
541 lance_init_ring (dev
);
542 dev
->trans_start
= jiffies
;
543 netif_start_queue(dev
);
545 status
= init_restart_lance (lp
);
547 printk ("Lance restart=%d\n", status
);
552 static void lance_tx_timeout(struct net_device
*dev
)
554 struct lance_private
*lp
= (struct lance_private
*) dev
->priv
;
555 volatile struct lance_regs
*ll
= lp
->ll
;
557 printk(KERN_ERR
"%s: transmit timed out, status %04x, reset\n",
560 netif_wake_queue(dev
);
563 static int lance_start_xmit (struct sk_buff
*skb
, struct net_device
*dev
)
565 struct lance_private
*lp
= (struct lance_private
*)dev
->priv
;
566 volatile struct lance_regs
*ll
= lp
->ll
;
567 volatile struct lance_init_block
*ib
= lp
->init_block
;
568 int entry
, skblen
, len
;
576 if (len
< ETH_ZLEN
) {
578 skb
= skb_padto(skb
, ETH_ZLEN
);
583 local_irq_save(flags
);
585 if (!TX_BUFFS_AVAIL
){
586 local_irq_restore(flags
);
591 /* dump the packet */
595 for (i
= 0; i
< 64; i
++) {
598 printk ("%2.2x ", skb
->data
[i
]);
602 entry
= lp
->tx_new
& lp
->tx_ring_mod_mask
;
603 ib
->btx_ring
[entry
].length
= (-len
) | 0xf000;
604 ib
->btx_ring
[entry
].misc
= 0;
606 memcpy ((char *)&ib
->tx_buf
[entry
][0], skb
->data
, skblen
);
608 /* Clear the slack of the packet, do I need this? */
610 memset ((char *) &ib
->tx_buf
[entry
][skblen
], 0, len
- skblen
);
612 /* Now, give the packet to the lance */
613 ib
->btx_ring
[entry
].tmd1_bits
= (LE_T1_POK
|LE_T1_OWN
);
614 lp
->tx_new
= (lp
->tx_new
+1) & lp
->tx_ring_mod_mask
;
618 if (TX_BUFFS_AVAIL
<= 0)
619 netif_stop_queue(dev
);
621 /* Kick the lance: transmit now */
622 ll
->rdp
= LE_C0_INEA
| LE_C0_TDMD
;
623 dev
->trans_start
= jiffies
;
626 local_irq_restore(flags
);
631 static struct net_device_stats
*lance_get_stats (struct net_device
*dev
)
633 struct lance_private
*lp
= (struct lance_private
*) dev
->priv
;
638 /* taken from the depca driver */
639 static void lance_load_multicast (struct net_device
*dev
)
641 struct lance_private
*lp
= (struct lance_private
*) dev
->priv
;
642 volatile struct lance_init_block
*ib
= lp
->init_block
;
643 volatile u16
*mcast_table
= (u16
*)&ib
->filter
;
644 struct dev_mc_list
*dmi
=dev
->mc_list
;
649 /* set all multicast bits */
650 if (dev
->flags
& IFF_ALLMULTI
){
651 ib
->filter
[0] = 0xffffffff;
652 ib
->filter
[1] = 0xffffffff;
655 /* clear the multicast filter */
660 for (i
= 0; i
< dev
->mc_count
; i
++){
661 addrs
= dmi
->dmi_addr
;
664 /* multicast address? */
668 crc
= ether_crc_le(6, addrs
);
670 mcast_table
[crc
>> 4] |= 1 << (crc
& 0xf);
675 static void lance_set_multicast (struct net_device
*dev
)
677 struct lance_private
*lp
= (struct lance_private
*) dev
->priv
;
678 volatile struct lance_init_block
*ib
= lp
->init_block
;
679 volatile struct lance_regs
*ll
= lp
->ll
;
681 if (!netif_running(dev
))
684 if (lp
->tx_old
!= lp
->tx_new
) {
685 mod_timer(&lp
->multicast_timer
, jiffies
+ 4);
686 netif_wake_queue(dev
);
690 netif_stop_queue(dev
);
693 ll
->rdp
= LE_C0_STOP
;
694 lance_init_ring (dev
);
696 if (dev
->flags
& IFF_PROMISC
) {
697 ib
->mode
|= LE_MO_PROM
;
699 ib
->mode
&= ~LE_MO_PROM
;
700 lance_load_multicast (dev
);
703 init_restart_lance (lp
);
704 netif_wake_queue(dev
);
707 static int __init
a2065_probe(void)
709 struct zorro_dev
*z
= NULL
;
710 struct net_device
*dev
;
711 struct lance_private
*priv
;
714 while ((z
= zorro_find_device(ZORRO_WILDCARD
, z
))) {
715 unsigned long board
, base_addr
, mem_start
;
716 struct resource
*r1
, *r2
;
719 if (z
->id
== ZORRO_PROD_CBM_A2065_1
||
720 z
->id
== ZORRO_PROD_CBM_A2065_2
)
722 else if (z
->id
== ZORRO_PROD_AMERISTAR_A2065
)
727 board
= z
->resource
.start
;
728 base_addr
= board
+A2065_LANCE
;
729 mem_start
= board
+A2065_RAM
;
731 r1
= request_mem_region(base_addr
, sizeof(struct lance_regs
),
734 r2
= request_mem_region(mem_start
, A2065_RAM_SIZE
, "RAM");
736 release_resource(r1
);
740 dev
= init_etherdev(NULL
, sizeof(struct lance_private
));
743 release_resource(r1
);
744 release_resource(r2
);
747 SET_MODULE_OWNER(dev
);
750 r1
->name
= dev
->name
;
751 r2
->name
= dev
->name
;
754 dev
->dev_addr
[0] = 0x00;
755 if (is_cbm
) { /* Commodore */
756 dev
->dev_addr
[1] = 0x80;
757 dev
->dev_addr
[2] = 0x10;
758 } else { /* Ameristar */
759 dev
->dev_addr
[1] = 0x00;
760 dev
->dev_addr
[2] = 0x9f;
762 dev
->dev_addr
[3] = (z
->rom
.er_SerialNumber
>>16) & 0xff;
763 dev
->dev_addr
[4] = (z
->rom
.er_SerialNumber
>>8) & 0xff;
764 dev
->dev_addr
[5] = z
->rom
.er_SerialNumber
& 0xff;
765 printk("%s: A2065 at 0x%08lx, Ethernet Address "
766 "%02x:%02x:%02x:%02x:%02x:%02x\n", dev
->name
, board
,
767 dev
->dev_addr
[0], dev
->dev_addr
[1], dev
->dev_addr
[2],
768 dev
->dev_addr
[3], dev
->dev_addr
[4], dev
->dev_addr
[5]);
770 dev
->base_addr
= ZTWO_VADDR(base_addr
);
771 dev
->mem_start
= ZTWO_VADDR(mem_start
);
772 dev
->mem_end
= dev
->mem_start
+A2065_RAM_SIZE
;
774 priv
->ll
= (volatile struct lance_regs
*)dev
->base_addr
;
775 priv
->init_block
= (struct lance_init_block
*)dev
->mem_start
;
776 priv
->lance_init_block
= (struct lance_init_block
*)A2065_RAM
;
777 priv
->auto_select
= 0;
778 priv
->busmaster_regval
= LE_C3_BSWP
;
780 priv
->lance_log_rx_bufs
= LANCE_LOG_RX_BUFFERS
;
781 priv
->lance_log_tx_bufs
= LANCE_LOG_TX_BUFFERS
;
782 priv
->rx_ring_mod_mask
= RX_RING_MOD_MASK
;
783 priv
->tx_ring_mod_mask
= TX_RING_MOD_MASK
;
785 dev
->open
= &lance_open
;
786 dev
->stop
= &lance_close
;
787 dev
->hard_start_xmit
= &lance_start_xmit
;
788 dev
->tx_timeout
= &lance_tx_timeout
;
789 dev
->watchdog_timeo
= 5*HZ
;
790 dev
->get_stats
= &lance_get_stats
;
791 dev
->set_multicast_list
= &lance_set_multicast
;
795 priv
->next_module
= root_a2065_dev
;
796 root_a2065_dev
= priv
;
799 init_timer(&priv
->multicast_timer
);
800 priv
->multicast_timer
.data
= (unsigned long) dev
;
801 priv
->multicast_timer
.function
=
802 (void (*)(unsigned long)) &lance_set_multicast
;
810 static void __exit
a2065_cleanup(void)
813 struct lance_private
*next
;
814 struct net_device
*dev
;
816 while (root_a2065_dev
) {
817 next
= root_a2065_dev
->next_module
;
818 dev
= root_a2065_dev
->dev
;
819 unregister_netdev(dev
);
820 release_mem_region(ZTWO_PADDR(dev
->base_addr
),
821 sizeof(struct lance_regs
));
822 release_mem_region(ZTWO_PADDR(dev
->mem_start
), A2065_RAM_SIZE
);
824 root_a2065_dev
= next
;
829 module_init(a2065_probe
);
830 module_exit(a2065_cleanup
);
831 MODULE_LICENSE("GPL");