3 #include <linux/config.h>
4 #include <linux/module.h>
5 #include <linux/init.h>
7 #include <linux/wait.h>
8 #include <linux/timer.h>
9 #include <linux/skbuff.h>
10 #include <linux/netdevice.h>
11 #include <linux/workqueue.h>
12 #include <linux/wireless.h>
13 #include <net/iw_handler.h>
15 #include <pcmcia/cs_types.h>
16 #include <pcmcia/cs.h>
17 #include <pcmcia/cistpl.h>
18 #include <pcmcia/cisreg.h>
19 #include <pcmcia/ds.h>
23 #include "hostap_wlan.h"
26 static char *version = PRISM2_VERSION " (Jouni Malinen <jkmaline@cc.hut.fi>)";
27 static dev_info_t dev_info = "hostap_cs";
29 MODULE_AUTHOR("Jouni Malinen");
30 MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN "
32 MODULE_SUPPORTED_DEVICE("Intersil Prism2-based WLAN cards (PC Card)");
33 MODULE_LICENSE("GPL");
34 MODULE_VERSION(PRISM2_VERSION);
37 static int ignore_cis_vcc;
38 module_param(ignore_cis_vcc, int, 0444);
39 MODULE_PARM_DESC(ignore_cis_vcc, "Ignore broken CIS VCC entry");
42 /* struct local_info::hw_priv */
43 struct hostap_cs_priv {
45 struct pcmcia_device *link;
46 int sandisk_connectplus;
50 #ifdef PRISM2_IO_DEBUG
52 static inline void hfa384x_outb_debug(struct net_device *dev, int a, u8 v)
54 struct hostap_interface *iface;
58 iface = netdev_priv(dev);
60 spin_lock_irqsave(&local->lock, flags);
61 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTB, a, v);
62 outb(v, dev->base_addr + a);
63 spin_unlock_irqrestore(&local->lock, flags);
66 static inline u8 hfa384x_inb_debug(struct net_device *dev, int a)
68 struct hostap_interface *iface;
73 iface = netdev_priv(dev);
75 spin_lock_irqsave(&local->lock, flags);
76 v = inb(dev->base_addr + a);
77 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INB, a, v);
78 spin_unlock_irqrestore(&local->lock, flags);
82 static inline void hfa384x_outw_debug(struct net_device *dev, int a, u16 v)
84 struct hostap_interface *iface;
88 iface = netdev_priv(dev);
90 spin_lock_irqsave(&local->lock, flags);
91 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTW, a, v);
92 outw(v, dev->base_addr + a);
93 spin_unlock_irqrestore(&local->lock, flags);
96 static inline u16 hfa384x_inw_debug(struct net_device *dev, int a)
98 struct hostap_interface *iface;
103 iface = netdev_priv(dev);
104 local = iface->local;
105 spin_lock_irqsave(&local->lock, flags);
106 v = inw(dev->base_addr + a);
107 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INW, a, v);
108 spin_unlock_irqrestore(&local->lock, flags);
112 static inline void hfa384x_outsw_debug(struct net_device *dev, int a,
115 struct hostap_interface *iface;
119 iface = netdev_priv(dev);
120 local = iface->local;
121 spin_lock_irqsave(&local->lock, flags);
122 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTSW, a, wc);
123 outsw(dev->base_addr + a, buf, wc);
124 spin_unlock_irqrestore(&local->lock, flags);
127 static inline void hfa384x_insw_debug(struct net_device *dev, int a,
130 struct hostap_interface *iface;
134 iface = netdev_priv(dev);
135 local = iface->local;
136 spin_lock_irqsave(&local->lock, flags);
137 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INSW, a, wc);
138 insw(dev->base_addr + a, buf, wc);
139 spin_unlock_irqrestore(&local->lock, flags);
142 #define HFA384X_OUTB(v,a) hfa384x_outb_debug(dev, (a), (v))
143 #define HFA384X_INB(a) hfa384x_inb_debug(dev, (a))
144 #define HFA384X_OUTW(v,a) hfa384x_outw_debug(dev, (a), (v))
145 #define HFA384X_INW(a) hfa384x_inw_debug(dev, (a))
146 #define HFA384X_OUTSW(a, buf, wc) hfa384x_outsw_debug(dev, (a), (buf), (wc))
147 #define HFA384X_INSW(a, buf, wc) hfa384x_insw_debug(dev, (a), (buf), (wc))
149 #else /* PRISM2_IO_DEBUG */
151 #define HFA384X_OUTB(v,a) outb((v), dev->base_addr + (a))
152 #define HFA384X_INB(a) inb(dev->base_addr + (a))
153 #define HFA384X_OUTW(v,a) outw((v), dev->base_addr + (a))
154 #define HFA384X_INW(a) inw(dev->base_addr + (a))
155 #define HFA384X_INSW(a, buf, wc) insw(dev->base_addr + (a), buf, wc)
156 #define HFA384X_OUTSW(a, buf, wc) outsw(dev->base_addr + (a), buf, wc)
158 #endif /* PRISM2_IO_DEBUG */
161 static int hfa384x_from_bap(struct net_device *dev, u16 bap, void *buf,
167 d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF;
171 HFA384X_INSW(d_off, buf, len / 2);
175 *((char *) pos) = HFA384X_INB(d_off);
181 static int hfa384x_to_bap(struct net_device *dev, u16 bap, void *buf, int len)
186 d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF;
190 HFA384X_OUTSW(d_off, buf, len / 2);
194 HFA384X_OUTB(*((char *) pos), d_off);
200 /* FIX: This might change at some point.. */
201 #include "hostap_hw.c"
205 static void prism2_detach(struct pcmcia_device *p_dev);
206 static void prism2_release(u_long arg);
207 static int prism2_config(struct pcmcia_device *link);
210 static int prism2_pccard_card_present(local_info_t *local)
212 struct hostap_cs_priv *hw_priv = local->hw_priv;
213 if (hw_priv != NULL && hw_priv->link != NULL &&
214 ((hw_priv->link->state & (DEV_PRESENT | DEV_CONFIG)) ==
215 (DEV_PRESENT | DEV_CONFIG)))
222 * SanDisk CompactFlash WLAN Flashcard - Product Manual v1.0
223 * Document No. 20-10-00058, January 2004
224 * http://www.sandisk.com/pdf/industrial/ProdManualCFWLANv1.0.pdf
226 #define SANDISK_WLAN_ACTIVATION_OFF 0x40
227 #define SANDISK_HCR_OFF 0x42
230 static void sandisk_set_iobase(local_info_t *local)
234 struct hostap_cs_priv *hw_priv = local->hw_priv;
237 reg.Action = CS_WRITE;
238 reg.Offset = 0x10; /* 0x3f0 IO base 1 */
239 reg.Value = hw_priv->link->io.BasePort1 & 0x00ff;
240 res = pcmcia_access_configuration_register(hw_priv->link,
242 if (res != CS_SUCCESS) {
243 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -"
249 reg.Action = CS_WRITE;
250 reg.Offset = 0x12; /* 0x3f2 IO base 2 */
251 reg.Value = (hw_priv->link->io.BasePort1 & 0xff00) >> 8;
252 res = pcmcia_access_configuration_register(hw_priv->link,
254 if (res != CS_SUCCESS) {
255 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -"
261 static void sandisk_write_hcr(local_info_t *local, int hcr)
263 struct net_device *dev = local->dev;
266 HFA384X_OUTB(0x80, SANDISK_WLAN_ACTIVATION_OFF);
268 for (i = 0; i < 10; i++) {
269 HFA384X_OUTB(hcr, SANDISK_HCR_OFF);
272 HFA384X_OUTB(0x45, SANDISK_WLAN_ACTIVATION_OFF);
276 static int sandisk_enable_wireless(struct net_device *dev)
280 struct hostap_interface *iface = dev->priv;
281 local_info_t *local = iface->local;
283 cisparse_t *parse = NULL;
285 struct hostap_cs_priv *hw_priv = local->hw_priv;
287 if (hw_priv->link->io.NumPorts1 < 0x42) {
288 /* Not enough ports to be SanDisk multi-function card */
293 parse = kmalloc(sizeof(cisparse_t), GFP_KERNEL);
299 tuple.DesiredTuple = CISTPL_MANFID;
300 tuple.Attributes = TUPLE_RETURN_COMMON;
301 tuple.TupleData = buf;
302 tuple.TupleDataMax = sizeof(buf);
303 tuple.TupleOffset = 0;
304 if (pcmcia_get_first_tuple(hw_priv->link, &tuple) ||
305 pcmcia_get_tuple_data(hw_priv->link, &tuple) ||
306 pcmcia_parse_tuple(hw_priv->link, &tuple, parse) ||
307 parse->manfid.manf != 0xd601 || parse->manfid.card != 0x0101) {
308 /* No SanDisk manfid found */
313 tuple.DesiredTuple = CISTPL_LONGLINK_MFC;
314 if (pcmcia_get_first_tuple(hw_priv->link, &tuple) ||
315 pcmcia_get_tuple_data(hw_priv->link, &tuple) ||
316 pcmcia_parse_tuple(hw_priv->link, &tuple, parse) ||
317 parse->longlink_mfc.nfn < 2) {
318 /* No multi-function links found */
323 printk(KERN_DEBUG "%s: Multi-function SanDisk ConnectPlus detected"
324 " - using vendor-specific initialization\n", dev->name);
325 hw_priv->sandisk_connectplus = 1;
328 reg.Action = CS_WRITE;
329 reg.Offset = CISREG_COR;
330 reg.Value = COR_SOFT_RESET;
331 res = pcmcia_access_configuration_register(hw_priv->link,
333 if (res != CS_SUCCESS) {
334 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
341 reg.Action = CS_WRITE;
342 reg.Offset = CISREG_COR;
344 * Do not enable interrupts here to avoid some bogus events. Interrupts
345 * will be enabled during the first cor_sreset call.
347 reg.Value = COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | COR_FUNC_ENA;
348 res = pcmcia_access_configuration_register(hw_priv->link,
350 if (res != CS_SUCCESS) {
351 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
357 sandisk_set_iobase(local);
359 HFA384X_OUTB(0xc5, SANDISK_WLAN_ACTIVATION_OFF);
361 HFA384X_OUTB(0x4b, SANDISK_WLAN_ACTIVATION_OFF);
370 static void prism2_pccard_cor_sreset(local_info_t *local)
374 struct hostap_cs_priv *hw_priv = local->hw_priv;
376 if (!prism2_pccard_card_present(local))
380 reg.Action = CS_READ;
381 reg.Offset = CISREG_COR;
383 res = pcmcia_access_configuration_register(hw_priv->link,
385 if (res != CS_SUCCESS) {
386 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n",
390 printk(KERN_DEBUG "prism2_pccard_cor_sreset: original COR %02x\n",
393 reg.Action = CS_WRITE;
394 reg.Value |= COR_SOFT_RESET;
395 res = pcmcia_access_configuration_register(hw_priv->link,
397 if (res != CS_SUCCESS) {
398 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n",
403 mdelay(hw_priv->sandisk_connectplus ? 5 : 2);
405 reg.Value &= ~COR_SOFT_RESET;
406 if (hw_priv->sandisk_connectplus)
407 reg.Value |= COR_IREQ_ENA;
408 res = pcmcia_access_configuration_register(hw_priv->link,
410 if (res != CS_SUCCESS) {
411 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n",
416 mdelay(hw_priv->sandisk_connectplus ? 5 : 2);
418 if (hw_priv->sandisk_connectplus)
419 sandisk_set_iobase(local);
423 static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
428 struct hostap_cs_priv *hw_priv = local->hw_priv;
430 if (!prism2_pccard_card_present(local))
433 if (hw_priv->sandisk_connectplus) {
434 sandisk_write_hcr(local, hcr);
439 reg.Action = CS_READ;
440 reg.Offset = CISREG_COR;
442 res = pcmcia_access_configuration_register(hw_priv->link,
444 if (res != CS_SUCCESS) {
445 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 "
449 printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n",
453 reg.Action = CS_WRITE;
454 reg.Value |= COR_SOFT_RESET;
455 res = pcmcia_access_configuration_register(hw_priv->link,
457 if (res != CS_SUCCESS) {
458 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 "
465 /* Setup Genesis mode */
466 reg.Action = CS_WRITE;
468 reg.Offset = CISREG_CCSR;
469 res = pcmcia_access_configuration_register(hw_priv->link,
471 if (res != CS_SUCCESS) {
472 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 "
478 reg.Action = CS_WRITE;
479 reg.Offset = CISREG_COR;
480 reg.Value = old_cor & ~COR_SOFT_RESET;
481 res = pcmcia_access_configuration_register(hw_priv->link,
483 if (res != CS_SUCCESS) {
484 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 "
493 static struct prism2_helper_functions prism2_pccard_funcs =
495 .card_present = prism2_pccard_card_present,
496 .cor_sreset = prism2_pccard_cor_sreset,
497 .genesis_reset = prism2_pccard_genesis_reset,
498 .hw_type = HOSTAP_HW_PCCARD,
502 /* allocate local data and register with CardServices
503 * initialize dev_link structure, but do not configure the card yet */
504 static int prism2_attach(struct pcmcia_device *p_dev)
506 PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info);
507 p_dev->conf.IntType = INT_MEMORY_AND_IO;
509 p_dev->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
510 if (prism2_config(p_dev))
511 PDEBUG(DEBUG_EXTRA, "prism2_config() failed\n");
517 static void prism2_detach(struct pcmcia_device *link)
519 PDEBUG(DEBUG_FLOW, "prism2_detach\n");
521 if (link->state & DEV_CONFIG) {
522 prism2_release((u_long)link);
525 /* release net devices */
527 struct hostap_cs_priv *hw_priv;
528 struct net_device *dev;
529 struct hostap_interface *iface;
531 iface = netdev_priv(dev);
532 hw_priv = iface->local->hw_priv;
533 prism2_free_local_data(dev);
539 #define CS_CHECK(fn, ret) \
540 do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
542 #define CFG_CHECK2(fn, retf) \
543 do { int ret = (retf); \
545 PDEBUG(DEBUG_EXTRA, "CardServices(" #fn ") returned %d\n", ret); \
546 cs_error(link, fn, ret); \
552 /* run after a CARD_INSERTION event is received to configure the PCMCIA
553 * socket and make the device available to the system */
554 static int prism2_config(struct pcmcia_device *link)
556 struct net_device *dev;
557 struct hostap_interface *iface;
562 int last_fn, last_ret;
565 cistpl_cftable_entry_t dflt = { 0 };
566 struct hostap_cs_priv *hw_priv;
568 PDEBUG(DEBUG_FLOW, "prism2_config()\n");
570 parse = kmalloc(sizeof(cisparse_t), GFP_KERNEL);
571 hw_priv = kmalloc(sizeof(*hw_priv), GFP_KERNEL);
572 if (parse == NULL || hw_priv == NULL) {
576 memset(hw_priv, 0, sizeof(*hw_priv));
578 tuple.DesiredTuple = CISTPL_CONFIG;
579 tuple.Attributes = 0;
580 tuple.TupleData = buf;
581 tuple.TupleDataMax = sizeof(buf);
582 tuple.TupleOffset = 0;
583 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
584 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
585 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
586 link->conf.ConfigBase = parse->config.base;
587 link->conf.Present = parse->config.rmask[0];
589 CS_CHECK(GetConfigurationInfo,
590 pcmcia_get_configuration_info(link, &conf));
592 /* Look for an appropriate configuration table entry in the CIS */
593 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
594 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
596 cistpl_cftable_entry_t *cfg = &(parse->cftable_entry);
597 CFG_CHECK2(GetTupleData,
598 pcmcia_get_tuple_data(link, &tuple));
599 CFG_CHECK2(ParseTuple,
600 pcmcia_parse_tuple(link, &tuple, parse));
602 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
606 link->conf.ConfigIndex = cfg->index;
607 PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X "
608 "(default 0x%02X)\n", cfg->index, dflt.index);
610 /* Does this card need audio output? */
611 if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
612 link->conf.Attributes |= CONF_ENABLE_SPKR;
613 link->conf.Status = CCSR_AUDIO_ENA;
616 /* Use power settings for Vcc and Vpp if present */
617 /* Note that the CIS values need to be rescaled */
618 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
619 if (conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] /
620 10000 && !ignore_cis_vcc) {
621 PDEBUG(DEBUG_EXTRA, " Vcc mismatch - skipping"
625 } else if (dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) {
626 if (conf.Vcc != dflt.vcc.param[CISTPL_POWER_VNOM] /
627 10000 && !ignore_cis_vcc) {
628 PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch "
629 "- skipping this entry\n");
634 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
636 cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
637 else if (dflt.vpp1.present & (1 << CISTPL_POWER_VNOM))
639 dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000;
641 /* Do we need to allocate an interrupt? */
642 if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1)
643 link->conf.Attributes |= CONF_ENABLE_IRQ;
644 else if (!(link->conf.Attributes & CONF_ENABLE_IRQ)) {
645 /* At least Compaq WL200 does not have IRQInfo1 set,
646 * but it does not work without interrupts.. */
647 printk("Config has no IRQ info, but trying to enable "
649 link->conf.Attributes |= CONF_ENABLE_IRQ;
652 /* IO window settings */
653 PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d "
655 cfg->io.nwin, dflt.io.nwin);
656 link->io.NumPorts1 = link->io.NumPorts2 = 0;
657 if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) {
658 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io;
659 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
660 PDEBUG(DEBUG_EXTRA, "io->flags = 0x%04X, "
661 "io.base=0x%04x, len=%d\n", io->flags,
662 io->win[0].base, io->win[0].len);
663 if (!(io->flags & CISTPL_IO_8BIT))
664 link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
665 if (!(io->flags & CISTPL_IO_16BIT))
666 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
667 link->io.IOAddrLines = io->flags &
668 CISTPL_IO_LINES_MASK;
669 link->io.BasePort1 = io->win[0].base;
670 link->io.NumPorts1 = io->win[0].len;
672 link->io.Attributes2 = link->io.Attributes1;
673 link->io.BasePort2 = io->win[1].base;
674 link->io.NumPorts2 = io->win[1].len;
678 /* This reserves IO space but doesn't actually enable it */
679 CFG_CHECK2(RequestIO,
680 pcmcia_request_io(link, &link->io));
682 /* This configuration table entry is OK */
686 CS_CHECK(GetNextTuple,
687 pcmcia_get_next_tuple(link, &tuple));
690 /* Need to allocate net_device before requesting IRQ handler */
691 dev = prism2_init_local_data(&prism2_pccard_funcs, 0,
692 &handle_to_dev(link));
697 iface = netdev_priv(dev);
698 local = iface->local;
699 local->hw_priv = hw_priv;
700 hw_priv->link = link;
701 strcpy(hw_priv->node.dev_name, dev->name);
702 link->dev_node = &hw_priv->node;
705 * Allocate an interrupt line. Note that this does not assign a
706 * handler to the interrupt, unless the 'Handler' member of the
707 * irq structure is initialized.
709 if (link->conf.Attributes & CONF_ENABLE_IRQ) {
710 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
711 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
712 link->irq.Handler = prism2_interrupt;
713 link->irq.Instance = dev;
715 pcmcia_request_irq(link, &link->irq));
719 * This actually configures the PCMCIA socket -- setting up
720 * the I/O windows and the interrupt mapping, and putting the
721 * card and host interface into "Memory and IO" mode.
723 CS_CHECK(RequestConfiguration,
724 pcmcia_request_configuration(link, &link->conf));
726 dev->irq = link->irq.AssignedIRQ;
727 dev->base_addr = link->io.BasePort1;
729 /* Finally, report what we've done */
730 printk(KERN_INFO "%s: index 0x%02x: ",
731 dev_info, link->conf.ConfigIndex);
733 printk(", Vpp %d.%d", link->conf.Vpp / 10,
734 link->conf.Vpp % 10);
735 if (link->conf.Attributes & CONF_ENABLE_IRQ)
736 printk(", irq %d", link->irq.AssignedIRQ);
737 if (link->io.NumPorts1)
738 printk(", io 0x%04x-0x%04x", link->io.BasePort1,
739 link->io.BasePort1+link->io.NumPorts1-1);
740 if (link->io.NumPorts2)
741 printk(" & 0x%04x-0x%04x", link->io.BasePort2,
742 link->io.BasePort2+link->io.NumPorts2-1);
745 link->state |= DEV_CONFIG;
746 link->state &= ~DEV_CONFIG_PENDING;
750 sandisk_enable_wireless(dev);
752 ret = prism2_hw_config(dev, 1);
754 ret = hostap_hw_ready(dev);
755 if (ret == 0 && local->ddev)
756 strcpy(hw_priv->node.dev_name, local->ddev->name);
762 cs_error(link, last_fn, last_ret);
767 prism2_release((u_long)link);
772 static void prism2_release(u_long arg)
774 struct pcmcia_device *link = (struct pcmcia_device *)arg;
776 PDEBUG(DEBUG_FLOW, "prism2_release\n");
779 struct net_device *dev = link->priv;
780 struct hostap_interface *iface;
782 iface = netdev_priv(dev);
783 if (link->state & DEV_CONFIG)
784 prism2_hw_shutdown(dev, 0);
785 iface->local->shutdown = 1;
788 pcmcia_disable_device(link);
789 PDEBUG(DEBUG_FLOW, "release - done\n");
792 static int hostap_cs_suspend(struct pcmcia_device *link)
794 struct net_device *dev = (struct net_device *) link->priv;
797 PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_SUSPEND\n", dev_info);
799 if (link->state & DEV_CONFIG) {
800 struct hostap_interface *iface = netdev_priv(dev);
801 if (iface && iface->local)
802 dev_open = iface->local->num_dev_open > 0;
804 netif_stop_queue(dev);
805 netif_device_detach(dev);
813 static int hostap_cs_resume(struct pcmcia_device *link)
815 struct net_device *dev = (struct net_device *) link->priv;
818 PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_RESUME\n", dev_info);
820 if (link->state & DEV_CONFIG) {
821 struct hostap_interface *iface = netdev_priv(dev);
822 if (iface && iface->local)
823 dev_open = iface->local->num_dev_open > 0;
825 prism2_hw_shutdown(dev, 1);
826 prism2_hw_config(dev, dev_open ? 0 : 1);
828 netif_device_attach(dev);
829 netif_start_queue(dev);
836 static struct pcmcia_device_id hostap_cs_ids[] = {
837 PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100),
838 PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300),
839 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777),
840 PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000),
841 PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002),
842 PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002),
843 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x030b),
844 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612),
845 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613),
846 PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002),
847 PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002),
848 PCMCIA_DEVICE_MANF_CARD(0x02d2, 0x0001),
849 PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x0001),
850 PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300),
851 PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000),
852 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
853 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
854 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010),
855 PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "INTERSIL",
857 PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "Intersil",
859 PCMCIA_MFC_DEVICE_PROD_ID12(0, "SanDisk", "ConnectPlus",
860 0x7a954bd9, 0x74be00c6),
861 PCMCIA_DEVICE_PROD_ID1234(
862 "Intersil", "PRISM 2_5 PCMCIA ADAPTER", "ISL37300P",
864 0x4b801a17, 0x6345a0bf, 0xc9049a39, 0xc23adc0e),
865 PCMCIA_DEVICE_PROD_ID123(
866 "Addtron", "AWP-100 Wireless PCMCIA", "Version 01.02",
867 0xe6ec52ce, 0x08649af2, 0x4b74baa0),
868 PCMCIA_DEVICE_PROD_ID123(
869 "D", "Link DWL-650 11Mbps WLAN Card", "Version 01.02",
870 0x71b18589, 0xb6f1b0ab, 0x4b74baa0),
871 PCMCIA_DEVICE_PROD_ID123(
872 "Instant Wireless ", " Network PC CARD", "Version 01.02",
873 0x11d901af, 0x6e9bd926, 0x4b74baa0),
874 PCMCIA_DEVICE_PROD_ID123(
875 "SMC", "SMC2632W", "Version 01.02",
876 0xc4f8b18b, 0x474a1f2a, 0x4b74baa0),
877 PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-CF-S11G",
878 0x2decece3, 0x82067c18),
879 PCMCIA_DEVICE_PROD_ID12("Compaq", "WL200_11Mbps_Wireless_PCI_Card",
880 0x54f7c49c, 0x15a75e5b),
881 PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE",
882 0x74c5e40d, 0xdb472a18),
883 PCMCIA_DEVICE_PROD_ID12("Linksys", "Wireless CompactFlash Card",
884 0x0733cc81, 0x0c52f395),
885 PCMCIA_DEVICE_PROD_ID12(
886 "ZoomAir 11Mbps High", "Rate wireless Networking",
887 0x273fe3db, 0x32a1eaee),
890 MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids);
893 static struct pcmcia_driver hostap_driver = {
897 .probe = prism2_attach,
898 .remove = prism2_detach,
899 .owner = THIS_MODULE,
900 .id_table = hostap_cs_ids,
901 .suspend = hostap_cs_suspend,
902 .resume = hostap_cs_resume,
905 static int __init init_prism2_pccard(void)
907 printk(KERN_INFO "%s: %s\n", dev_info, version);
908 return pcmcia_register_driver(&hostap_driver);
911 static void __exit exit_prism2_pccard(void)
913 pcmcia_unregister_driver(&hostap_driver);
914 printk(KERN_INFO "%s: Driver unloaded\n", dev_info);
918 module_init(init_prism2_pccard);
919 module_exit(exit_prism2_pccard);