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)
10 * ----------------------------------------------------------------------------
12 * This program is based on
14 * ariadne.?: Amiga Linux/68k Ariadne Ethernet Driver
15 * (C) Copyright 1995 by Geert Uytterhoeven,
18 * lance.c: An AMD LANCE ethernet driver for linux.
19 * Written 1993-94 by Donald Becker.
21 * Am79C960: PCnet(tm)-ISA Single-Chip Ethernet Controller
22 * Advanced Micro Devices
23 * Publication #16907, Rev. B, Amendment/0, May 1994
25 * ----------------------------------------------------------------------------
27 * This file is subject to the terms and conditions of the GNU General Public
28 * License. See the file COPYING in the main directory of the Linux
29 * distribution for more details.
31 * ----------------------------------------------------------------------------
33 * The A2065 is a Zorro-II board made by Commodore/Ameristar. It contains:
35 * - an Am7990 Local Area Network Controller for Ethernet (LANCE) with
36 * both 10BASE-2 (thin coax) and AUI (DB-15) connectors
39 #include <linux/module.h>
40 #include <linux/stddef.h>
41 #include <linux/kernel.h>
42 #include <linux/sched.h>
43 #include <linux/interrupt.h>
44 #include <linux/ptrace.h>
45 #include <linux/ioport.h>
46 #include <linux/malloc.h>
47 #include <linux/string.h>
48 #include <linux/config.h>
49 #include <linux/init.h>
51 #include <asm/bitops.h>
54 #include <linux/errno.h>
56 #include <asm/amigaints.h>
57 #include <asm/amigahw.h>
58 #include <linux/zorro.h>
60 #include <linux/netdevice.h>
61 #include <linux/etherdevice.h>
62 #include <linux/skbuff.h>
67 * Transmit/Receive Ring Definitions
70 #define LANCE_LOG_TX_BUFFERS (2)
71 #define LANCE_LOG_RX_BUFFERS (4)
73 #define TX_RING_SIZE (1<<LANCE_LOG_TX_BUFFERS)
74 #define RX_RING_SIZE (1<<LANCE_LOG_RX_BUFFERS)
76 #define TX_RING_MOD_MASK (TX_RING_SIZE-1)
77 #define RX_RING_MOD_MASK (RX_RING_SIZE-1)
79 #define PKT_BUF_SIZE (1544)
80 #define RX_BUFF_SIZE PKT_BUF_SIZE
81 #define TX_BUFF_SIZE PKT_BUF_SIZE
85 * Layout of the Lance's RAM Buffer
89 struct lance_init_block
{
90 unsigned short mode
; /* Pre-set mode (reg. 15) */
91 unsigned char phys_addr
[6]; /* Physical ethernet address */
92 unsigned filter
[2]; /* Multicast filter. */
94 /* Receive and transmit ring base, along with extra bits. */
95 unsigned short rx_ptr
; /* receive descriptor addr */
96 unsigned short rx_len
; /* receive len and high addr */
97 unsigned short tx_ptr
; /* transmit descriptor addr */
98 unsigned short tx_len
; /* transmit len and high addr */
100 /* The Tx and Rx ring entries must aligned on 8-byte boundaries. */
101 struct lance_rx_desc brx_ring
[RX_RING_SIZE
];
102 struct lance_tx_desc btx_ring
[TX_RING_SIZE
];
104 char rx_buf
[RX_RING_SIZE
][RX_BUFF_SIZE
];
105 char tx_buf
[TX_RING_SIZE
][TX_BUFF_SIZE
];
110 * Private Device Data
113 struct lance_private
{
115 volatile struct lance_regs
*ll
;
116 volatile struct lance_init_block
*init_block
; /* Hosts view */
117 volatile struct lance_init_block
*lance_init_block
; /* Lance view */
122 int lance_log_rx_bufs
, lance_log_tx_bufs
;
123 int rx_ring_mod_mask
, tx_ring_mod_mask
;
125 struct net_device_stats stats
;
126 int tpe
; /* cable-selection is TPE */
127 int auto_select
; /* cable-selection by carrier */
128 unsigned short busmaster_regval
;
130 #ifdef CONFIG_SUNLANCE
131 struct Linux_SBus_DMA
*ledma
; /* if set this points to ledma and arch=4m */
132 int burst_sizes
; /* ledma SBus burst sizes */
134 struct timer_list multicast_timer
;
137 #define TX_BUFFS_AVAIL ((lp->tx_old<=lp->tx_new)?\
138 lp->tx_old+lp->tx_ring_mod_mask-lp->tx_new:\
139 lp->tx_old - lp->tx_new-1)
142 #define LANCE_ADDR(x) ((int)(x) & ~0xff000000)
144 /* Load the CSR registers */
145 static void load_csrs (struct lance_private
*lp
)
147 volatile struct lance_regs
*ll
= lp
->ll
;
148 volatile struct lance_init_block
*aib
= lp
->lance_init_block
;
151 leptr
= LANCE_ADDR (aib
);
154 ll
->rdp
= (leptr
& 0xFFFF);
156 ll
->rdp
= leptr
>> 16;
158 ll
->rdp
= lp
->busmaster_regval
;
160 /* Point back to csr0 */
166 /* Setup the Lance Rx and Tx rings */
167 static void lance_init_ring (struct net_device
*dev
)
169 struct lance_private
*lp
= (struct lance_private
*) dev
->priv
;
170 volatile struct lance_init_block
*ib
= lp
->init_block
;
171 volatile struct lance_init_block
*aib
; /* for LANCE_ADDR computations */
175 aib
= lp
->lance_init_block
;
177 /* Lock out other processes while setting up hardware */
178 netif_stop_queue(dev
);
179 lp
->rx_new
= lp
->tx_new
= 0;
180 lp
->rx_old
= lp
->tx_old
= 0;
184 /* Copy the ethernet address to the lance init block
185 * Note that on the sparc you need to swap the ethernet address.
187 ib
->phys_addr
[0] = dev
->dev_addr
[1];
188 ib
->phys_addr
[1] = dev
->dev_addr
[0];
189 ib
->phys_addr
[2] = dev
->dev_addr
[3];
190 ib
->phys_addr
[3] = dev
->dev_addr
[2];
191 ib
->phys_addr
[4] = dev
->dev_addr
[5];
192 ib
->phys_addr
[5] = dev
->dev_addr
[4];
195 printk ("TX rings:\n");
197 /* Setup the Tx ring entries */
198 for (i
= 0; i
<= (1<<lp
->lance_log_tx_bufs
); i
++) {
199 leptr
= LANCE_ADDR(&aib
->tx_buf
[i
][0]);
200 ib
->btx_ring
[i
].tmd0
= leptr
;
201 ib
->btx_ring
[i
].tmd1_hadr
= leptr
>> 16;
202 ib
->btx_ring
[i
].tmd1_bits
= 0;
203 ib
->btx_ring
[i
].length
= 0xf000; /* The ones required by tmd2 */
204 ib
->btx_ring
[i
].misc
= 0;
206 if (ZERO
) printk ("%d: 0x%8.8x\n", i
, leptr
);
209 /* Setup the Rx ring entries */
211 printk ("RX rings:\n");
212 for (i
= 0; i
< (1<<lp
->lance_log_rx_bufs
); i
++) {
213 leptr
= LANCE_ADDR(&aib
->rx_buf
[i
][0]);
215 ib
->brx_ring
[i
].rmd0
= leptr
;
216 ib
->brx_ring
[i
].rmd1_hadr
= leptr
>> 16;
217 ib
->brx_ring
[i
].rmd1_bits
= LE_R1_OWN
;
218 ib
->brx_ring
[i
].length
= -RX_BUFF_SIZE
| 0xf000;
219 ib
->brx_ring
[i
].mblength
= 0;
221 printk ("%d: 0x%8.8x\n", i
, leptr
);
224 /* Setup the initialization block */
226 /* Setup rx descriptor pointer */
227 leptr
= LANCE_ADDR(&aib
->brx_ring
);
228 ib
->rx_len
= (lp
->lance_log_rx_bufs
<< 13) | (leptr
>> 16);
231 printk ("RX ptr: %8.8x\n", leptr
);
233 /* Setup tx descriptor pointer */
234 leptr
= LANCE_ADDR(&aib
->btx_ring
);
235 ib
->tx_len
= (lp
->lance_log_tx_bufs
<< 13) | (leptr
>> 16);
238 printk ("TX ptr: %8.8x\n", leptr
);
240 /* Clear the multicast filter */
245 static int init_restart_lance (struct lance_private
*lp
)
247 volatile struct lance_regs
*ll
= lp
->ll
;
251 ll
->rdp
= LE_C0_INIT
;
253 /* Wait for the lance to complete initialization */
254 for (i
= 0; (i
< 100) && !(ll
->rdp
& (LE_C0_ERR
| LE_C0_IDON
)); i
++)
256 if ((i
== 100) || (ll
->rdp
& LE_C0_ERR
)) {
257 printk ("LANCE unopened after %d ticks, csr0=%4.4x.\n", i
, ll
->rdp
);
261 /* Clear IDON by writing a "1", enable interrupts and start lance */
262 ll
->rdp
= LE_C0_IDON
;
263 ll
->rdp
= LE_C0_INEA
| LE_C0_STRT
;
268 static int lance_rx (struct net_device
*dev
)
270 struct lance_private
*lp
= (struct lance_private
*) dev
->priv
;
271 volatile struct lance_init_block
*ib
= lp
->init_block
;
272 volatile struct lance_regs
*ll
= lp
->ll
;
273 volatile struct lance_rx_desc
*rd
;
275 int len
= 0; /* XXX shut up gcc warnings */
276 struct sk_buff
*skb
= 0; /* XXX shut up gcc warnings */
280 for (i
= 0; i
< RX_RING_SIZE
; i
++) {
283 ib
->brx_ring
[i
].rmd1_bits
& LE_R1_OWN
? "_" : "X");
286 ib
->brx_ring
[i
].rmd1_bits
& LE_R1_OWN
? "." : "1");
291 ll
->rdp
= LE_C0_RINT
|LE_C0_INEA
;
292 for (rd
= &ib
->brx_ring
[lp
->rx_new
];
293 !((bits
= rd
->rmd1_bits
) & LE_R1_OWN
);
294 rd
= &ib
->brx_ring
[lp
->rx_new
]) {
296 /* We got an incomplete frame? */
297 if ((bits
& LE_R1_POK
) != LE_R1_POK
) {
298 lp
->stats
.rx_over_errors
++;
299 lp
->stats
.rx_errors
++;
301 } else if (bits
& LE_R1_ERR
) {
302 /* Count only the end frame as a rx error,
305 if (bits
& LE_R1_BUF
) lp
->stats
.rx_fifo_errors
++;
306 if (bits
& LE_R1_CRC
) lp
->stats
.rx_crc_errors
++;
307 if (bits
& LE_R1_OFL
) lp
->stats
.rx_over_errors
++;
308 if (bits
& LE_R1_FRA
) lp
->stats
.rx_frame_errors
++;
309 if (bits
& LE_R1_EOP
) lp
->stats
.rx_errors
++;
311 len
= (rd
->mblength
& 0xfff) - 4;
312 skb
= dev_alloc_skb (len
+2);
315 printk ("%s: Memory squeeze, deferring packet.\n",
317 lp
->stats
.rx_dropped
++;
319 rd
->rmd1_bits
= LE_R1_OWN
;
320 lp
->rx_new
= (lp
->rx_new
+ 1) & lp
->rx_ring_mod_mask
;
325 skb_reserve (skb
, 2); /* 16 byte align */
326 skb_put (skb
, len
); /* make room */
327 eth_copy_and_sum(skb
,
328 (unsigned char *)&(ib
->rx_buf
[lp
->rx_new
][0]),
330 skb
->protocol
= eth_type_trans (skb
, dev
);
332 lp
->stats
.rx_packets
++;
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
= (struct lance_private
*) dev
->priv
;
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("%s: Carrier Lost, trying %s\n",
376 dev
->name
, lp
->tpe
?"TPE":"AUI");
379 ll
->rdp
= LE_C0_STOP
;
380 lance_init_ring (dev
);
382 init_restart_lance (lp
);
387 /* buffer errors and underflows turn off the transmitter */
388 /* Restart the adapter */
389 if (status
& (LE_T3_BUF
|LE_T3_UFL
)) {
390 lp
->stats
.tx_fifo_errors
++;
392 printk ("%s: Tx: ERR_BUF|ERR_UFL, restarting\n",
396 ll
->rdp
= LE_C0_STOP
;
397 lance_init_ring (dev
);
399 init_restart_lance (lp
);
402 } else if ((td
->tmd1_bits
& LE_T1_POK
) == LE_T1_POK
) {
404 * So we don't count the packet more than once.
406 td
->tmd1_bits
&= ~(LE_T1_POK
);
408 /* One collision before packet was sent. */
409 if (td
->tmd1_bits
& LE_T1_EONE
)
410 lp
->stats
.collisions
++;
412 /* More than one collision, be optimistic. */
413 if (td
->tmd1_bits
& LE_T1_EMORE
)
414 lp
->stats
.collisions
+= 2;
416 lp
->stats
.tx_packets
++;
419 j
= (j
+ 1) & lp
->tx_ring_mod_mask
;
422 ll
->rdp
= LE_C0_TINT
| LE_C0_INEA
;
426 static void lance_interrupt (int irq
, void *dev_id
, struct pt_regs
*regs
)
428 struct net_device
*dev
;
429 struct lance_private
*lp
;
430 volatile struct lance_regs
*ll
;
433 dev
= (struct net_device
*) dev_id
;
435 lp
= (struct lance_private
*) dev
->priv
;
438 ll
->rap
= LE_CSR0
; /* LANCE Controller Status */
441 if (!(csr0
& LE_C0_INTR
)) /* Check if any interrupt has */
442 return; /* been generated by the Lance. */
444 /* Acknowledge all the interrupt sources ASAP */
445 ll
->rdp
= csr0
& ~(LE_C0_INEA
|LE_C0_TDMD
|LE_C0_STOP
|LE_C0_STRT
|
448 if ((csr0
& LE_C0_ERR
)) {
449 /* Clear the error condition */
450 ll
->rdp
= LE_C0_BABL
|LE_C0_ERR
|LE_C0_MISS
|LE_C0_INEA
;
453 if (csr0
& LE_C0_RINT
)
456 if (csr0
& LE_C0_TINT
)
459 /* Log misc errors. */
460 if (csr0
& LE_C0_BABL
)
461 lp
->stats
.tx_errors
++; /* Tx babble. */
462 if (csr0
& LE_C0_MISS
)
463 lp
->stats
.rx_errors
++; /* Missed a Rx frame. */
464 if (csr0
& LE_C0_MERR
) {
465 printk("%s: Bus master arbitration failure, status %4.4x.\n", dev
->name
, csr0
);
466 /* Restart the chip. */
467 ll
->rdp
= LE_C0_STRT
;
470 if (netif_queue_stopped(dev
) && TX_BUFFS_AVAIL
> 0)
471 netif_wake_queue(dev
);
474 ll
->rdp
= LE_C0_BABL
|LE_C0_CERR
|LE_C0_MISS
|LE_C0_MERR
|
475 LE_C0_IDON
|LE_C0_INEA
;
479 struct net_device
*last_dev
= 0;
481 static int lance_open (struct net_device
*dev
)
483 struct lance_private
*lp
= (struct lance_private
*)dev
->priv
;
484 volatile struct lance_regs
*ll
= lp
->ll
;
489 /* Install the Interrupt handler */
490 if (request_irq(IRQ_AMIGA_PORTS
, lance_interrupt
, SA_SHIRQ
,
491 "a2065 Ethernet", dev
))
496 ll
->rdp
= LE_C0_STOP
;
499 lance_init_ring (dev
);
501 netif_start_queue(dev
);
503 status
= init_restart_lance (lp
);
510 static int lance_close (struct net_device
*dev
)
512 struct lance_private
*lp
= (struct lance_private
*) dev
->priv
;
513 volatile struct lance_regs
*ll
= lp
->ll
;
515 netif_stop_queue(dev
);
516 del_timer_sync(&lp
->multicast_timer
);
520 ll
->rdp
= LE_C0_STOP
;
522 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
;
578 if (!TX_BUFFS_AVAIL
){
579 restore_flags(flags
);
584 /* dump the packet */
588 for (i
= 0; i
< 64; i
++) {
591 printk ("%2.2x ", skb
->data
[i
]);
595 len
= (skblen
<= ETH_ZLEN
) ? ETH_ZLEN
: skblen
;
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 memcpy ((char *)&ib
->tx_buf
[entry
][0], skb
->data
, skblen
);
602 /* Clear the slack of the packet, do I need this? */
604 memset ((char *) &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
;
612 if (TX_BUFFS_AVAIL
<= 0)
613 netif_stop_queue(dev
);
615 /* Kick the lance: transmit now */
616 ll
->rdp
= LE_C0_INEA
| LE_C0_TDMD
;
617 dev
->trans_start
= jiffies
;
620 restore_flags(flags
);
625 static struct net_device_stats
*lance_get_stats (struct net_device
*dev
)
627 struct lance_private
*lp
= (struct lance_private
*) dev
->priv
;
632 /* taken from the depca driver */
633 static void lance_load_multicast (struct net_device
*dev
)
635 struct lance_private
*lp
= (struct lance_private
*) dev
->priv
;
636 volatile struct lance_init_block
*ib
= lp
->init_block
;
637 volatile u16
*mcast_table
= (u16
*)&ib
->filter
;
638 struct dev_mc_list
*dmi
=dev
->mc_list
;
641 u32 crc
, poly
= CRC_POLYNOMIAL_LE
;
643 /* set all multicast bits */
644 if (dev
->flags
& IFF_ALLMULTI
){
645 ib
->filter
[0] = 0xffffffff;
646 ib
->filter
[1] = 0xffffffff;
649 /* clear the multicast filter */
654 for (i
= 0; i
< dev
->mc_count
; i
++){
655 addrs
= dmi
->dmi_addr
;
658 /* multicast address? */
663 for (byte
= 0; byte
< 6; byte
++)
664 for (bit
= *addrs
++, j
= 0; j
< 8; j
++, bit
>>=1)
668 test
= ((bit
^ crc
) & 0x01);
678 mcast_table
[crc
>> 4] |= 1 << (crc
& 0xf);
683 static void lance_set_multicast (struct net_device
*dev
)
685 struct lance_private
*lp
= (struct lance_private
*) dev
->priv
;
686 volatile struct lance_init_block
*ib
= lp
->init_block
;
687 volatile struct lance_regs
*ll
= lp
->ll
;
689 if (!netif_running(dev
))
692 if (lp
->tx_old
!= lp
->tx_new
) {
693 mod_timer(&lp
->multicast_timer
, jiffies
+ 4);
694 netif_wake_queue(dev
);
698 netif_stop_queue(dev
);
701 ll
->rdp
= LE_C0_STOP
;
702 lance_init_ring (dev
);
704 if (dev
->flags
& IFF_PROMISC
) {
705 ib
->mode
|= LE_MO_PROM
;
707 ib
->mode
&= ~LE_MO_PROM
;
708 lance_load_multicast (dev
);
711 init_restart_lance (lp
);
712 netif_wake_queue(dev
);
715 static int __init
a2065_probe(void)
717 struct net_device
*dev
= NULL
;
718 static int called
= 0;
719 struct zorro_dev
*z
= NULL
;
725 while ((z
= zorro_find_device(ZORRO_WILDCARD
, z
))) {
726 unsigned long board
, base_addr
, ram_start
;
728 struct lance_private
*priv
;
730 if (z
->id
== ZORRO_PROD_CBM_A2065_1
||
731 z
->id
== ZORRO_PROD_CBM_A2065_2
)
733 else if (z
->id
== ZORRO_PROD_AMERISTAR_A2065
)
738 board
= z
->resource
.start
;
739 base_addr
= board
+A2065_LANCE
;
740 ram_start
= board
+A2065_RAM
;
742 if (!request_mem_region(base_addr
, sizeof(struct lance_regs
),
745 if (!request_mem_region(ram_start
, A2065_RAM_SIZE
, "RAM")) {
746 release_mem_region(base_addr
,
747 sizeof(struct lance_regs
));
750 strcpy(z
->name
, "A2065 Ethernet Card");
752 dev
= init_etherdev(NULL
, sizeof(struct lance_private
));
755 release_mem_region(base_addr
,
756 sizeof(struct lance_regs
));
757 release_mem_region(ram_start
, A2065_RAM_SIZE
);
760 priv
= (struct lance_private
*)dev
->priv
;
761 memset(priv
, 0, sizeof(struct lance_private
));
763 if (is_cbm
) { /* Commodore */
764 dev
->dev_addr
[0] = 0x00;
765 dev
->dev_addr
[1] = 0x80;
766 dev
->dev_addr
[2] = 0x10;
767 } else { /* Ameristar */
768 dev
->dev_addr
[0] = 0x00;
769 dev
->dev_addr
[1] = 0x00;
770 dev
->dev_addr
[2] = 0x9f;
772 dev
->dev_addr
[3] = (z
->rom
.er_SerialNumber
>>16) & 0xff;
773 dev
->dev_addr
[4] = (z
->rom
.er_SerialNumber
>>8) & 0xff;
774 dev
->dev_addr
[5] = z
->rom
.er_SerialNumber
& 0xff;
775 printk("%s: A2065 at 0x%08lx, Ethernet Address "
776 "%02x:%02x:%02x:%02x:%02x:%02x\n", dev
->name
, board
,
777 dev
->dev_addr
[0], dev
->dev_addr
[1], dev
->dev_addr
[2],
778 dev
->dev_addr
[3], dev
->dev_addr
[4], dev
->dev_addr
[5]);
780 dev
->base_addr
= ZTWO_VADDR(base_addr
);
781 dev
->mem_start
= ZTWO_VADDR(ram_start
);
782 dev
->mem_end
= dev
->mem_start
+A2065_RAM_SIZE
;
784 priv
->ll
= (volatile struct lance_regs
*)dev
->base_addr
;
785 priv
->init_block
= (struct lance_init_block
*)dev
->mem_start
;
786 priv
->lance_init_block
= (struct lance_init_block
*)A2065_RAM
;
787 priv
->auto_select
= 0;
788 priv
->busmaster_regval
= LE_C3_BSWP
;
790 priv
->lance_log_rx_bufs
= LANCE_LOG_RX_BUFFERS
;
791 priv
->lance_log_tx_bufs
= LANCE_LOG_TX_BUFFERS
;
792 priv
->rx_ring_mod_mask
= RX_RING_MOD_MASK
;
793 priv
->tx_ring_mod_mask
= TX_RING_MOD_MASK
;
795 dev
->open
= &lance_open
;
796 dev
->stop
= &lance_close
;
797 dev
->hard_start_xmit
= &lance_start_xmit
;
798 dev
->tx_timeout
= &lance_tx_timeout
;
799 dev
->watchdog_timeo
= 5*HZ
;
800 dev
->get_stats
= &lance_get_stats
;
801 dev
->set_multicast_list
= &lance_set_multicast
;
805 init_timer(&priv
->multicast_timer
);
806 priv
->multicast_timer
.data
= (unsigned long) dev
;
807 priv
->multicast_timer
.function
=
808 (void (*)(unsigned long)) &lance_set_multicast
;
816 static void __exit
a2065_cleanup(void)
819 struct lance_private
*priv
= (struct lance_private
*)a2065_dev
.priv
;
821 unregister_netdev(&a2065_dev
);
822 release_mem_region(ZTWO_PADDR(a2065_dev
.base_addr
),
823 sizeof(struct lance_regs
));
824 release_mem_region(ZTWO_PADDR(a2065_dev
.mem_start
), A2065_RAM_SIZE
);
829 module_init(a2065_probe
);
830 module_exit(a2065_cleanup
);