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/config.h>
41 #include <linux/module.h>
42 #include <linux/kernel.h>
43 #include <linux/init.h>
44 #include <linux/types.h>
45 #include <linux/fcntl.h>
46 #include <linux/interrupt.h>
47 #include <linux/ptrace.h>
48 #include <linux/ioport.h>
50 #include <linux/slab.h>
51 #include <linux/string.h>
52 #include <linux/timer.h>
53 #include <linux/errno.h>
54 #include <linux/netdevice.h>
55 #include <linux/etherdevice.h>
56 #include <linux/skbuff.h>
57 #include <linux/bitops.h>
58 #include <linux/wireless.h>
59 #include <net/iw_handler.h>
61 #include <pcmcia/cs_types.h>
62 #include <pcmcia/cs.h>
63 #include <pcmcia/cistpl.h>
64 #include <pcmcia/cisreg.h>
65 #include <pcmcia/ds.h>
66 #include <pcmcia/mem_op.h>
68 #include <asm/system.h>
72 #define NETWAVE_REGOFF 0x8000
73 /* The Netwave IO registers, offsets to iobase */
74 #define NETWAVE_REG_COR 0x0
75 #define NETWAVE_REG_CCSR 0x2
76 #define NETWAVE_REG_ASR 0x4
77 #define NETWAVE_REG_IMR 0xa
78 #define NETWAVE_REG_PMR 0xc
79 #define NETWAVE_REG_IOLOW 0x6
80 #define NETWAVE_REG_IOHI 0x7
81 #define NETWAVE_REG_IOCONTROL 0x8
82 #define NETWAVE_REG_DATA 0xf
83 /* The Netwave Extended IO registers, offsets to RamBase */
84 #define NETWAVE_EREG_ASCC 0x114
85 #define NETWAVE_EREG_RSER 0x120
86 #define NETWAVE_EREG_RSERW 0x124
87 #define NETWAVE_EREG_TSER 0x130
88 #define NETWAVE_EREG_TSERW 0x134
89 #define NETWAVE_EREG_CB 0x100
90 #define NETWAVE_EREG_SPCQ 0x154
91 #define NETWAVE_EREG_SPU 0x155
92 #define NETWAVE_EREG_LIF 0x14e
93 #define NETWAVE_EREG_ISPLQ 0x156
94 #define NETWAVE_EREG_HHC 0x158
95 #define NETWAVE_EREG_NI 0x16e
96 #define NETWAVE_EREG_MHS 0x16b
97 #define NETWAVE_EREG_TDP 0x140
98 #define NETWAVE_EREG_RDP 0x150
99 #define NETWAVE_EREG_PA 0x160
100 #define NETWAVE_EREG_EC 0x180
101 #define NETWAVE_EREG_CRBP 0x17a
102 #define NETWAVE_EREG_ARW 0x166
105 * Commands used in the extended command buffer
106 * NETWAVE_EREG_CB (0x100-0x10F)
108 #define NETWAVE_CMD_NOP 0x00
109 #define NETWAVE_CMD_SRC 0x01
110 #define NETWAVE_CMD_STC 0x02
111 #define NETWAVE_CMD_AMA 0x03
112 #define NETWAVE_CMD_DMA 0x04
113 #define NETWAVE_CMD_SAMA 0x05
114 #define NETWAVE_CMD_ER 0x06
115 #define NETWAVE_CMD_DR 0x07
116 #define NETWAVE_CMD_TL 0x08
117 #define NETWAVE_CMD_SRP 0x09
118 #define NETWAVE_CMD_SSK 0x0a
119 #define NETWAVE_CMD_SMD 0x0b
120 #define NETWAVE_CMD_SAPD 0x0c
121 #define NETWAVE_CMD_SSS 0x11
122 /* End of Command marker */
123 #define NETWAVE_CMD_EOC 0x00
125 /* ASR register bits */
126 #define NETWAVE_ASR_RXRDY 0x80
127 #define NETWAVE_ASR_TXBA 0x01
129 #define TX_TIMEOUT ((32*HZ)/100)
131 static const unsigned int imrConfRFU1 = 0x10; /* RFU interrupt mask, keep high */
132 static const unsigned int imrConfIENA = 0x02; /* Interrupt enable */
134 static const unsigned int corConfIENA = 0x01; /* Interrupt enable */
135 static const unsigned int corConfLVLREQ = 0x40; /* Keep high */
137 static const unsigned int rxConfRxEna = 0x80; /* Receive Enable */
138 static const unsigned int rxConfMAC = 0x20; /* MAC host receive mode*/
139 static const unsigned int rxConfPro = 0x10; /* Promiscuous */
140 static const unsigned int rxConfAMP = 0x08; /* Accept Multicast Packets */
141 static const unsigned int rxConfBcast = 0x04; /* Accept Broadcast Packets */
143 static const unsigned int txConfTxEna = 0x80; /* Transmit Enable */
144 static const unsigned int txConfMAC = 0x20; /* Host sends MAC mode */
145 static const unsigned int txConfEUD = 0x10; /* Enable Uni-Data packets */
146 static const unsigned int txConfKey = 0x02; /* Scramble data packets */
147 static const unsigned int txConfLoop = 0x01; /* Loopback mode */
150 All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If
151 you do not define PCMCIA_DEBUG at all, all the debug code will be
152 left out. If you compile with PCMCIA_DEBUG=0, the debug code will
153 be present but disabled -- but it can then be enabled for specific
154 modules at load time with a 'pc_debug=#' option to insmod.
158 static int pc_debug = PCMCIA_DEBUG;
159 module_param(pc_debug, int, 0);
160 #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
161 static char *version =
162 "netwave_cs.c 0.3.0 Thu Jul 17 14:36:02 1997 (John Markus Bjørndalen)\n";
164 #define DEBUG(n, args...)
167 /*====================================================================*/
169 /* Parameters that can be set with 'insmod' */
171 /* Choose the domain, default is 0x100 */
172 static u_int domain = 0x100;
174 /* Scramble key, range from 0x0 to 0xffff.
175 * 0x0 is no scrambling.
177 static u_int scramble_key = 0x0;
179 /* Shared memory speed, in ns. The documentation states that
180 * the card should not be read faster than every 400ns.
181 * This timing should be provided by the HBA. If it becomes a
182 * problem, try setting mem_speed to 400.
184 static int mem_speed;
186 module_param(domain, int, 0);
187 module_param(scramble_key, int, 0);
188 module_param(mem_speed, int, 0);
190 /*====================================================================*/
192 /* PCMCIA (Card Services) related functions */
193 static void netwave_release(struct pcmcia_device *link); /* Card removal */
194 static int netwave_pcmcia_config(struct pcmcia_device *arg); /* Runs after card
196 static void netwave_detach(struct pcmcia_device *p_dev); /* Destroy instance */
198 /* Hardware configuration */
199 static void netwave_doreset(kio_addr_t iobase, u_char __iomem *ramBase);
200 static void netwave_reset(struct net_device *dev);
202 /* Misc device stuff */
203 static int netwave_open(struct net_device *dev); /* Open the device */
204 static int netwave_close(struct net_device *dev); /* Close the device */
206 /* Packet transmission and Packet reception */
207 static int netwave_start_xmit( struct sk_buff *skb, 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, struct pt_regs *regs);
212 static void netwave_watchdog(struct net_device *);
215 static void update_stats(struct net_device *dev);
216 static struct net_device_stats *netwave_get_stats(struct net_device *dev);
218 /* Wireless extensions */
219 static struct iw_statistics* netwave_get_wireless_stats(struct net_device *dev);
221 static void set_multicast_list(struct net_device *dev);
224 A struct pcmcia_device structure has fields for most things that are needed
225 to keep track of a socket, but there will usually be some device
226 specific information that also needs to be kept track of. The
227 'priv' pointer in a struct pcmcia_device structure can be used to point to
228 a device-specific private data structure, like this.
230 A driver needs to provide a dev_node_t structure for each device
231 on a card. In some cases, there is only one device per card (for
232 example, ethernet cards, modems). In other cases, there may be
233 many actual or logical devices (SCSI adapters, memory cards with
234 multiple partitions). The dev_node_t structures need to be kept
235 in a linked list starting at the 'dev' field of a struct pcmcia_device
236 structure. We allocate them in the card's private data structure,
237 because they generally can't be allocated dynamically.
240 static const struct iw_handler_def netwave_handler_def;
242 #define SIOCGIPSNAP SIOCIWFIRSTPRIV + 1 /* Site Survey Snapshot */
246 typedef struct net_addr {
252 u_char struct_revision;
253 u_char roaming_state;
255 u_char sp_existsFlag;
256 u_char sp_link_quality;
257 u_char sp_max_link_quality;
258 u_char linkQualityGoodFairBoundary;
259 u_char linkQualityFairPoorBoundary;
260 u_char sp_utilization;
262 u_char sp_hotheadcount;
263 u_char roaming_condition;
267 net_addr nearByAccessPoints[MAX_ESA];
270 typedef struct netwave_private {
271 struct pcmcia_device *p_dev;
272 spinlock_t spinlock; /* Serialize access to the hardware (SMP) */
274 u_char __iomem *ramBase;
277 struct timer_list watchdog; /* To avoid blocking state */
278 struct site_survey nss;
279 struct net_device_stats stats;
280 struct iw_statistics iw_stats; /* Wireless stats */
284 static struct net_device_stats *netwave_get_stats(struct net_device *dev);
288 * The Netwave card is little-endian, so won't work for big endian
291 static inline unsigned short get_uint16(u_char __iomem *staddr)
293 return readw(staddr); /* Return only 16 bits */
296 static inline short get_int16(u_char __iomem * staddr)
298 return readw(staddr);
302 * Wait until the WOC (Write Operation Complete) bit in the
303 * ASR (Adapter Status Register) is asserted.
304 * This should have aborted if it takes too long time.
306 static inline void wait_WOC(unsigned int iobase)
309 while ((inb(iobase + NETWAVE_REG_ASR) & 0x8) != 0x8) ;
312 static void netwave_snapshot(netwave_private *priv, u_char __iomem *ramBase,
314 u_short resultBuffer;
316 /* if time since last snapshot is > 1 sec. (100 jiffies?) then take
317 * new snapshot, else return cached data. This is the recommended rate.
319 if ( jiffies - priv->lastExec > 100) {
320 /* Take site survey snapshot */
321 /*printk( KERN_DEBUG "Taking new snapshot. %ld\n", jiffies -
324 writeb(NETWAVE_CMD_SSS, ramBase + NETWAVE_EREG_CB + 0);
325 writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 1);
328 /* Get result and copy to cach */
329 resultBuffer = readw(ramBase + NETWAVE_EREG_CRBP);
330 copy_from_pc( &priv->nss, ramBase+resultBuffer,
331 sizeof(struct site_survey));
336 * Function netwave_get_wireless_stats (dev)
338 * Wireless extensions statistics
341 static struct iw_statistics *netwave_get_wireless_stats(struct net_device *dev)
344 kio_addr_t iobase = dev->base_addr;
345 netwave_private *priv = netdev_priv(dev);
346 u_char __iomem *ramBase = priv->ramBase;
347 struct iw_statistics* wstats;
349 wstats = &priv->iw_stats;
351 spin_lock_irqsave(&priv->spinlock, flags);
353 netwave_snapshot( priv, ramBase, iobase);
355 wstats->status = priv->nss.roaming_state;
356 wstats->qual.qual = readb( ramBase + NETWAVE_EREG_SPCQ);
357 wstats->qual.level = readb( ramBase + NETWAVE_EREG_ISPLQ);
358 wstats->qual.noise = readb( ramBase + NETWAVE_EREG_SPU) & 0x3f;
359 wstats->discard.nwid = 0L;
360 wstats->discard.code = 0L;
361 wstats->discard.misc = 0L;
363 spin_unlock_irqrestore(&priv->spinlock, flags);
365 return &priv->iw_stats;
369 * Function netwave_attach (void)
371 * Creates an "instance" of the driver, allocating local data
372 * structures for one device. The device is registered with Card
375 * The dev_link structure is initialized, but we don't actually
376 * configure the card at this point -- we wait until we receive a
377 * card insertion event.
379 static int netwave_probe(struct pcmcia_device *link)
381 struct net_device *dev;
382 netwave_private *priv;
384 DEBUG(0, "netwave_attach()\n");
386 /* Initialize the struct pcmcia_device structure */
387 dev = alloc_etherdev(sizeof(netwave_private));
390 priv = netdev_priv(dev);
394 /* The io structure describes IO port mapping */
395 link->io.NumPorts1 = 16;
396 link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
397 /* link->io.NumPorts2 = 16;
398 link->io.Attributes2 = IO_DATA_PATH_WIDTH_16; */
399 link->io.IOAddrLines = 5;
401 /* Interrupt setup */
402 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
403 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
404 link->irq.Handler = &netwave_interrupt;
406 /* General socket configuration */
407 link->conf.Attributes = CONF_ENABLE_IRQ;
408 link->conf.IntType = INT_MEMORY_AND_IO;
409 link->conf.ConfigIndex = 1;
410 link->conf.Present = PRESENT_OPTION;
412 /* Netwave private struct init. link/dev/node already taken care of,
413 * other stuff zero'd - Jean II */
414 spin_lock_init(&priv->spinlock);
416 /* Netwave specific entries in the device structure */
417 SET_MODULE_OWNER(dev);
418 dev->hard_start_xmit = &netwave_start_xmit;
419 dev->get_stats = &netwave_get_stats;
420 dev->set_multicast_list = &set_multicast_list;
421 /* wireless extensions */
422 dev->wireless_handlers = (struct iw_handler_def *)&netwave_handler_def;
424 dev->tx_timeout = &netwave_watchdog;
425 dev->watchdog_timeo = TX_TIMEOUT;
427 dev->open = &netwave_open;
428 dev->stop = &netwave_close;
429 link->irq.Instance = dev;
431 return netwave_pcmcia_config( link);
432 } /* netwave_attach */
435 * Function netwave_detach (link)
437 * This deletes a driver "instance". The device is de-registered
438 * with Card Services. If it has been released, all local data
439 * structures are freed. Otherwise, the structures will be freed
440 * when the device is released.
442 static void netwave_detach(struct pcmcia_device *link)
444 struct net_device *dev = link->priv;
446 DEBUG(0, "netwave_detach(0x%p)\n", link);
448 netwave_release(link);
451 unregister_netdev(dev);
454 } /* netwave_detach */
457 * Wireless Handler : get protocol name
459 static int netwave_get_name(struct net_device *dev,
460 struct iw_request_info *info,
461 union iwreq_data *wrqu,
464 strcpy(wrqu->name, "Netwave");
469 * Wireless Handler : set Network ID
471 static int netwave_set_nwid(struct net_device *dev,
472 struct iw_request_info *info,
473 union iwreq_data *wrqu,
477 kio_addr_t iobase = dev->base_addr;
478 netwave_private *priv = netdev_priv(dev);
479 u_char __iomem *ramBase = priv->ramBase;
481 /* Disable interrupts & save flags */
482 spin_lock_irqsave(&priv->spinlock, flags);
484 if(!wrqu->nwid.disabled) {
485 domain = wrqu->nwid.value;
486 printk( KERN_DEBUG "Setting domain to 0x%x%02x\n",
487 (domain >> 8) & 0x01, domain & 0xff);
489 writeb(NETWAVE_CMD_SMD, ramBase + NETWAVE_EREG_CB + 0);
490 writeb( domain & 0xff, ramBase + NETWAVE_EREG_CB + 1);
491 writeb((domain >>8 ) & 0x01,ramBase + NETWAVE_EREG_CB+2);
492 writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 3);
495 /* ReEnable interrupts & restore flags */
496 spin_unlock_irqrestore(&priv->spinlock, flags);
502 * Wireless Handler : get Network ID
504 static int netwave_get_nwid(struct net_device *dev,
505 struct iw_request_info *info,
506 union iwreq_data *wrqu,
509 wrqu->nwid.value = domain;
510 wrqu->nwid.disabled = 0;
511 wrqu->nwid.fixed = 1;
516 * Wireless Handler : set scramble key
518 static int netwave_set_scramble(struct net_device *dev,
519 struct iw_request_info *info,
520 union iwreq_data *wrqu,
524 kio_addr_t iobase = dev->base_addr;
525 netwave_private *priv = netdev_priv(dev);
526 u_char __iomem *ramBase = priv->ramBase;
528 /* Disable interrupts & save flags */
529 spin_lock_irqsave(&priv->spinlock, flags);
531 scramble_key = (key[0] << 8) | key[1];
533 writeb(NETWAVE_CMD_SSK, ramBase + NETWAVE_EREG_CB + 0);
534 writeb(scramble_key & 0xff, ramBase + NETWAVE_EREG_CB + 1);
535 writeb((scramble_key>>8) & 0xff, ramBase + NETWAVE_EREG_CB + 2);
536 writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 3);
538 /* ReEnable interrupts & restore flags */
539 spin_unlock_irqrestore(&priv->spinlock, flags);
545 * Wireless Handler : get scramble key
547 static int netwave_get_scramble(struct net_device *dev,
548 struct iw_request_info *info,
549 union iwreq_data *wrqu,
552 key[1] = scramble_key & 0xff;
553 key[0] = (scramble_key>>8) & 0xff;
554 wrqu->encoding.flags = IW_ENCODE_ENABLED;
555 wrqu->encoding.length = 2;
560 * Wireless Handler : get mode
562 static int netwave_get_mode(struct net_device *dev,
563 struct iw_request_info *info,
564 union iwreq_data *wrqu,
568 wrqu->mode = IW_MODE_INFRA;
570 wrqu->mode = IW_MODE_ADHOC;
576 * Wireless Handler : get range info
578 static int netwave_get_range(struct net_device *dev,
579 struct iw_request_info *info,
580 union iwreq_data *wrqu,
583 struct iw_range *range = (struct iw_range *) extra;
586 /* Set the length (very important for backward compatibility) */
587 wrqu->data.length = sizeof(struct iw_range);
589 /* Set all the info we don't care or don't know about to zero */
590 memset(range, 0, sizeof(struct iw_range));
592 /* Set the Wireless Extension versions */
593 range->we_version_compiled = WIRELESS_EXT;
594 range->we_version_source = 9; /* Nothing for us in v10 and v11 */
596 /* Set information in the range struct */
597 range->throughput = 450 * 1000; /* don't argue on this ! */
598 range->min_nwid = 0x0000;
599 range->max_nwid = 0x01FF;
601 range->num_channels = range->num_frequency = 0;
603 range->sensitivity = 0x3F;
604 range->max_qual.qual = 255;
605 range->max_qual.level = 255;
606 range->max_qual.noise = 0;
608 range->num_bitrates = 1;
609 range->bitrate[0] = 1000000; /* 1 Mb/s */
611 range->encoding_size[0] = 2; /* 16 bits scrambling */
612 range->num_encoding_sizes = 1;
613 range->max_encoding_tokens = 1; /* Only one key possible */
619 * Wireless Private Handler : get snapshot
621 static int netwave_get_snap(struct net_device *dev,
622 struct iw_request_info *info,
623 union iwreq_data *wrqu,
627 kio_addr_t iobase = dev->base_addr;
628 netwave_private *priv = netdev_priv(dev);
629 u_char __iomem *ramBase = priv->ramBase;
631 /* Disable interrupts & save flags */
632 spin_lock_irqsave(&priv->spinlock, flags);
634 /* Take snapshot of environment */
635 netwave_snapshot( priv, ramBase, iobase);
636 wrqu->data.length = priv->nss.length;
637 memcpy(extra, (u_char *) &priv->nss, sizeof( struct site_survey));
639 priv->lastExec = jiffies;
641 /* ReEnable interrupts & restore flags */
642 spin_unlock_irqrestore(&priv->spinlock, flags);
648 * Structures to export the Wireless Handlers
649 * This is the stuff that are treated the wireless extensions (iwconfig)
652 static const struct iw_priv_args netwave_private_args[] = {
653 /*{ cmd, set_args, get_args, name } */
655 IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | sizeof(struct site_survey),
659 static const iw_handler netwave_handler[] =
661 NULL, /* SIOCSIWNAME */
662 netwave_get_name, /* SIOCGIWNAME */
663 netwave_set_nwid, /* SIOCSIWNWID */
664 netwave_get_nwid, /* SIOCGIWNWID */
665 NULL, /* SIOCSIWFREQ */
666 NULL, /* SIOCGIWFREQ */
667 NULL, /* SIOCSIWMODE */
668 netwave_get_mode, /* SIOCGIWMODE */
669 NULL, /* SIOCSIWSENS */
670 NULL, /* SIOCGIWSENS */
671 NULL, /* SIOCSIWRANGE */
672 netwave_get_range, /* SIOCGIWRANGE */
673 NULL, /* SIOCSIWPRIV */
674 NULL, /* SIOCGIWPRIV */
675 NULL, /* SIOCSIWSTATS */
676 NULL, /* SIOCGIWSTATS */
677 NULL, /* SIOCSIWSPY */
678 NULL, /* SIOCGIWSPY */
679 NULL, /* -- hole -- */
680 NULL, /* -- hole -- */
681 NULL, /* SIOCSIWAP */
682 NULL, /* SIOCGIWAP */
683 NULL, /* -- hole -- */
684 NULL, /* SIOCGIWAPLIST */
685 NULL, /* -- hole -- */
686 NULL, /* -- hole -- */
687 NULL, /* SIOCSIWESSID */
688 NULL, /* SIOCGIWESSID */
689 NULL, /* SIOCSIWNICKN */
690 NULL, /* SIOCGIWNICKN */
691 NULL, /* -- hole -- */
692 NULL, /* -- hole -- */
693 NULL, /* SIOCSIWRATE */
694 NULL, /* SIOCGIWRATE */
695 NULL, /* SIOCSIWRTS */
696 NULL, /* SIOCGIWRTS */
697 NULL, /* SIOCSIWFRAG */
698 NULL, /* SIOCGIWFRAG */
699 NULL, /* SIOCSIWTXPOW */
700 NULL, /* SIOCGIWTXPOW */
701 NULL, /* SIOCSIWRETRY */
702 NULL, /* SIOCGIWRETRY */
703 netwave_set_scramble, /* SIOCSIWENCODE */
704 netwave_get_scramble, /* SIOCGIWENCODE */
707 static const iw_handler netwave_private_handler[] =
709 NULL, /* SIOCIWFIRSTPRIV */
710 netwave_get_snap, /* SIOCIWFIRSTPRIV + 1 */
713 static const struct iw_handler_def netwave_handler_def =
715 .num_standard = sizeof(netwave_handler)/sizeof(iw_handler),
716 .num_private = sizeof(netwave_private_handler)/sizeof(iw_handler),
717 .num_private_args = sizeof(netwave_private_args)/sizeof(struct iw_priv_args),
718 .standard = (iw_handler *) netwave_handler,
719 .private = (iw_handler *) netwave_private_handler,
720 .private_args = (struct iw_priv_args *) netwave_private_args,
721 .get_wireless_stats = netwave_get_wireless_stats,
725 * Function netwave_pcmcia_config (link)
727 * netwave_pcmcia_config() is scheduled to run after a CARD_INSERTION
728 * event is received, to configure the PCMCIA socket, and to make the
729 * device available to the system.
733 #define CS_CHECK(fn, ret) \
734 do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
736 static int netwave_pcmcia_config(struct pcmcia_device *link) {
737 struct net_device *dev = link->priv;
738 netwave_private *priv = netdev_priv(dev);
741 int i, j, last_ret, last_fn;
745 u_char __iomem *ramBase = NULL;
747 DEBUG(0, "netwave_pcmcia_config(0x%p)\n", link);
750 This reads the card's CONFIG tuple to find its configuration
753 tuple.Attributes = 0;
754 tuple.TupleData = (cisdata_t *) buf;
755 tuple.TupleDataMax = 64;
756 tuple.TupleOffset = 0;
757 tuple.DesiredTuple = CISTPL_CONFIG;
758 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
759 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
760 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse));
761 link->conf.ConfigBase = parse.config.base;
762 link->conf.Present = parse.config.rmask[0];
765 * Try allocating IO ports. This tries a few fixed addresses.
766 * If you want, you can also read the card's config table to
767 * pick addresses -- see the serial driver for an example.
769 for (i = j = 0x0; j < 0x400; j += 0x20) {
770 link->io.BasePort1 = j ^ 0x300;
771 i = pcmcia_request_io(link, &link->io);
772 if (i == CS_SUCCESS) break;
774 if (i != CS_SUCCESS) {
775 cs_error(link, RequestIO, i);
780 * Now allocate an interrupt line. Note that this does not
781 * actually assign a handler to the interrupt.
783 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
786 * This actually configures the PCMCIA socket -- setting up
787 * the I/O windows and the interrupt mapping.
789 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
792 * Allocate a 32K memory window. Note that the struct pcmcia_device
793 * structure provides space for one window handle -- if your
794 * device needs several windows, you'll need to keep track of
795 * the handles in your private data structure, dev->priv.
797 DEBUG(1, "Setting mem speed of %d\n", mem_speed);
799 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_CM|WIN_ENABLE;
800 req.Base = 0; req.Size = 0x8000;
801 req.AccessSpeed = mem_speed;
802 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win));
803 mem.CardOffset = 0x20000; mem.Page = 0;
804 CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem));
806 /* Store base address of the common window frame */
807 ramBase = ioremap(req.Base, 0x8000);
808 priv->ramBase = ramBase;
810 dev->irq = link->irq.AssignedIRQ;
811 dev->base_addr = link->io.BasePort1;
812 SET_NETDEV_DEV(dev, &handle_to_dev(link));
814 if (register_netdev(dev) != 0) {
815 printk(KERN_DEBUG "netwave_cs: register_netdev() failed\n");
819 strcpy(priv->node.dev_name, dev->name);
820 link->dev_node = &priv->node;
822 /* Reset card before reading physical address */
823 netwave_doreset(dev->base_addr, ramBase);
825 /* Read the ethernet address and fill in the Netwave registers. */
826 for (i = 0; i < 6; i++)
827 dev->dev_addr[i] = readb(ramBase + NETWAVE_EREG_PA + i);
829 printk(KERN_INFO "%s: Netwave: port %#3lx, irq %d, mem %lx id "
830 "%c%c, hw_addr ", dev->name, dev->base_addr, dev->irq,
831 (u_long) ramBase, (int) readb(ramBase+NETWAVE_EREG_NI),
832 (int) readb(ramBase+NETWAVE_EREG_NI+1));
833 for (i = 0; i < 6; i++)
834 printk("%02X%s", dev->dev_addr[i], ((i<5) ? ":" : "\n"));
836 /* get revision words */
837 printk(KERN_DEBUG "Netwave_reset: revision %04x %04x\n",
838 get_uint16(ramBase + NETWAVE_EREG_ARW),
839 get_uint16(ramBase + NETWAVE_EREG_ARW+2));
843 cs_error(link, last_fn, last_ret);
845 netwave_release(link);
847 } /* netwave_pcmcia_config */
850 * Function netwave_release (arg)
852 * After a card is removed, netwave_release() will unregister the net
853 * device, and release the PCMCIA configuration. If the device is
854 * still open, this will be postponed until it is closed.
856 static void netwave_release(struct pcmcia_device *link)
858 struct net_device *dev = link->priv;
859 netwave_private *priv = netdev_priv(dev);
861 DEBUG(0, "netwave_release(0x%p)\n", link);
863 pcmcia_disable_device(link);
865 iounmap(priv->ramBase);
868 static int netwave_suspend(struct pcmcia_device *link)
870 struct net_device *dev = link->priv;
873 netif_device_detach(dev);
878 static int netwave_resume(struct pcmcia_device *link)
880 struct net_device *dev = link->priv;
884 netif_device_attach(dev);
892 * Function netwave_doreset (ioBase, ramBase)
894 * Proper hardware reset of the card.
896 static void netwave_doreset(kio_addr_t ioBase, u_char __iomem *ramBase)
900 outb(0x80, ioBase + NETWAVE_REG_PMR);
901 writeb(0x08, ramBase + NETWAVE_EREG_ASCC); /* Bit 3 is WOC */
902 outb(0x0, ioBase + NETWAVE_REG_PMR); /* release reset */
906 * Function netwave_reset (dev)
908 * Reset and restore all of the netwave registers
910 static void netwave_reset(struct net_device *dev) {
912 netwave_private *priv = netdev_priv(dev);
913 u_char __iomem *ramBase = priv->ramBase;
914 kio_addr_t iobase = dev->base_addr;
916 DEBUG(0, "netwave_reset: Done with hardware reset\n");
918 priv->timeoutCounter = 0;
921 netwave_doreset(iobase, ramBase);
922 printk(KERN_DEBUG "netwave_reset: Done with hardware reset\n");
924 /* Write a NOP to check the card */
926 writeb(NETWAVE_CMD_NOP, ramBase + NETWAVE_EREG_CB + 0);
927 writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 1);
929 /* Set receive conf */
931 writeb(NETWAVE_CMD_SRC, ramBase + NETWAVE_EREG_CB + 0);
932 writeb(rxConfRxEna + rxConfBcast, ramBase + NETWAVE_EREG_CB + 1);
933 writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 2);
935 /* Set transmit conf */
937 writeb(NETWAVE_CMD_STC, ramBase + NETWAVE_EREG_CB + 0);
938 writeb(txConfTxEna, ramBase + NETWAVE_EREG_CB + 1);
939 writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 2);
941 /* Now set the MU Domain */
942 printk(KERN_DEBUG "Setting domain to 0x%x%02x\n", (domain >> 8) & 0x01, domain & 0xff);
944 writeb(NETWAVE_CMD_SMD, ramBase + NETWAVE_EREG_CB + 0);
945 writeb(domain & 0xff, ramBase + NETWAVE_EREG_CB + 1);
946 writeb((domain>>8) & 0x01, ramBase + NETWAVE_EREG_CB + 2);
947 writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 3);
949 /* Set scramble key */
950 printk(KERN_DEBUG "Setting scramble key to 0x%x\n", scramble_key);
952 writeb(NETWAVE_CMD_SSK, ramBase + NETWAVE_EREG_CB + 0);
953 writeb(scramble_key & 0xff, ramBase + NETWAVE_EREG_CB + 1);
954 writeb((scramble_key>>8) & 0xff, ramBase + NETWAVE_EREG_CB + 2);
955 writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 3);
957 /* Enable interrupts, bit 4 high to keep unused
958 * source from interrupting us, bit 2 high to
959 * set interrupt enable, 567 to enable TxDN,
963 outb(imrConfIENA+imrConfRFU1, iobase + NETWAVE_REG_IMR);
965 /* Hent 4 bytes fra 0x170. Skal vaere 0a,29,88,36
967 * skriv 80 til d000:3688
968 * sjekk om det ble 80
971 /* Enable Receiver */
973 writeb(NETWAVE_CMD_ER, ramBase + NETWAVE_EREG_CB + 0);
974 writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 1);
976 /* Set the IENA bit in COR */
978 outb(corConfIENA + corConfLVLREQ, iobase + NETWAVE_REG_COR);
982 * Function netwave_hw_xmit (data, len, dev)
984 static int netwave_hw_xmit(unsigned char* data, int len,
985 struct net_device* dev) {
987 unsigned int TxFreeList,
993 netwave_private *priv = netdev_priv(dev);
994 u_char __iomem * ramBase = priv->ramBase;
995 kio_addr_t iobase = dev->base_addr;
997 /* Disable interrupts & save flags */
998 spin_lock_irqsave(&priv->spinlock, flags);
1000 /* Check if there are transmit buffers available */
1002 if ((inb(iobase+NETWAVE_REG_ASR) & NETWAVE_ASR_TXBA) == 0) {
1003 /* No buffers available */
1004 printk(KERN_DEBUG "netwave_hw_xmit: %s - no xmit buffers available.\n",
1006 spin_unlock_irqrestore(&priv->spinlock, flags);
1010 priv->stats.tx_bytes += len;
1012 DEBUG(3, "Transmitting with SPCQ %x SPU %x LIF %x ISPLQ %x\n",
1013 readb(ramBase + NETWAVE_EREG_SPCQ),
1014 readb(ramBase + NETWAVE_EREG_SPU),
1015 readb(ramBase + NETWAVE_EREG_LIF),
1016 readb(ramBase + NETWAVE_EREG_ISPLQ));
1018 /* Now try to insert it into the adapters free memory */
1020 TxFreeList = get_uint16(ramBase + NETWAVE_EREG_TDP);
1021 MaxData = get_uint16(ramBase + NETWAVE_EREG_TDP+2);
1022 DataOffset = get_uint16(ramBase + NETWAVE_EREG_TDP+4);
1024 DEBUG(3, "TxFreeList %x, MaxData %x, DataOffset %x\n",
1025 TxFreeList, MaxData, DataOffset);
1027 /* Copy packet to the adapter fragment buffers */
1028 curBuff = TxFreeList;
1030 while (tmpcount < len) {
1031 int tmplen = len - tmpcount;
1032 copy_to_pc(ramBase + curBuff + DataOffset, data + tmpcount,
1033 (tmplen < MaxData) ? tmplen : MaxData);
1034 tmpcount += MaxData;
1036 /* Advance to next buffer */
1037 curBuff = get_uint16(ramBase + curBuff);
1040 /* Now issue transmit list */
1042 writeb(NETWAVE_CMD_TL, ramBase + NETWAVE_EREG_CB + 0);
1043 writeb(len & 0xff, ramBase + NETWAVE_EREG_CB + 1);
1044 writeb((len>>8) & 0xff, ramBase + NETWAVE_EREG_CB + 2);
1045 writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 3);
1047 spin_unlock_irqrestore(&priv->spinlock, flags);
1051 static int netwave_start_xmit(struct sk_buff *skb, struct net_device *dev) {
1052 /* This flag indicate that the hardware can't perform a transmission.
1053 * Theoritically, NET3 check it before sending a packet to the driver,
1054 * but in fact it never do that and pool continuously.
1055 * As the watchdog will abort too long transmissions, we are quite safe...
1058 netif_stop_queue(dev);
1061 short length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLEN;
1062 unsigned char* buf = skb->data;
1064 if (netwave_hw_xmit( buf, length, dev) == 1) {
1065 /* Some error, let's make them call us another time? */
1066 netif_start_queue(dev);
1068 dev->trans_start = jiffies;
1073 } /* netwave_start_xmit */
1076 * Function netwave_interrupt (irq, dev_id, regs)
1078 * This function is the interrupt handler for the Netwave card. This
1079 * routine will be called whenever:
1080 * 1. A packet is received.
1081 * 2. A packet has successfully been transferred and the unit is
1082 * ready to transmit another packet.
1083 * 3. A command has completed execution.
1085 static irqreturn_t netwave_interrupt(int irq, void* dev_id, struct pt_regs *regs)
1088 u_char __iomem *ramBase;
1089 struct net_device *dev = (struct net_device *)dev_id;
1090 struct netwave_private *priv = netdev_priv(dev);
1091 struct pcmcia_device *link = priv->p_dev;
1094 if (!netif_device_present(dev))
1097 iobase = dev->base_addr;
1098 ramBase = priv->ramBase;
1100 /* Now find what caused the interrupt, check while interrupts ready */
1101 for (i = 0; i < 10; i++) {
1105 if (!(inb(iobase+NETWAVE_REG_CCSR) & 0x02))
1106 break; /* None of the interrupt sources asserted (normal exit) */
1108 status = inb(iobase + NETWAVE_REG_ASR);
1110 if (!pcmcia_dev_present(link)) {
1111 DEBUG(1, "netwave_interrupt: Interrupt with status 0x%x "
1112 "from removed or suspended card!\n", status);
1117 if (status & 0x80) {
1119 /* wait_WOC(iobase); */
1120 /* RxRdy cannot be reset directly by the host */
1123 if (status & 0x40) {
1126 rser = readb(ramBase + NETWAVE_EREG_RSER);
1129 ++priv->stats.rx_dropped;
1130 ++priv->stats.rx_crc_errors;
1133 ++priv->stats.rx_frame_errors;
1135 /* Clear the RxErr bit in RSER. RSER+4 is the
1136 * write part. Also clear the RxCRC (0x04) and
1137 * RxBig (0x02) bits if present */
1139 writeb(0x40 | (rser & 0x06), ramBase + NETWAVE_EREG_RSER + 4);
1141 /* Write bit 6 high to ASCC to clear RxErr in ASR,
1142 * WOC must be set first!
1145 writeb(0x40, ramBase + NETWAVE_EREG_ASCC);
1147 /* Remember to count up priv->stats on error packets */
1148 ++priv->stats.rx_errors;
1151 if (status & 0x20) {
1154 txStatus = readb(ramBase + NETWAVE_EREG_TSER);
1155 DEBUG(3, "Transmit done. TSER = %x id %x\n",
1156 txStatus, readb(ramBase + NETWAVE_EREG_TSER + 1));
1158 if (txStatus & 0x20) {
1159 /* Transmitting was okay, clear bits */
1161 writeb(0x2f, ramBase + NETWAVE_EREG_TSER + 4);
1162 ++priv->stats.tx_packets;
1165 if (txStatus & 0xd0) {
1166 if (txStatus & 0x80) {
1167 ++priv->stats.collisions; /* Because of /proc/net/dev*/
1168 /* ++priv->stats.tx_aborted_errors; */
1169 /* printk("Collision. %ld\n", jiffies - dev->trans_start); */
1171 if (txStatus & 0x40)
1172 ++priv->stats.tx_carrier_errors;
1173 /* 0x80 TxGU Transmit giveup - nine times and no luck
1174 * 0x40 TxNOAP No access point. Discarded packet.
1175 * 0x10 TxErr Transmit error. Always set when
1176 * TxGU and TxNOAP is set. (Those are the only ones
1179 DEBUG(3, "netwave_interrupt: TxDN with error status %x\n",
1182 /* Clear out TxGU, TxNOAP, TxErr and TxTrys */
1184 writeb(0xdf & txStatus, ramBase+NETWAVE_EREG_TSER+4);
1185 ++priv->stats.tx_errors;
1187 DEBUG(3, "New status is TSER %x ASR %x\n",
1188 readb(ramBase + NETWAVE_EREG_TSER),
1189 inb(iobase + NETWAVE_REG_ASR));
1191 netif_wake_queue(dev);
1193 /* TxBA, this would trigger on all error packets received */
1194 /* if (status & 0x01) {
1195 DEBUG(4, "Transmit buffers available, %x\n", status);
1199 /* Handled if we looped at least one time - Jean II */
1200 return IRQ_RETVAL(i);
1201 } /* netwave_interrupt */
1204 * Function netwave_watchdog (a)
1206 * Watchdog : when we start a transmission, we set a timer in the
1207 * kernel. If the transmission complete, this timer is disabled. If
1208 * it expire, we reset the card.
1211 static void netwave_watchdog(struct net_device *dev) {
1213 DEBUG(1, "%s: netwave_watchdog: watchdog timer expired\n", dev->name);
1215 dev->trans_start = jiffies;
1216 netif_wake_queue(dev);
1217 } /* netwave_watchdog */
1219 static struct net_device_stats *netwave_get_stats(struct net_device *dev) {
1220 netwave_private *priv = netdev_priv(dev);
1224 DEBUG(2, "netwave: SPCQ %x SPU %x LIF %x ISPLQ %x MHS %x rxtx %x"
1225 " %x tx %x %x %x %x\n",
1226 readb(priv->ramBase + NETWAVE_EREG_SPCQ),
1227 readb(priv->ramBase + NETWAVE_EREG_SPU),
1228 readb(priv->ramBase + NETWAVE_EREG_LIF),
1229 readb(priv->ramBase + NETWAVE_EREG_ISPLQ),
1230 readb(priv->ramBase + NETWAVE_EREG_MHS),
1231 readb(priv->ramBase + NETWAVE_EREG_EC + 0xe),
1232 readb(priv->ramBase + NETWAVE_EREG_EC + 0xf),
1233 readb(priv->ramBase + NETWAVE_EREG_EC + 0x18),
1234 readb(priv->ramBase + NETWAVE_EREG_EC + 0x19),
1235 readb(priv->ramBase + NETWAVE_EREG_EC + 0x1a),
1236 readb(priv->ramBase + NETWAVE_EREG_EC + 0x1b));
1238 return &priv->stats;
1241 static void update_stats(struct net_device *dev) {
1242 //unsigned long flags;
1243 /* netwave_private *priv = netdev_priv(dev); */
1245 //spin_lock_irqsave(&priv->spinlock, flags);
1247 /* priv->stats.rx_packets = readb(priv->ramBase + 0x18e);
1248 priv->stats.tx_packets = readb(priv->ramBase + 0x18f); */
1250 //spin_unlock_irqrestore(&priv->spinlock, flags);
1253 static int netwave_rx(struct net_device *dev)
1255 netwave_private *priv = netdev_priv(dev);
1256 u_char __iomem *ramBase = priv->ramBase;
1257 kio_addr_t iobase = dev->base_addr;
1259 struct sk_buff *skb = NULL;
1260 unsigned int curBuffer,
1264 int dataCount, dataOffset;
1268 DEBUG(3, "xinw_rx: Receiving ... \n");
1270 /* Receive max 10 packets for now. */
1271 for (i = 0; i < 10; i++) {
1274 rxStatus = readb(ramBase + NETWAVE_EREG_RSER);
1275 if ( !( rxStatus & 0x80)) /* No more packets */
1278 /* Check if multicast/broadcast or other */
1279 /* multicast = (rxStatus & 0x20); */
1281 /* The receive list pointer and length of the packet */
1283 rcvLen = get_int16( ramBase + NETWAVE_EREG_RDP);
1284 rcvList = get_uint16( ramBase + NETWAVE_EREG_RDP + 2);
1287 printk(KERN_DEBUG "netwave_rx: Receive packet with len %d\n",
1292 skb = dev_alloc_skb(rcvLen+5);
1294 DEBUG(1, "netwave_rx: Could not allocate an sk_buff of "
1295 "length %d\n", rcvLen);
1296 ++priv->stats.rx_dropped;
1297 /* Tell the adapter to skip the packet */
1299 writeb(NETWAVE_CMD_SRP, ramBase + NETWAVE_EREG_CB + 0);
1300 writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 1);
1304 skb_reserve( skb, 2); /* Align IP on 16 byte */
1305 skb_put( skb, rcvLen);
1308 /* Copy packet fragments to the skb data area */
1309 ptr = (u_char*) skb->data;
1310 curBuffer = rcvList;
1312 while ( tmpcount < rcvLen) {
1313 /* Get length and offset of current buffer */
1314 dataCount = get_uint16( ramBase+curBuffer+2);
1315 dataOffset = get_uint16( ramBase+curBuffer+4);
1317 copy_from_pc( ptr + tmpcount,
1318 ramBase+curBuffer+dataOffset, dataCount);
1320 tmpcount += dataCount;
1322 /* Point to next buffer */
1323 curBuffer = get_uint16(ramBase + curBuffer);
1326 skb->protocol = eth_type_trans(skb,dev);
1327 /* Queue packet for network layer */
1330 dev->last_rx = jiffies;
1331 priv->stats.rx_packets++;
1332 priv->stats.rx_bytes += rcvLen;
1334 /* Got the packet, tell the adapter to skip it */
1336 writeb(NETWAVE_CMD_SRP, ramBase + NETWAVE_EREG_CB + 0);
1337 writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 1);
1338 DEBUG(3, "Packet reception ok\n");
1343 static int netwave_open(struct net_device *dev) {
1344 netwave_private *priv = netdev_priv(dev);
1345 struct pcmcia_device *link = priv->p_dev;
1347 DEBUG(1, "netwave_open: starting.\n");
1349 if (!pcmcia_dev_present(link))
1354 netif_start_queue(dev);
1360 static int netwave_close(struct net_device *dev) {
1361 netwave_private *priv = netdev_priv(dev);
1362 struct pcmcia_device *link = priv->p_dev;
1364 DEBUG(1, "netwave_close: finishing.\n");
1367 netif_stop_queue(dev);
1372 static struct pcmcia_device_id netwave_ids[] = {
1373 PCMCIA_DEVICE_PROD_ID12("Xircom", "CreditCard Netwave", 0x2e3ee845, 0x54e28a28),
1376 MODULE_DEVICE_TABLE(pcmcia, netwave_ids);
1378 static struct pcmcia_driver netwave_driver = {
1379 .owner = THIS_MODULE,
1381 .name = "netwave_cs",
1383 .probe = netwave_probe,
1384 .remove = netwave_detach,
1385 .id_table = netwave_ids,
1386 .suspend = netwave_suspend,
1387 .resume = netwave_resume,
1390 static int __init init_netwave_cs(void)
1392 return pcmcia_register_driver(&netwave_driver);
1395 static void __exit exit_netwave_cs(void)
1397 pcmcia_unregister_driver(&netwave_driver);
1400 module_init(init_netwave_cs);
1401 module_exit(exit_netwave_cs);
1403 /* Set or clear the multicast filter for this adaptor.
1404 num_addrs == -1 Promiscuous mode, receive all packets
1405 num_addrs == 0 Normal mode, clear multicast list
1406 num_addrs > 0 Multicast mode, receive normal and MC packets, and do
1407 best-effort filtering.
1409 static void set_multicast_list(struct net_device *dev)
1411 kio_addr_t iobase = dev->base_addr;
1412 netwave_private *priv = netdev_priv(dev);
1413 u_char __iomem * ramBase = priv->ramBase;
1419 if (old != dev->mc_count) {
1420 old = dev->mc_count;
1421 DEBUG(0, "%s: setting Rx mode to %d addresses.\n",
1422 dev->name, dev->mc_count);
1427 if (dev->mc_count || (dev->flags & IFF_ALLMULTI)) {
1428 /* Multicast Mode */
1429 rcvMode = rxConfRxEna + rxConfAMP + rxConfBcast;
1430 } else if (dev->flags & IFF_PROMISC) {
1431 /* Promiscous mode */
1432 rcvMode = rxConfRxEna + rxConfPro + rxConfAMP + rxConfBcast;
1435 rcvMode = rxConfRxEna + rxConfBcast;
1438 /* printk("netwave set_multicast_list: rcvMode to %x\n", rcvMode);*/
1439 /* Now set receive mode */
1441 writeb(NETWAVE_CMD_SRC, ramBase + NETWAVE_EREG_CB + 0);
1442 writeb(rcvMode, ramBase + NETWAVE_EREG_CB + 1);
1443 writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 2);
1445 MODULE_LICENSE("GPL");