1 /*********************************************************************
3 * Filename: netwave_cs.c
5 * Description: Netwave AirSurfer Wireless LAN PC Card driver
6 * Status: Experimental.
7 * Authors: John Markus Bjørndalen <johnm@cs.uit.no>
8 * Dag Brattli <dagb@cs.uit.no>
9 * David Hinds <dahinds@users.sourceforge.net>
10 * Created at: A long time ago!
11 * Modified at: Mon Nov 10 11:54:37 1997
12 * Modified by: Dag Brattli <dagb@cs.uit.no>
14 * Copyright (c) 1997 University of Tromsø, Norway
18 * 08-Nov-97 15:14:47 John Markus Bjørndalen <johnm@cs.uit.no>
19 * - Fixed some bugs in netwave_rx and cleaned it up a bit.
20 * (One of the bugs would have destroyed packets when receiving
21 * multiple packets per interrupt).
22 * - Cleaned up parts of newave_hw_xmit.
23 * - A few general cleanups.
24 * 24-Oct-97 13:17:36 Dag Brattli <dagb@cs.uit.no>
25 * - Fixed netwave_rx receive function (got updated docs)
27 * - Changed name from xircnw to netwave, take a look at
28 * http://www.netwave-wireless.com
29 * - Some reorganizing of the code
30 * - Removed possible race condition between interrupt handler and transmit
32 * - Started to add wireless extensions, but still needs some coding
33 * - Added watchdog for better handling of transmission timeouts
34 * (hopefully this works better)
35 ********************************************************************/
37 /* To have statistics (just packets sent) define this */
40 #include <linux/module.h>
41 #include <linux/kernel.h>
42 #include <linux/init.h>
43 #include <linux/types.h>
44 #include <linux/fcntl.h>
45 #include <linux/interrupt.h>
46 #include <linux/ptrace.h>
47 #include <linux/ioport.h>
49 #include <linux/slab.h>
50 #include <linux/string.h>
51 #include <linux/timer.h>
52 #include <linux/errno.h>
53 #include <linux/netdevice.h>
54 #include <linux/etherdevice.h>
55 #include <linux/skbuff.h>
56 #include <linux/bitops.h>
57 #include <linux/wireless.h>
58 #include <net/iw_handler.h>
60 #include <pcmcia/cs_types.h>
61 #include <pcmcia/cs.h>
62 #include <pcmcia/cistpl.h>
63 #include <pcmcia/cisreg.h>
64 #include <pcmcia/ds.h>
65 #include <pcmcia/mem_op.h>
67 #include <asm/system.h>
71 #define NETWAVE_REGOFF 0x8000
72 /* The Netwave IO registers, offsets to iobase */
73 #define NETWAVE_REG_COR 0x0
74 #define NETWAVE_REG_CCSR 0x2
75 #define NETWAVE_REG_ASR 0x4
76 #define NETWAVE_REG_IMR 0xa
77 #define NETWAVE_REG_PMR 0xc
78 #define NETWAVE_REG_IOLOW 0x6
79 #define NETWAVE_REG_IOHI 0x7
80 #define NETWAVE_REG_IOCONTROL 0x8
81 #define NETWAVE_REG_DATA 0xf
82 /* The Netwave Extended IO registers, offsets to RamBase */
83 #define NETWAVE_EREG_ASCC 0x114
84 #define NETWAVE_EREG_RSER 0x120
85 #define NETWAVE_EREG_RSERW 0x124
86 #define NETWAVE_EREG_TSER 0x130
87 #define NETWAVE_EREG_TSERW 0x134
88 #define NETWAVE_EREG_CB 0x100
89 #define NETWAVE_EREG_SPCQ 0x154
90 #define NETWAVE_EREG_SPU 0x155
91 #define NETWAVE_EREG_LIF 0x14e
92 #define NETWAVE_EREG_ISPLQ 0x156
93 #define NETWAVE_EREG_HHC 0x158
94 #define NETWAVE_EREG_NI 0x16e
95 #define NETWAVE_EREG_MHS 0x16b
96 #define NETWAVE_EREG_TDP 0x140
97 #define NETWAVE_EREG_RDP 0x150
98 #define NETWAVE_EREG_PA 0x160
99 #define NETWAVE_EREG_EC 0x180
100 #define NETWAVE_EREG_CRBP 0x17a
101 #define NETWAVE_EREG_ARW 0x166
104 * Commands used in the extended command buffer
105 * NETWAVE_EREG_CB (0x100-0x10F)
107 #define NETWAVE_CMD_NOP 0x00
108 #define NETWAVE_CMD_SRC 0x01
109 #define NETWAVE_CMD_STC 0x02
110 #define NETWAVE_CMD_AMA 0x03
111 #define NETWAVE_CMD_DMA 0x04
112 #define NETWAVE_CMD_SAMA 0x05
113 #define NETWAVE_CMD_ER 0x06
114 #define NETWAVE_CMD_DR 0x07
115 #define NETWAVE_CMD_TL 0x08
116 #define NETWAVE_CMD_SRP 0x09
117 #define NETWAVE_CMD_SSK 0x0a
118 #define NETWAVE_CMD_SMD 0x0b
119 #define NETWAVE_CMD_SAPD 0x0c
120 #define NETWAVE_CMD_SSS 0x11
121 /* End of Command marker */
122 #define NETWAVE_CMD_EOC 0x00
124 /* ASR register bits */
125 #define NETWAVE_ASR_RXRDY 0x80
126 #define NETWAVE_ASR_TXBA 0x01
128 #define TX_TIMEOUT ((32*HZ)/100)
130 static const unsigned int imrConfRFU1
= 0x10; /* RFU interrupt mask, keep high */
131 static const unsigned int imrConfIENA
= 0x02; /* Interrupt enable */
133 static const unsigned int corConfIENA
= 0x01; /* Interrupt enable */
134 static const unsigned int corConfLVLREQ
= 0x40; /* Keep high */
136 static const unsigned int rxConfRxEna
= 0x80; /* Receive Enable */
137 static const unsigned int rxConfMAC
= 0x20; /* MAC host receive mode*/
138 static const unsigned int rxConfPro
= 0x10; /* Promiscuous */
139 static const unsigned int rxConfAMP
= 0x08; /* Accept Multicast Packets */
140 static const unsigned int rxConfBcast
= 0x04; /* Accept Broadcast Packets */
142 static const unsigned int txConfTxEna
= 0x80; /* Transmit Enable */
143 static const unsigned int txConfMAC
= 0x20; /* Host sends MAC mode */
144 static const unsigned int txConfEUD
= 0x10; /* Enable Uni-Data packets */
145 static const unsigned int txConfKey
= 0x02; /* Scramble data packets */
146 static const unsigned int txConfLoop
= 0x01; /* Loopback mode */
149 All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If
150 you do not define PCMCIA_DEBUG at all, all the debug code will be
151 left out. If you compile with PCMCIA_DEBUG=0, the debug code will
152 be present but disabled -- but it can then be enabled for specific
153 modules at load time with a 'pc_debug=#' option to insmod.
157 static int pc_debug
= PCMCIA_DEBUG
;
158 module_param(pc_debug
, int, 0);
159 #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
160 static char *version
=
161 "netwave_cs.c 0.3.0 Thu Jul 17 14:36:02 1997 (John Markus Bjørndalen)\n";
163 #define DEBUG(n, args...)
166 /*====================================================================*/
168 /* Parameters that can be set with 'insmod' */
170 /* Choose the domain, default is 0x100 */
171 static u_int domain
= 0x100;
173 /* Scramble key, range from 0x0 to 0xffff.
174 * 0x0 is no scrambling.
176 static u_int scramble_key
= 0x0;
178 /* Shared memory speed, in ns. The documentation states that
179 * the card should not be read faster than every 400ns.
180 * This timing should be provided by the HBA. If it becomes a
181 * problem, try setting mem_speed to 400.
183 static int mem_speed
;
185 module_param(domain
, int, 0);
186 module_param(scramble_key
, int, 0);
187 module_param(mem_speed
, int, 0);
189 /*====================================================================*/
191 /* PCMCIA (Card Services) related functions */
192 static void netwave_release(struct pcmcia_device
*link
); /* Card removal */
193 static int netwave_pcmcia_config(struct pcmcia_device
*arg
); /* Runs after card
195 static void netwave_detach(struct pcmcia_device
*p_dev
); /* Destroy instance */
197 /* Hardware configuration */
198 static void netwave_doreset(unsigned int iobase
, u_char __iomem
*ramBase
);
199 static void netwave_reset(struct net_device
*dev
);
201 /* Misc device stuff */
202 static int netwave_open(struct net_device
*dev
); /* Open the device */
203 static int netwave_close(struct net_device
*dev
); /* Close the device */
205 /* Packet transmission and Packet reception */
206 static netdev_tx_t
netwave_start_xmit( struct sk_buff
*skb
,
207 struct net_device
*dev
);
208 static int netwave_rx( struct net_device
*dev
);
210 /* Interrupt routines */
211 static irqreturn_t
netwave_interrupt(int irq
, void *dev_id
);
212 static void netwave_watchdog(struct net_device
*);
214 /* Wireless extensions */
215 static struct iw_statistics
* netwave_get_wireless_stats(struct net_device
*dev
);
217 static void set_multicast_list(struct net_device
*dev
);
220 A struct pcmcia_device structure has fields for most things that are needed
221 to keep track of a socket, but there will usually be some device
222 specific information that also needs to be kept track of. The
223 'priv' pointer in a struct pcmcia_device structure can be used to point to
224 a device-specific private data structure, like this.
226 A driver needs to provide a dev_node_t structure for each device
227 on a card. In some cases, there is only one device per card (for
228 example, ethernet cards, modems). In other cases, there may be
229 many actual or logical devices (SCSI adapters, memory cards with
230 multiple partitions). The dev_node_t structures need to be kept
231 in a linked list starting at the 'dev' field of a struct pcmcia_device
232 structure. We allocate them in the card's private data structure,
233 because they generally can't be allocated dynamically.
236 static const struct iw_handler_def netwave_handler_def
;
238 #define SIOCGIPSNAP SIOCIWFIRSTPRIV + 1 /* Site Survey Snapshot */
242 typedef struct net_addr
{
248 u_char struct_revision
;
249 u_char roaming_state
;
251 u_char sp_existsFlag
;
252 u_char sp_link_quality
;
253 u_char sp_max_link_quality
;
254 u_char linkQualityGoodFairBoundary
;
255 u_char linkQualityFairPoorBoundary
;
256 u_char sp_utilization
;
258 u_char sp_hotheadcount
;
259 u_char roaming_condition
;
263 net_addr nearByAccessPoints
[MAX_ESA
];
266 typedef struct netwave_private
{
267 struct pcmcia_device
*p_dev
;
268 spinlock_t spinlock
; /* Serialize access to the hardware (SMP) */
270 u_char __iomem
*ramBase
;
273 struct timer_list watchdog
; /* To avoid blocking state */
274 struct site_survey nss
;
275 struct iw_statistics iw_stats
; /* Wireless stats */
279 * The Netwave card is little-endian, so won't work for big endian
282 static inline unsigned short get_uint16(u_char __iomem
*staddr
)
284 return readw(staddr
); /* Return only 16 bits */
287 static inline short get_int16(u_char __iomem
* staddr
)
289 return readw(staddr
);
293 * Wait until the WOC (Write Operation Complete) bit in the
294 * ASR (Adapter Status Register) is asserted.
295 * This should have aborted if it takes too long time.
297 static inline void wait_WOC(unsigned int iobase
)
300 while ((inb(iobase
+ NETWAVE_REG_ASR
) & 0x8) != 0x8) ;
303 static void netwave_snapshot(netwave_private
*priv
, u_char __iomem
*ramBase
,
304 unsigned int iobase
) {
305 u_short resultBuffer
;
307 /* if time since last snapshot is > 1 sec. (100 jiffies?) then take
308 * new snapshot, else return cached data. This is the recommended rate.
310 if ( jiffies
- priv
->lastExec
> 100) {
311 /* Take site survey snapshot */
312 /*printk( KERN_DEBUG "Taking new snapshot. %ld\n", jiffies -
315 writeb(NETWAVE_CMD_SSS
, ramBase
+ NETWAVE_EREG_CB
+ 0);
316 writeb(NETWAVE_CMD_EOC
, ramBase
+ NETWAVE_EREG_CB
+ 1);
319 /* Get result and copy to cach */
320 resultBuffer
= readw(ramBase
+ NETWAVE_EREG_CRBP
);
321 copy_from_pc( &priv
->nss
, ramBase
+resultBuffer
,
322 sizeof(struct site_survey
));
327 * Function netwave_get_wireless_stats (dev)
329 * Wireless extensions statistics
332 static struct iw_statistics
*netwave_get_wireless_stats(struct net_device
*dev
)
335 unsigned int iobase
= dev
->base_addr
;
336 netwave_private
*priv
= netdev_priv(dev
);
337 u_char __iomem
*ramBase
= priv
->ramBase
;
338 struct iw_statistics
* wstats
;
340 wstats
= &priv
->iw_stats
;
342 spin_lock_irqsave(&priv
->spinlock
, flags
);
344 netwave_snapshot( priv
, ramBase
, iobase
);
346 wstats
->status
= priv
->nss
.roaming_state
;
347 wstats
->qual
.qual
= readb( ramBase
+ NETWAVE_EREG_SPCQ
);
348 wstats
->qual
.level
= readb( ramBase
+ NETWAVE_EREG_ISPLQ
);
349 wstats
->qual
.noise
= readb( ramBase
+ NETWAVE_EREG_SPU
) & 0x3f;
350 wstats
->discard
.nwid
= 0L;
351 wstats
->discard
.code
= 0L;
352 wstats
->discard
.misc
= 0L;
354 spin_unlock_irqrestore(&priv
->spinlock
, flags
);
356 return &priv
->iw_stats
;
359 static const struct net_device_ops netwave_netdev_ops
= {
360 .ndo_open
= netwave_open
,
361 .ndo_stop
= netwave_close
,
362 .ndo_start_xmit
= netwave_start_xmit
,
363 .ndo_set_multicast_list
= set_multicast_list
,
364 .ndo_tx_timeout
= netwave_watchdog
,
365 .ndo_change_mtu
= eth_change_mtu
,
366 .ndo_set_mac_address
= eth_mac_addr
,
367 .ndo_validate_addr
= eth_validate_addr
,
371 * Function netwave_attach (void)
373 * Creates an "instance" of the driver, allocating local data
374 * structures for one device. The device is registered with Card
377 * The dev_link structure is initialized, but we don't actually
378 * configure the card at this point -- we wait until we receive a
379 * card insertion event.
381 static int netwave_probe(struct pcmcia_device
*link
)
383 struct net_device
*dev
;
384 netwave_private
*priv
;
386 DEBUG(0, "netwave_attach()\n");
388 /* Initialize the struct pcmcia_device structure */
389 dev
= alloc_etherdev(sizeof(netwave_private
));
392 priv
= netdev_priv(dev
);
396 /* The io structure describes IO port mapping */
397 link
->io
.NumPorts1
= 16;
398 link
->io
.Attributes1
= IO_DATA_PATH_WIDTH_16
;
399 /* link->io.NumPorts2 = 16;
400 link->io.Attributes2 = IO_DATA_PATH_WIDTH_16; */
401 link
->io
.IOAddrLines
= 5;
403 /* Interrupt setup */
404 link
->irq
.Attributes
= IRQ_TYPE_DYNAMIC_SHARING
| IRQ_HANDLE_PRESENT
;
405 link
->irq
.IRQInfo1
= IRQ_LEVEL_ID
;
406 link
->irq
.Handler
= &netwave_interrupt
;
408 /* General socket configuration */
409 link
->conf
.Attributes
= CONF_ENABLE_IRQ
;
410 link
->conf
.IntType
= INT_MEMORY_AND_IO
;
411 link
->conf
.ConfigIndex
= 1;
413 /* Netwave private struct init. link/dev/node already taken care of,
414 * other stuff zero'd - Jean II */
415 spin_lock_init(&priv
->spinlock
);
417 /* Netwave specific entries in the device structure */
418 dev
->netdev_ops
= &netwave_netdev_ops
;
419 /* wireless extensions */
420 dev
->wireless_handlers
= &netwave_handler_def
;
422 dev
->watchdog_timeo
= TX_TIMEOUT
;
424 link
->irq
.Instance
= dev
;
426 return netwave_pcmcia_config( link
);
427 } /* netwave_attach */
430 * Function netwave_detach (link)
432 * This deletes a driver "instance". The device is de-registered
433 * with Card Services. If it has been released, all local data
434 * structures are freed. Otherwise, the structures will be freed
435 * when the device is released.
437 static void netwave_detach(struct pcmcia_device
*link
)
439 struct net_device
*dev
= link
->priv
;
441 DEBUG(0, "netwave_detach(0x%p)\n", link
);
443 netwave_release(link
);
446 unregister_netdev(dev
);
449 } /* netwave_detach */
452 * Wireless Handler : get protocol name
454 static int netwave_get_name(struct net_device
*dev
,
455 struct iw_request_info
*info
,
456 union iwreq_data
*wrqu
,
459 strcpy(wrqu
->name
, "Netwave");
464 * Wireless Handler : set Network ID
466 static int netwave_set_nwid(struct net_device
*dev
,
467 struct iw_request_info
*info
,
468 union iwreq_data
*wrqu
,
472 unsigned int iobase
= dev
->base_addr
;
473 netwave_private
*priv
= netdev_priv(dev
);
474 u_char __iomem
*ramBase
= priv
->ramBase
;
476 /* Disable interrupts & save flags */
477 spin_lock_irqsave(&priv
->spinlock
, flags
);
479 if(!wrqu
->nwid
.disabled
) {
480 domain
= wrqu
->nwid
.value
;
481 printk( KERN_DEBUG
"Setting domain to 0x%x%02x\n",
482 (domain
>> 8) & 0x01, domain
& 0xff);
484 writeb(NETWAVE_CMD_SMD
, ramBase
+ NETWAVE_EREG_CB
+ 0);
485 writeb( domain
& 0xff, ramBase
+ NETWAVE_EREG_CB
+ 1);
486 writeb((domain
>>8 ) & 0x01,ramBase
+ NETWAVE_EREG_CB
+2);
487 writeb(NETWAVE_CMD_EOC
, ramBase
+ NETWAVE_EREG_CB
+ 3);
490 /* ReEnable interrupts & restore flags */
491 spin_unlock_irqrestore(&priv
->spinlock
, flags
);
497 * Wireless Handler : get Network ID
499 static int netwave_get_nwid(struct net_device
*dev
,
500 struct iw_request_info
*info
,
501 union iwreq_data
*wrqu
,
504 wrqu
->nwid
.value
= domain
;
505 wrqu
->nwid
.disabled
= 0;
506 wrqu
->nwid
.fixed
= 1;
511 * Wireless Handler : set scramble key
513 static int netwave_set_scramble(struct net_device
*dev
,
514 struct iw_request_info
*info
,
515 union iwreq_data
*wrqu
,
519 unsigned int iobase
= dev
->base_addr
;
520 netwave_private
*priv
= netdev_priv(dev
);
521 u_char __iomem
*ramBase
= priv
->ramBase
;
523 /* Disable interrupts & save flags */
524 spin_lock_irqsave(&priv
->spinlock
, flags
);
526 scramble_key
= (key
[0] << 8) | key
[1];
528 writeb(NETWAVE_CMD_SSK
, ramBase
+ NETWAVE_EREG_CB
+ 0);
529 writeb(scramble_key
& 0xff, ramBase
+ NETWAVE_EREG_CB
+ 1);
530 writeb((scramble_key
>>8) & 0xff, ramBase
+ NETWAVE_EREG_CB
+ 2);
531 writeb(NETWAVE_CMD_EOC
, ramBase
+ NETWAVE_EREG_CB
+ 3);
533 /* ReEnable interrupts & restore flags */
534 spin_unlock_irqrestore(&priv
->spinlock
, flags
);
540 * Wireless Handler : get scramble key
542 static int netwave_get_scramble(struct net_device
*dev
,
543 struct iw_request_info
*info
,
544 union iwreq_data
*wrqu
,
547 key
[1] = scramble_key
& 0xff;
548 key
[0] = (scramble_key
>>8) & 0xff;
549 wrqu
->encoding
.flags
= IW_ENCODE_ENABLED
;
550 wrqu
->encoding
.length
= 2;
555 * Wireless Handler : get mode
557 static int netwave_get_mode(struct net_device
*dev
,
558 struct iw_request_info
*info
,
559 union iwreq_data
*wrqu
,
563 wrqu
->mode
= IW_MODE_INFRA
;
565 wrqu
->mode
= IW_MODE_ADHOC
;
571 * Wireless Handler : get range info
573 static int netwave_get_range(struct net_device
*dev
,
574 struct iw_request_info
*info
,
575 union iwreq_data
*wrqu
,
578 struct iw_range
*range
= (struct iw_range
*) extra
;
581 /* Set the length (very important for backward compatibility) */
582 wrqu
->data
.length
= sizeof(struct iw_range
);
584 /* Set all the info we don't care or don't know about to zero */
585 memset(range
, 0, sizeof(struct iw_range
));
587 /* Set the Wireless Extension versions */
588 range
->we_version_compiled
= WIRELESS_EXT
;
589 range
->we_version_source
= 9; /* Nothing for us in v10 and v11 */
591 /* Set information in the range struct */
592 range
->throughput
= 450 * 1000; /* don't argue on this ! */
593 range
->min_nwid
= 0x0000;
594 range
->max_nwid
= 0x01FF;
596 range
->num_channels
= range
->num_frequency
= 0;
598 range
->sensitivity
= 0x3F;
599 range
->max_qual
.qual
= 255;
600 range
->max_qual
.level
= 255;
601 range
->max_qual
.noise
= 0;
603 range
->num_bitrates
= 1;
604 range
->bitrate
[0] = 1000000; /* 1 Mb/s */
606 range
->encoding_size
[0] = 2; /* 16 bits scrambling */
607 range
->num_encoding_sizes
= 1;
608 range
->max_encoding_tokens
= 1; /* Only one key possible */
614 * Wireless Private Handler : get snapshot
616 static int netwave_get_snap(struct net_device
*dev
,
617 struct iw_request_info
*info
,
618 union iwreq_data
*wrqu
,
622 unsigned int iobase
= dev
->base_addr
;
623 netwave_private
*priv
= netdev_priv(dev
);
624 u_char __iomem
*ramBase
= priv
->ramBase
;
626 /* Disable interrupts & save flags */
627 spin_lock_irqsave(&priv
->spinlock
, flags
);
629 /* Take snapshot of environment */
630 netwave_snapshot( priv
, ramBase
, iobase
);
631 wrqu
->data
.length
= priv
->nss
.length
;
632 memcpy(extra
, (u_char
*) &priv
->nss
, sizeof( struct site_survey
));
634 priv
->lastExec
= jiffies
;
636 /* ReEnable interrupts & restore flags */
637 spin_unlock_irqrestore(&priv
->spinlock
, flags
);
643 * Structures to export the Wireless Handlers
644 * This is the stuff that are treated the wireless extensions (iwconfig)
647 static const struct iw_priv_args netwave_private_args
[] = {
648 /*{ cmd, set_args, get_args, name } */
650 IW_PRIV_TYPE_BYTE
| IW_PRIV_SIZE_FIXED
| sizeof(struct site_survey
),
654 static const iw_handler netwave_handler
[] =
656 NULL
, /* SIOCSIWNAME */
657 netwave_get_name
, /* SIOCGIWNAME */
658 netwave_set_nwid
, /* SIOCSIWNWID */
659 netwave_get_nwid
, /* SIOCGIWNWID */
660 NULL
, /* SIOCSIWFREQ */
661 NULL
, /* SIOCGIWFREQ */
662 NULL
, /* SIOCSIWMODE */
663 netwave_get_mode
, /* SIOCGIWMODE */
664 NULL
, /* SIOCSIWSENS */
665 NULL
, /* SIOCGIWSENS */
666 NULL
, /* SIOCSIWRANGE */
667 netwave_get_range
, /* SIOCGIWRANGE */
668 NULL
, /* SIOCSIWPRIV */
669 NULL
, /* SIOCGIWPRIV */
670 NULL
, /* SIOCSIWSTATS */
671 NULL
, /* SIOCGIWSTATS */
672 NULL
, /* SIOCSIWSPY */
673 NULL
, /* SIOCGIWSPY */
674 NULL
, /* -- hole -- */
675 NULL
, /* -- hole -- */
676 NULL
, /* SIOCSIWAP */
677 NULL
, /* SIOCGIWAP */
678 NULL
, /* -- hole -- */
679 NULL
, /* SIOCGIWAPLIST */
680 NULL
, /* -- hole -- */
681 NULL
, /* -- hole -- */
682 NULL
, /* SIOCSIWESSID */
683 NULL
, /* SIOCGIWESSID */
684 NULL
, /* SIOCSIWNICKN */
685 NULL
, /* SIOCGIWNICKN */
686 NULL
, /* -- hole -- */
687 NULL
, /* -- hole -- */
688 NULL
, /* SIOCSIWRATE */
689 NULL
, /* SIOCGIWRATE */
690 NULL
, /* SIOCSIWRTS */
691 NULL
, /* SIOCGIWRTS */
692 NULL
, /* SIOCSIWFRAG */
693 NULL
, /* SIOCGIWFRAG */
694 NULL
, /* SIOCSIWTXPOW */
695 NULL
, /* SIOCGIWTXPOW */
696 NULL
, /* SIOCSIWRETRY */
697 NULL
, /* SIOCGIWRETRY */
698 netwave_set_scramble
, /* SIOCSIWENCODE */
699 netwave_get_scramble
, /* SIOCGIWENCODE */
702 static const iw_handler netwave_private_handler
[] =
704 NULL
, /* SIOCIWFIRSTPRIV */
705 netwave_get_snap
, /* SIOCIWFIRSTPRIV + 1 */
708 static const struct iw_handler_def netwave_handler_def
=
710 .num_standard
= ARRAY_SIZE(netwave_handler
),
711 .num_private
= ARRAY_SIZE(netwave_private_handler
),
712 .num_private_args
= ARRAY_SIZE(netwave_private_args
),
713 .standard
= (iw_handler
*) netwave_handler
,
714 .private = (iw_handler
*) netwave_private_handler
,
715 .private_args
= (struct iw_priv_args
*) netwave_private_args
,
716 .get_wireless_stats
= netwave_get_wireless_stats
,
720 * Function netwave_pcmcia_config (link)
722 * netwave_pcmcia_config() is scheduled to run after a CARD_INSERTION
723 * event is received, to configure the PCMCIA socket, and to make the
724 * device available to the system.
728 #define CS_CHECK(fn, ret) \
729 do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
731 static int netwave_pcmcia_config(struct pcmcia_device
*link
) {
732 struct net_device
*dev
= link
->priv
;
733 netwave_private
*priv
= netdev_priv(dev
);
734 int i
, j
, last_ret
, last_fn
;
737 u_char __iomem
*ramBase
= NULL
;
739 DEBUG(0, "netwave_pcmcia_config(0x%p)\n", link
);
742 * Try allocating IO ports. This tries a few fixed addresses.
743 * If you want, you can also read the card's config table to
744 * pick addresses -- see the serial driver for an example.
746 for (i
= j
= 0x0; j
< 0x400; j
+= 0x20) {
747 link
->io
.BasePort1
= j
^ 0x300;
748 i
= pcmcia_request_io(link
, &link
->io
);
753 cs_error(link
, RequestIO
, i
);
758 * Now allocate an interrupt line. Note that this does not
759 * actually assign a handler to the interrupt.
761 CS_CHECK(RequestIRQ
, pcmcia_request_irq(link
, &link
->irq
));
764 * This actually configures the PCMCIA socket -- setting up
765 * the I/O windows and the interrupt mapping.
767 CS_CHECK(RequestConfiguration
, pcmcia_request_configuration(link
, &link
->conf
));
770 * Allocate a 32K memory window. Note that the struct pcmcia_device
771 * structure provides space for one window handle -- if your
772 * device needs several windows, you'll need to keep track of
773 * the handles in your private data structure, dev->priv.
775 DEBUG(1, "Setting mem speed of %d\n", mem_speed
);
777 req
.Attributes
= WIN_DATA_WIDTH_8
|WIN_MEMORY_TYPE_CM
|WIN_ENABLE
;
778 req
.Base
= 0; req
.Size
= 0x8000;
779 req
.AccessSpeed
= mem_speed
;
780 CS_CHECK(RequestWindow
, pcmcia_request_window(&link
, &req
, &link
->win
));
781 mem
.CardOffset
= 0x20000; mem
.Page
= 0;
782 CS_CHECK(MapMemPage
, pcmcia_map_mem_page(link
->win
, &mem
));
784 /* Store base address of the common window frame */
785 ramBase
= ioremap(req
.Base
, 0x8000);
786 priv
->ramBase
= ramBase
;
788 dev
->irq
= link
->irq
.AssignedIRQ
;
789 dev
->base_addr
= link
->io
.BasePort1
;
790 SET_NETDEV_DEV(dev
, &handle_to_dev(link
));
792 if (register_netdev(dev
) != 0) {
793 printk(KERN_DEBUG
"netwave_cs: register_netdev() failed\n");
797 strcpy(priv
->node
.dev_name
, dev
->name
);
798 link
->dev_node
= &priv
->node
;
800 /* Reset card before reading physical address */
801 netwave_doreset(dev
->base_addr
, ramBase
);
803 /* Read the ethernet address and fill in the Netwave registers. */
804 for (i
= 0; i
< 6; i
++)
805 dev
->dev_addr
[i
] = readb(ramBase
+ NETWAVE_EREG_PA
+ i
);
807 printk(KERN_INFO
"%s: Netwave: port %#3lx, irq %d, mem %lx, "
808 "id %c%c, hw_addr %pM\n",
809 dev
->name
, dev
->base_addr
, dev
->irq
,
811 (int) readb(ramBase
+NETWAVE_EREG_NI
),
812 (int) readb(ramBase
+NETWAVE_EREG_NI
+1),
815 /* get revision words */
816 printk(KERN_DEBUG
"Netwave_reset: revision %04x %04x\n",
817 get_uint16(ramBase
+ NETWAVE_EREG_ARW
),
818 get_uint16(ramBase
+ NETWAVE_EREG_ARW
+2));
822 cs_error(link
, last_fn
, last_ret
);
824 netwave_release(link
);
826 } /* netwave_pcmcia_config */
829 * Function netwave_release (arg)
831 * After a card is removed, netwave_release() will unregister the net
832 * device, and release the PCMCIA configuration. If the device is
833 * still open, this will be postponed until it is closed.
835 static void netwave_release(struct pcmcia_device
*link
)
837 struct net_device
*dev
= link
->priv
;
838 netwave_private
*priv
= netdev_priv(dev
);
840 DEBUG(0, "netwave_release(0x%p)\n", link
);
842 pcmcia_disable_device(link
);
844 iounmap(priv
->ramBase
);
847 static int netwave_suspend(struct pcmcia_device
*link
)
849 struct net_device
*dev
= link
->priv
;
852 netif_device_detach(dev
);
857 static int netwave_resume(struct pcmcia_device
*link
)
859 struct net_device
*dev
= link
->priv
;
863 netif_device_attach(dev
);
871 * Function netwave_doreset (ioBase, ramBase)
873 * Proper hardware reset of the card.
875 static void netwave_doreset(unsigned int ioBase
, u_char __iomem
*ramBase
)
879 outb(0x80, ioBase
+ NETWAVE_REG_PMR
);
880 writeb(0x08, ramBase
+ NETWAVE_EREG_ASCC
); /* Bit 3 is WOC */
881 outb(0x0, ioBase
+ NETWAVE_REG_PMR
); /* release reset */
885 * Function netwave_reset (dev)
887 * Reset and restore all of the netwave registers
889 static void netwave_reset(struct net_device
*dev
) {
891 netwave_private
*priv
= netdev_priv(dev
);
892 u_char __iomem
*ramBase
= priv
->ramBase
;
893 unsigned int iobase
= dev
->base_addr
;
895 DEBUG(0, "netwave_reset: Done with hardware reset\n");
897 priv
->timeoutCounter
= 0;
900 netwave_doreset(iobase
, ramBase
);
901 printk(KERN_DEBUG
"netwave_reset: Done with hardware reset\n");
903 /* Write a NOP to check the card */
905 writeb(NETWAVE_CMD_NOP
, ramBase
+ NETWAVE_EREG_CB
+ 0);
906 writeb(NETWAVE_CMD_EOC
, ramBase
+ NETWAVE_EREG_CB
+ 1);
908 /* Set receive conf */
910 writeb(NETWAVE_CMD_SRC
, ramBase
+ NETWAVE_EREG_CB
+ 0);
911 writeb(rxConfRxEna
+ rxConfBcast
, ramBase
+ NETWAVE_EREG_CB
+ 1);
912 writeb(NETWAVE_CMD_EOC
, ramBase
+ NETWAVE_EREG_CB
+ 2);
914 /* Set transmit conf */
916 writeb(NETWAVE_CMD_STC
, ramBase
+ NETWAVE_EREG_CB
+ 0);
917 writeb(txConfTxEna
, ramBase
+ NETWAVE_EREG_CB
+ 1);
918 writeb(NETWAVE_CMD_EOC
, ramBase
+ NETWAVE_EREG_CB
+ 2);
920 /* Now set the MU Domain */
921 printk(KERN_DEBUG
"Setting domain to 0x%x%02x\n", (domain
>> 8) & 0x01, domain
& 0xff);
923 writeb(NETWAVE_CMD_SMD
, ramBase
+ NETWAVE_EREG_CB
+ 0);
924 writeb(domain
& 0xff, ramBase
+ NETWAVE_EREG_CB
+ 1);
925 writeb((domain
>>8) & 0x01, ramBase
+ NETWAVE_EREG_CB
+ 2);
926 writeb(NETWAVE_CMD_EOC
, ramBase
+ NETWAVE_EREG_CB
+ 3);
928 /* Set scramble key */
929 printk(KERN_DEBUG
"Setting scramble key to 0x%x\n", scramble_key
);
931 writeb(NETWAVE_CMD_SSK
, ramBase
+ NETWAVE_EREG_CB
+ 0);
932 writeb(scramble_key
& 0xff, ramBase
+ NETWAVE_EREG_CB
+ 1);
933 writeb((scramble_key
>>8) & 0xff, ramBase
+ NETWAVE_EREG_CB
+ 2);
934 writeb(NETWAVE_CMD_EOC
, ramBase
+ NETWAVE_EREG_CB
+ 3);
936 /* Enable interrupts, bit 4 high to keep unused
937 * source from interrupting us, bit 2 high to
938 * set interrupt enable, 567 to enable TxDN,
942 outb(imrConfIENA
+imrConfRFU1
, iobase
+ NETWAVE_REG_IMR
);
944 /* Hent 4 bytes fra 0x170. Skal vaere 0a,29,88,36
946 * skriv 80 til d000:3688
947 * sjekk om det ble 80
950 /* Enable Receiver */
952 writeb(NETWAVE_CMD_ER
, ramBase
+ NETWAVE_EREG_CB
+ 0);
953 writeb(NETWAVE_CMD_EOC
, ramBase
+ NETWAVE_EREG_CB
+ 1);
955 /* Set the IENA bit in COR */
957 outb(corConfIENA
+ corConfLVLREQ
, iobase
+ NETWAVE_REG_COR
);
961 * Function netwave_hw_xmit (data, len, dev)
963 static int netwave_hw_xmit(unsigned char* data
, int len
,
964 struct net_device
* dev
) {
966 unsigned int TxFreeList
,
972 netwave_private
*priv
= netdev_priv(dev
);
973 u_char __iomem
* ramBase
= priv
->ramBase
;
974 unsigned int iobase
= dev
->base_addr
;
976 /* Disable interrupts & save flags */
977 spin_lock_irqsave(&priv
->spinlock
, flags
);
979 /* Check if there are transmit buffers available */
981 if ((inb(iobase
+NETWAVE_REG_ASR
) & NETWAVE_ASR_TXBA
) == 0) {
982 /* No buffers available */
983 printk(KERN_DEBUG
"netwave_hw_xmit: %s - no xmit buffers available.\n",
985 spin_unlock_irqrestore(&priv
->spinlock
, flags
);
989 dev
->stats
.tx_bytes
+= len
;
991 DEBUG(3, "Transmitting with SPCQ %x SPU %x LIF %x ISPLQ %x\n",
992 readb(ramBase
+ NETWAVE_EREG_SPCQ
),
993 readb(ramBase
+ NETWAVE_EREG_SPU
),
994 readb(ramBase
+ NETWAVE_EREG_LIF
),
995 readb(ramBase
+ NETWAVE_EREG_ISPLQ
));
997 /* Now try to insert it into the adapters free memory */
999 TxFreeList
= get_uint16(ramBase
+ NETWAVE_EREG_TDP
);
1000 MaxData
= get_uint16(ramBase
+ NETWAVE_EREG_TDP
+2);
1001 DataOffset
= get_uint16(ramBase
+ NETWAVE_EREG_TDP
+4);
1003 DEBUG(3, "TxFreeList %x, MaxData %x, DataOffset %x\n",
1004 TxFreeList
, MaxData
, DataOffset
);
1006 /* Copy packet to the adapter fragment buffers */
1007 curBuff
= TxFreeList
;
1009 while (tmpcount
< len
) {
1010 int tmplen
= len
- tmpcount
;
1011 copy_to_pc(ramBase
+ curBuff
+ DataOffset
, data
+ tmpcount
,
1012 (tmplen
< MaxData
) ? tmplen
: MaxData
);
1013 tmpcount
+= MaxData
;
1015 /* Advance to next buffer */
1016 curBuff
= get_uint16(ramBase
+ curBuff
);
1019 /* Now issue transmit list */
1021 writeb(NETWAVE_CMD_TL
, ramBase
+ NETWAVE_EREG_CB
+ 0);
1022 writeb(len
& 0xff, ramBase
+ NETWAVE_EREG_CB
+ 1);
1023 writeb((len
>>8) & 0xff, ramBase
+ NETWAVE_EREG_CB
+ 2);
1024 writeb(NETWAVE_CMD_EOC
, ramBase
+ NETWAVE_EREG_CB
+ 3);
1026 spin_unlock_irqrestore(&priv
->spinlock
, flags
);
1030 static netdev_tx_t
netwave_start_xmit(struct sk_buff
*skb
,
1031 struct net_device
*dev
) {
1032 /* This flag indicate that the hardware can't perform a transmission.
1033 * Theoritically, NET3 check it before sending a packet to the driver,
1034 * but in fact it never do that and pool continuously.
1035 * As the watchdog will abort too long transmissions, we are quite safe...
1038 netif_stop_queue(dev
);
1041 short length
= ETH_ZLEN
< skb
->len
? skb
->len
: ETH_ZLEN
;
1042 unsigned char* buf
= skb
->data
;
1044 if (netwave_hw_xmit( buf
, length
, dev
) == 1) {
1045 /* Some error, let's make them call us another time? */
1046 netif_start_queue(dev
);
1048 dev
->trans_start
= jiffies
;
1052 return NETDEV_TX_OK
;
1053 } /* netwave_start_xmit */
1056 * Function netwave_interrupt (irq, dev_id)
1058 * This function is the interrupt handler for the Netwave card. This
1059 * routine will be called whenever:
1060 * 1. A packet is received.
1061 * 2. A packet has successfully been transferred and the unit is
1062 * ready to transmit another packet.
1063 * 3. A command has completed execution.
1065 static irqreturn_t
netwave_interrupt(int irq
, void* dev_id
)
1067 unsigned int iobase
;
1068 u_char __iomem
*ramBase
;
1069 struct net_device
*dev
= (struct net_device
*)dev_id
;
1070 struct netwave_private
*priv
= netdev_priv(dev
);
1071 struct pcmcia_device
*link
= priv
->p_dev
;
1074 if (!netif_device_present(dev
))
1077 iobase
= dev
->base_addr
;
1078 ramBase
= priv
->ramBase
;
1080 /* Now find what caused the interrupt, check while interrupts ready */
1081 for (i
= 0; i
< 10; i
++) {
1085 if (!(inb(iobase
+NETWAVE_REG_CCSR
) & 0x02))
1086 break; /* None of the interrupt sources asserted (normal exit) */
1088 status
= inb(iobase
+ NETWAVE_REG_ASR
);
1090 if (!pcmcia_dev_present(link
)) {
1091 DEBUG(1, "netwave_interrupt: Interrupt with status 0x%x "
1092 "from removed or suspended card!\n", status
);
1097 if (status
& 0x80) {
1099 /* wait_WOC(iobase); */
1100 /* RxRdy cannot be reset directly by the host */
1103 if (status
& 0x40) {
1106 rser
= readb(ramBase
+ NETWAVE_EREG_RSER
);
1109 ++dev
->stats
.rx_dropped
;
1110 ++dev
->stats
.rx_crc_errors
;
1113 ++dev
->stats
.rx_frame_errors
;
1115 /* Clear the RxErr bit in RSER. RSER+4 is the
1116 * write part. Also clear the RxCRC (0x04) and
1117 * RxBig (0x02) bits if present */
1119 writeb(0x40 | (rser
& 0x06), ramBase
+ NETWAVE_EREG_RSER
+ 4);
1121 /* Write bit 6 high to ASCC to clear RxErr in ASR,
1122 * WOC must be set first!
1125 writeb(0x40, ramBase
+ NETWAVE_EREG_ASCC
);
1127 /* Remember to count up dev->stats on error packets */
1128 ++dev
->stats
.rx_errors
;
1131 if (status
& 0x20) {
1134 txStatus
= readb(ramBase
+ NETWAVE_EREG_TSER
);
1135 DEBUG(3, "Transmit done. TSER = %x id %x\n",
1136 txStatus
, readb(ramBase
+ NETWAVE_EREG_TSER
+ 1));
1138 if (txStatus
& 0x20) {
1139 /* Transmitting was okay, clear bits */
1141 writeb(0x2f, ramBase
+ NETWAVE_EREG_TSER
+ 4);
1142 ++dev
->stats
.tx_packets
;
1145 if (txStatus
& 0xd0) {
1146 if (txStatus
& 0x80) {
1147 ++dev
->stats
.collisions
; /* Because of /proc/net/dev*/
1148 /* ++dev->stats.tx_aborted_errors; */
1149 /* printk("Collision. %ld\n", jiffies - dev->trans_start); */
1151 if (txStatus
& 0x40)
1152 ++dev
->stats
.tx_carrier_errors
;
1153 /* 0x80 TxGU Transmit giveup - nine times and no luck
1154 * 0x40 TxNOAP No access point. Discarded packet.
1155 * 0x10 TxErr Transmit error. Always set when
1156 * TxGU and TxNOAP is set. (Those are the only ones
1159 DEBUG(3, "netwave_interrupt: TxDN with error status %x\n",
1162 /* Clear out TxGU, TxNOAP, TxErr and TxTrys */
1164 writeb(0xdf & txStatus
, ramBase
+NETWAVE_EREG_TSER
+4);
1165 ++dev
->stats
.tx_errors
;
1167 DEBUG(3, "New status is TSER %x ASR %x\n",
1168 readb(ramBase
+ NETWAVE_EREG_TSER
),
1169 inb(iobase
+ NETWAVE_REG_ASR
));
1171 netif_wake_queue(dev
);
1173 /* TxBA, this would trigger on all error packets received */
1174 /* if (status & 0x01) {
1175 DEBUG(4, "Transmit buffers available, %x\n", status);
1179 /* Handled if we looped at least one time - Jean II */
1180 return IRQ_RETVAL(i
);
1181 } /* netwave_interrupt */
1184 * Function netwave_watchdog (a)
1186 * Watchdog : when we start a transmission, we set a timer in the
1187 * kernel. If the transmission complete, this timer is disabled. If
1188 * it expire, we reset the card.
1191 static void netwave_watchdog(struct net_device
*dev
) {
1193 DEBUG(1, "%s: netwave_watchdog: watchdog timer expired\n", dev
->name
);
1195 dev
->trans_start
= jiffies
;
1196 netif_wake_queue(dev
);
1197 } /* netwave_watchdog */
1199 static int netwave_rx(struct net_device
*dev
)
1201 netwave_private
*priv
= netdev_priv(dev
);
1202 u_char __iomem
*ramBase
= priv
->ramBase
;
1203 unsigned int iobase
= dev
->base_addr
;
1205 struct sk_buff
*skb
= NULL
;
1206 unsigned int curBuffer
,
1210 int dataCount
, dataOffset
;
1214 DEBUG(3, "xinw_rx: Receiving ... \n");
1216 /* Receive max 10 packets for now. */
1217 for (i
= 0; i
< 10; i
++) {
1220 rxStatus
= readb(ramBase
+ NETWAVE_EREG_RSER
);
1221 if ( !( rxStatus
& 0x80)) /* No more packets */
1224 /* Check if multicast/broadcast or other */
1225 /* multicast = (rxStatus & 0x20); */
1227 /* The receive list pointer and length of the packet */
1229 rcvLen
= get_int16( ramBase
+ NETWAVE_EREG_RDP
);
1230 rcvList
= get_uint16( ramBase
+ NETWAVE_EREG_RDP
+ 2);
1233 printk(KERN_DEBUG
"netwave_rx: Receive packet with len %d\n",
1238 skb
= dev_alloc_skb(rcvLen
+5);
1240 DEBUG(1, "netwave_rx: Could not allocate an sk_buff of "
1241 "length %d\n", rcvLen
);
1242 ++dev
->stats
.rx_dropped
;
1243 /* Tell the adapter to skip the packet */
1245 writeb(NETWAVE_CMD_SRP
, ramBase
+ NETWAVE_EREG_CB
+ 0);
1246 writeb(NETWAVE_CMD_EOC
, ramBase
+ NETWAVE_EREG_CB
+ 1);
1250 skb_reserve( skb
, 2); /* Align IP on 16 byte */
1251 skb_put( skb
, rcvLen
);
1253 /* Copy packet fragments to the skb data area */
1254 ptr
= (u_char
*) skb
->data
;
1255 curBuffer
= rcvList
;
1257 while ( tmpcount
< rcvLen
) {
1258 /* Get length and offset of current buffer */
1259 dataCount
= get_uint16( ramBase
+curBuffer
+2);
1260 dataOffset
= get_uint16( ramBase
+curBuffer
+4);
1262 copy_from_pc( ptr
+ tmpcount
,
1263 ramBase
+curBuffer
+dataOffset
, dataCount
);
1265 tmpcount
+= dataCount
;
1267 /* Point to next buffer */
1268 curBuffer
= get_uint16(ramBase
+ curBuffer
);
1271 skb
->protocol
= eth_type_trans(skb
,dev
);
1272 /* Queue packet for network layer */
1275 dev
->stats
.rx_packets
++;
1276 dev
->stats
.rx_bytes
+= rcvLen
;
1278 /* Got the packet, tell the adapter to skip it */
1280 writeb(NETWAVE_CMD_SRP
, ramBase
+ NETWAVE_EREG_CB
+ 0);
1281 writeb(NETWAVE_CMD_EOC
, ramBase
+ NETWAVE_EREG_CB
+ 1);
1282 DEBUG(3, "Packet reception ok\n");
1287 static int netwave_open(struct net_device
*dev
) {
1288 netwave_private
*priv
= netdev_priv(dev
);
1289 struct pcmcia_device
*link
= priv
->p_dev
;
1291 DEBUG(1, "netwave_open: starting.\n");
1293 if (!pcmcia_dev_present(link
))
1298 netif_start_queue(dev
);
1304 static int netwave_close(struct net_device
*dev
) {
1305 netwave_private
*priv
= netdev_priv(dev
);
1306 struct pcmcia_device
*link
= priv
->p_dev
;
1308 DEBUG(1, "netwave_close: finishing.\n");
1311 netif_stop_queue(dev
);
1316 static struct pcmcia_device_id netwave_ids
[] = {
1317 PCMCIA_DEVICE_PROD_ID12("Xircom", "CreditCard Netwave", 0x2e3ee845, 0x54e28a28),
1320 MODULE_DEVICE_TABLE(pcmcia
, netwave_ids
);
1322 static struct pcmcia_driver netwave_driver
= {
1323 .owner
= THIS_MODULE
,
1325 .name
= "netwave_cs",
1327 .probe
= netwave_probe
,
1328 .remove
= netwave_detach
,
1329 .id_table
= netwave_ids
,
1330 .suspend
= netwave_suspend
,
1331 .resume
= netwave_resume
,
1334 static int __init
init_netwave_cs(void)
1336 return pcmcia_register_driver(&netwave_driver
);
1339 static void __exit
exit_netwave_cs(void)
1341 pcmcia_unregister_driver(&netwave_driver
);
1344 module_init(init_netwave_cs
);
1345 module_exit(exit_netwave_cs
);
1347 /* Set or clear the multicast filter for this adaptor.
1348 num_addrs == -1 Promiscuous mode, receive all packets
1349 num_addrs == 0 Normal mode, clear multicast list
1350 num_addrs > 0 Multicast mode, receive normal and MC packets, and do
1351 best-effort filtering.
1353 static void set_multicast_list(struct net_device
*dev
)
1355 unsigned int iobase
= dev
->base_addr
;
1356 netwave_private
*priv
= netdev_priv(dev
);
1357 u_char __iomem
* ramBase
= priv
->ramBase
;
1363 if (old
!= dev
->mc_count
) {
1364 old
= dev
->mc_count
;
1365 DEBUG(0, "%s: setting Rx mode to %d addresses.\n",
1366 dev
->name
, dev
->mc_count
);
1371 if (dev
->mc_count
|| (dev
->flags
& IFF_ALLMULTI
)) {
1372 /* Multicast Mode */
1373 rcvMode
= rxConfRxEna
+ rxConfAMP
+ rxConfBcast
;
1374 } else if (dev
->flags
& IFF_PROMISC
) {
1375 /* Promiscous mode */
1376 rcvMode
= rxConfRxEna
+ rxConfPro
+ rxConfAMP
+ rxConfBcast
;
1379 rcvMode
= rxConfRxEna
+ rxConfBcast
;
1382 /* printk("netwave set_multicast_list: rcvMode to %x\n", rcvMode);*/
1383 /* Now set receive mode */
1385 writeb(NETWAVE_CMD_SRC
, ramBase
+ NETWAVE_EREG_CB
+ 0);
1386 writeb(rcvMode
, ramBase
+ NETWAVE_EREG_CB
+ 1);
1387 writeb(NETWAVE_CMD_EOC
, ramBase
+ NETWAVE_EREG_CB
+ 2);
1389 MODULE_LICENSE("GPL");