3 #include <linux/module.h>
4 #include <linux/init.h>
6 #include <linux/wait.h>
7 #include <linux/timer.h>
8 #include <linux/skbuff.h>
9 #include <linux/netdevice.h>
10 #include <linux/workqueue.h>
11 #include <linux/wireless.h>
12 #include <net/iw_handler.h>
14 #include <pcmcia/cs_types.h>
15 #include <pcmcia/cs.h>
16 #include <pcmcia/cistpl.h>
17 #include <pcmcia/cisreg.h>
18 #include <pcmcia/ds.h>
22 #include "hostap_wlan.h"
25 static char *version
= PRISM2_VERSION
" (Jouni Malinen <jkmaline@cc.hut.fi>)";
26 static dev_info_t dev_info
= "hostap_cs";
28 MODULE_AUTHOR("Jouni Malinen");
29 MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN "
31 MODULE_SUPPORTED_DEVICE("Intersil Prism2-based WLAN cards (PC Card)");
32 MODULE_LICENSE("GPL");
33 MODULE_VERSION(PRISM2_VERSION
);
36 static int ignore_cis_vcc
;
37 module_param(ignore_cis_vcc
, int, 0444);
38 MODULE_PARM_DESC(ignore_cis_vcc
, "Ignore broken CIS VCC entry");
41 /* struct local_info::hw_priv */
42 struct hostap_cs_priv
{
44 struct pcmcia_device
*link
;
45 int sandisk_connectplus
;
49 #ifdef PRISM2_IO_DEBUG
51 static inline void hfa384x_outb_debug(struct net_device
*dev
, int a
, u8 v
)
53 struct hostap_interface
*iface
;
57 iface
= netdev_priv(dev
);
59 spin_lock_irqsave(&local
->lock
, flags
);
60 prism2_io_debug_add(dev
, PRISM2_IO_DEBUG_CMD_OUTB
, a
, v
);
61 outb(v
, dev
->base_addr
+ a
);
62 spin_unlock_irqrestore(&local
->lock
, flags
);
65 static inline u8
hfa384x_inb_debug(struct net_device
*dev
, int a
)
67 struct hostap_interface
*iface
;
72 iface
= netdev_priv(dev
);
74 spin_lock_irqsave(&local
->lock
, flags
);
75 v
= inb(dev
->base_addr
+ a
);
76 prism2_io_debug_add(dev
, PRISM2_IO_DEBUG_CMD_INB
, a
, v
);
77 spin_unlock_irqrestore(&local
->lock
, flags
);
81 static inline void hfa384x_outw_debug(struct net_device
*dev
, int a
, u16 v
)
83 struct hostap_interface
*iface
;
87 iface
= netdev_priv(dev
);
89 spin_lock_irqsave(&local
->lock
, flags
);
90 prism2_io_debug_add(dev
, PRISM2_IO_DEBUG_CMD_OUTW
, a
, v
);
91 outw(v
, dev
->base_addr
+ a
);
92 spin_unlock_irqrestore(&local
->lock
, flags
);
95 static inline u16
hfa384x_inw_debug(struct net_device
*dev
, int a
)
97 struct hostap_interface
*iface
;
102 iface
= netdev_priv(dev
);
103 local
= iface
->local
;
104 spin_lock_irqsave(&local
->lock
, flags
);
105 v
= inw(dev
->base_addr
+ a
);
106 prism2_io_debug_add(dev
, PRISM2_IO_DEBUG_CMD_INW
, a
, v
);
107 spin_unlock_irqrestore(&local
->lock
, flags
);
111 static inline void hfa384x_outsw_debug(struct net_device
*dev
, int a
,
114 struct hostap_interface
*iface
;
118 iface
= netdev_priv(dev
);
119 local
= iface
->local
;
120 spin_lock_irqsave(&local
->lock
, flags
);
121 prism2_io_debug_add(dev
, PRISM2_IO_DEBUG_CMD_OUTSW
, a
, wc
);
122 outsw(dev
->base_addr
+ a
, buf
, wc
);
123 spin_unlock_irqrestore(&local
->lock
, flags
);
126 static inline void hfa384x_insw_debug(struct net_device
*dev
, int a
,
129 struct hostap_interface
*iface
;
133 iface
= netdev_priv(dev
);
134 local
= iface
->local
;
135 spin_lock_irqsave(&local
->lock
, flags
);
136 prism2_io_debug_add(dev
, PRISM2_IO_DEBUG_CMD_INSW
, a
, wc
);
137 insw(dev
->base_addr
+ a
, buf
, wc
);
138 spin_unlock_irqrestore(&local
->lock
, flags
);
141 #define HFA384X_OUTB(v,a) hfa384x_outb_debug(dev, (a), (v))
142 #define HFA384X_INB(a) hfa384x_inb_debug(dev, (a))
143 #define HFA384X_OUTW(v,a) hfa384x_outw_debug(dev, (a), (v))
144 #define HFA384X_INW(a) hfa384x_inw_debug(dev, (a))
145 #define HFA384X_OUTSW(a, buf, wc) hfa384x_outsw_debug(dev, (a), (buf), (wc))
146 #define HFA384X_INSW(a, buf, wc) hfa384x_insw_debug(dev, (a), (buf), (wc))
148 #else /* PRISM2_IO_DEBUG */
150 #define HFA384X_OUTB(v,a) outb((v), dev->base_addr + (a))
151 #define HFA384X_INB(a) inb(dev->base_addr + (a))
152 #define HFA384X_OUTW(v,a) outw((v), dev->base_addr + (a))
153 #define HFA384X_INW(a) inw(dev->base_addr + (a))
154 #define HFA384X_INSW(a, buf, wc) insw(dev->base_addr + (a), buf, wc)
155 #define HFA384X_OUTSW(a, buf, wc) outsw(dev->base_addr + (a), buf, wc)
157 #endif /* PRISM2_IO_DEBUG */
160 static int hfa384x_from_bap(struct net_device
*dev
, u16 bap
, void *buf
,
166 d_off
= (bap
== 1) ? HFA384X_DATA1_OFF
: HFA384X_DATA0_OFF
;
170 HFA384X_INSW(d_off
, buf
, len
/ 2);
174 *((char *) pos
) = HFA384X_INB(d_off
);
180 static int hfa384x_to_bap(struct net_device
*dev
, u16 bap
, void *buf
, int len
)
185 d_off
= (bap
== 1) ? HFA384X_DATA1_OFF
: HFA384X_DATA0_OFF
;
189 HFA384X_OUTSW(d_off
, buf
, len
/ 2);
193 HFA384X_OUTB(*((char *) pos
), d_off
);
199 /* FIX: This might change at some point.. */
200 #include "hostap_hw.c"
204 static void prism2_detach(struct pcmcia_device
*p_dev
);
205 static void prism2_release(u_long arg
);
206 static int prism2_config(struct pcmcia_device
*link
);
209 static int prism2_pccard_card_present(local_info_t
*local
)
211 struct hostap_cs_priv
*hw_priv
= local
->hw_priv
;
212 if (hw_priv
!= NULL
&& hw_priv
->link
!= NULL
&& pcmcia_dev_present(hw_priv
->link
))
219 * SanDisk CompactFlash WLAN Flashcard - Product Manual v1.0
220 * Document No. 20-10-00058, January 2004
221 * http://www.sandisk.com/pdf/industrial/ProdManualCFWLANv1.0.pdf
223 #define SANDISK_WLAN_ACTIVATION_OFF 0x40
224 #define SANDISK_HCR_OFF 0x42
227 static void sandisk_set_iobase(local_info_t
*local
)
231 struct hostap_cs_priv
*hw_priv
= local
->hw_priv
;
234 reg
.Action
= CS_WRITE
;
235 reg
.Offset
= 0x10; /* 0x3f0 IO base 1 */
236 reg
.Value
= hw_priv
->link
->io
.BasePort1
& 0x00ff;
237 res
= pcmcia_access_configuration_register(hw_priv
->link
,
239 if (res
!= CS_SUCCESS
) {
240 printk(KERN_DEBUG
"Prism3 SanDisk - failed to set I/O base 0 -"
246 reg
.Action
= CS_WRITE
;
247 reg
.Offset
= 0x12; /* 0x3f2 IO base 2 */
248 reg
.Value
= (hw_priv
->link
->io
.BasePort1
& 0xff00) >> 8;
249 res
= pcmcia_access_configuration_register(hw_priv
->link
,
251 if (res
!= CS_SUCCESS
) {
252 printk(KERN_DEBUG
"Prism3 SanDisk - failed to set I/O base 1 -"
258 static void sandisk_write_hcr(local_info_t
*local
, int hcr
)
260 struct net_device
*dev
= local
->dev
;
263 HFA384X_OUTB(0x80, SANDISK_WLAN_ACTIVATION_OFF
);
265 for (i
= 0; i
< 10; i
++) {
266 HFA384X_OUTB(hcr
, SANDISK_HCR_OFF
);
269 HFA384X_OUTB(0x45, SANDISK_WLAN_ACTIVATION_OFF
);
273 static int sandisk_enable_wireless(struct net_device
*dev
)
277 struct hostap_interface
*iface
= dev
->priv
;
278 local_info_t
*local
= iface
->local
;
280 cisparse_t
*parse
= NULL
;
282 struct hostap_cs_priv
*hw_priv
= local
->hw_priv
;
284 if (hw_priv
->link
->io
.NumPorts1
< 0x42) {
285 /* Not enough ports to be SanDisk multi-function card */
290 parse
= kmalloc(sizeof(cisparse_t
), GFP_KERNEL
);
296 tuple
.Attributes
= TUPLE_RETURN_COMMON
;
297 tuple
.TupleData
= buf
;
298 tuple
.TupleDataMax
= sizeof(buf
);
299 tuple
.TupleOffset
= 0;
301 if (hw_priv
->link
->manf_id
!= 0xd601 || hw_priv
->link
->card_id
!= 0x0101) {
302 /* No SanDisk manfid found */
307 tuple
.DesiredTuple
= CISTPL_LONGLINK_MFC
;
308 if (pcmcia_get_first_tuple(hw_priv
->link
, &tuple
) ||
309 pcmcia_get_tuple_data(hw_priv
->link
, &tuple
) ||
310 pcmcia_parse_tuple(hw_priv
->link
, &tuple
, parse
) ||
311 parse
->longlink_mfc
.nfn
< 2) {
312 /* No multi-function links found */
317 printk(KERN_DEBUG
"%s: Multi-function SanDisk ConnectPlus detected"
318 " - using vendor-specific initialization\n", dev
->name
);
319 hw_priv
->sandisk_connectplus
= 1;
322 reg
.Action
= CS_WRITE
;
323 reg
.Offset
= CISREG_COR
;
324 reg
.Value
= COR_SOFT_RESET
;
325 res
= pcmcia_access_configuration_register(hw_priv
->link
,
327 if (res
!= CS_SUCCESS
) {
328 printk(KERN_DEBUG
"%s: SanDisk - COR sreset failed (%d)\n",
335 reg
.Action
= CS_WRITE
;
336 reg
.Offset
= CISREG_COR
;
338 * Do not enable interrupts here to avoid some bogus events. Interrupts
339 * will be enabled during the first cor_sreset call.
341 reg
.Value
= COR_LEVEL_REQ
| 0x8 | COR_ADDR_DECODE
| COR_FUNC_ENA
;
342 res
= pcmcia_access_configuration_register(hw_priv
->link
,
344 if (res
!= CS_SUCCESS
) {
345 printk(KERN_DEBUG
"%s: SanDisk - COR sreset failed (%d)\n",
351 sandisk_set_iobase(local
);
353 HFA384X_OUTB(0xc5, SANDISK_WLAN_ACTIVATION_OFF
);
355 HFA384X_OUTB(0x4b, SANDISK_WLAN_ACTIVATION_OFF
);
364 static void prism2_pccard_cor_sreset(local_info_t
*local
)
368 struct hostap_cs_priv
*hw_priv
= local
->hw_priv
;
370 if (!prism2_pccard_card_present(local
))
374 reg
.Action
= CS_READ
;
375 reg
.Offset
= CISREG_COR
;
377 res
= pcmcia_access_configuration_register(hw_priv
->link
,
379 if (res
!= CS_SUCCESS
) {
380 printk(KERN_DEBUG
"prism2_pccard_cor_sreset failed 1 (%d)\n",
384 printk(KERN_DEBUG
"prism2_pccard_cor_sreset: original COR %02x\n",
387 reg
.Action
= CS_WRITE
;
388 reg
.Value
|= COR_SOFT_RESET
;
389 res
= pcmcia_access_configuration_register(hw_priv
->link
,
391 if (res
!= CS_SUCCESS
) {
392 printk(KERN_DEBUG
"prism2_pccard_cor_sreset failed 2 (%d)\n",
397 mdelay(hw_priv
->sandisk_connectplus
? 5 : 2);
399 reg
.Value
&= ~COR_SOFT_RESET
;
400 if (hw_priv
->sandisk_connectplus
)
401 reg
.Value
|= COR_IREQ_ENA
;
402 res
= pcmcia_access_configuration_register(hw_priv
->link
,
404 if (res
!= CS_SUCCESS
) {
405 printk(KERN_DEBUG
"prism2_pccard_cor_sreset failed 3 (%d)\n",
410 mdelay(hw_priv
->sandisk_connectplus
? 5 : 2);
412 if (hw_priv
->sandisk_connectplus
)
413 sandisk_set_iobase(local
);
417 static void prism2_pccard_genesis_reset(local_info_t
*local
, int hcr
)
422 struct hostap_cs_priv
*hw_priv
= local
->hw_priv
;
424 if (!prism2_pccard_card_present(local
))
427 if (hw_priv
->sandisk_connectplus
) {
428 sandisk_write_hcr(local
, hcr
);
433 reg
.Action
= CS_READ
;
434 reg
.Offset
= CISREG_COR
;
436 res
= pcmcia_access_configuration_register(hw_priv
->link
,
438 if (res
!= CS_SUCCESS
) {
439 printk(KERN_DEBUG
"prism2_pccard_genesis_sreset failed 1 "
443 printk(KERN_DEBUG
"prism2_pccard_genesis_sreset: original COR %02x\n",
447 reg
.Action
= CS_WRITE
;
448 reg
.Value
|= COR_SOFT_RESET
;
449 res
= pcmcia_access_configuration_register(hw_priv
->link
,
451 if (res
!= CS_SUCCESS
) {
452 printk(KERN_DEBUG
"prism2_pccard_genesis_sreset failed 2 "
459 /* Setup Genesis mode */
460 reg
.Action
= CS_WRITE
;
462 reg
.Offset
= CISREG_CCSR
;
463 res
= pcmcia_access_configuration_register(hw_priv
->link
,
465 if (res
!= CS_SUCCESS
) {
466 printk(KERN_DEBUG
"prism2_pccard_genesis_sreset failed 3 "
472 reg
.Action
= CS_WRITE
;
473 reg
.Offset
= CISREG_COR
;
474 reg
.Value
= old_cor
& ~COR_SOFT_RESET
;
475 res
= pcmcia_access_configuration_register(hw_priv
->link
,
477 if (res
!= CS_SUCCESS
) {
478 printk(KERN_DEBUG
"prism2_pccard_genesis_sreset failed 4 "
487 static struct prism2_helper_functions prism2_pccard_funcs
=
489 .card_present
= prism2_pccard_card_present
,
490 .cor_sreset
= prism2_pccard_cor_sreset
,
491 .genesis_reset
= prism2_pccard_genesis_reset
,
492 .hw_type
= HOSTAP_HW_PCCARD
,
496 /* allocate local data and register with CardServices
497 * initialize dev_link structure, but do not configure the card yet */
498 static int hostap_cs_probe(struct pcmcia_device
*p_dev
)
502 PDEBUG(DEBUG_HW
, "%s: setting Vcc=33 (constant)\n", dev_info
);
503 p_dev
->conf
.IntType
= INT_MEMORY_AND_IO
;
505 ret
= prism2_config(p_dev
);
507 PDEBUG(DEBUG_EXTRA
, "prism2_config() failed\n");
514 static void prism2_detach(struct pcmcia_device
*link
)
516 PDEBUG(DEBUG_FLOW
, "prism2_detach\n");
518 prism2_release((u_long
)link
);
520 /* release net devices */
522 struct hostap_cs_priv
*hw_priv
;
523 struct net_device
*dev
;
524 struct hostap_interface
*iface
;
526 iface
= netdev_priv(dev
);
527 hw_priv
= iface
->local
->hw_priv
;
528 prism2_free_local_data(dev
);
534 #define CS_CHECK(fn, ret) \
535 do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
537 #define CFG_CHECK2(fn, retf) \
538 do { int ret = (retf); \
540 PDEBUG(DEBUG_EXTRA, "CardServices(" #fn ") returned %d\n", ret); \
541 cs_error(link, fn, ret); \
547 /* run after a CARD_INSERTION event is received to configure the PCMCIA
548 * socket and make the device available to the system */
549 static int prism2_config(struct pcmcia_device
*link
)
551 struct net_device
*dev
;
552 struct hostap_interface
*iface
;
557 int last_fn
, last_ret
;
560 cistpl_cftable_entry_t dflt
= { 0 };
561 struct hostap_cs_priv
*hw_priv
;
563 PDEBUG(DEBUG_FLOW
, "prism2_config()\n");
565 parse
= kmalloc(sizeof(cisparse_t
), GFP_KERNEL
);
566 hw_priv
= kzalloc(sizeof(*hw_priv
), GFP_KERNEL
);
567 if (parse
== NULL
|| hw_priv
== NULL
) {
572 tuple
.Attributes
= 0;
573 tuple
.TupleData
= buf
;
574 tuple
.TupleDataMax
= sizeof(buf
);
575 tuple
.TupleOffset
= 0;
577 CS_CHECK(GetConfigurationInfo
,
578 pcmcia_get_configuration_info(link
, &conf
));
580 /* Look for an appropriate configuration table entry in the CIS */
581 tuple
.DesiredTuple
= CISTPL_CFTABLE_ENTRY
;
582 CS_CHECK(GetFirstTuple
, pcmcia_get_first_tuple(link
, &tuple
));
584 cistpl_cftable_entry_t
*cfg
= &(parse
->cftable_entry
);
585 CFG_CHECK2(GetTupleData
,
586 pcmcia_get_tuple_data(link
, &tuple
));
587 CFG_CHECK2(ParseTuple
,
588 pcmcia_parse_tuple(link
, &tuple
, parse
));
590 if (cfg
->flags
& CISTPL_CFTABLE_DEFAULT
)
594 link
->conf
.ConfigIndex
= cfg
->index
;
595 PDEBUG(DEBUG_EXTRA
, "Checking CFTABLE_ENTRY 0x%02X "
596 "(default 0x%02X)\n", cfg
->index
, dflt
.index
);
598 /* Does this card need audio output? */
599 if (cfg
->flags
& CISTPL_CFTABLE_AUDIO
) {
600 link
->conf
.Attributes
|= CONF_ENABLE_SPKR
;
601 link
->conf
.Status
= CCSR_AUDIO_ENA
;
604 /* Use power settings for Vcc and Vpp if present */
605 /* Note that the CIS values need to be rescaled */
606 if (cfg
->vcc
.present
& (1 << CISTPL_POWER_VNOM
)) {
607 if (conf
.Vcc
!= cfg
->vcc
.param
[CISTPL_POWER_VNOM
] /
608 10000 && !ignore_cis_vcc
) {
609 PDEBUG(DEBUG_EXTRA
, " Vcc mismatch - skipping"
613 } else if (dflt
.vcc
.present
& (1 << CISTPL_POWER_VNOM
)) {
614 if (conf
.Vcc
!= dflt
.vcc
.param
[CISTPL_POWER_VNOM
] /
615 10000 && !ignore_cis_vcc
) {
616 PDEBUG(DEBUG_EXTRA
, " Vcc (default) mismatch "
617 "- skipping this entry\n");
622 if (cfg
->vpp1
.present
& (1 << CISTPL_POWER_VNOM
))
624 cfg
->vpp1
.param
[CISTPL_POWER_VNOM
] / 10000;
625 else if (dflt
.vpp1
.present
& (1 << CISTPL_POWER_VNOM
))
627 dflt
.vpp1
.param
[CISTPL_POWER_VNOM
] / 10000;
629 /* Do we need to allocate an interrupt? */
630 if (cfg
->irq
.IRQInfo1
|| dflt
.irq
.IRQInfo1
)
631 link
->conf
.Attributes
|= CONF_ENABLE_IRQ
;
632 else if (!(link
->conf
.Attributes
& CONF_ENABLE_IRQ
)) {
633 /* At least Compaq WL200 does not have IRQInfo1 set,
634 * but it does not work without interrupts.. */
635 printk("Config has no IRQ info, but trying to enable "
637 link
->conf
.Attributes
|= CONF_ENABLE_IRQ
;
640 /* IO window settings */
641 PDEBUG(DEBUG_EXTRA
, "IO window settings: cfg->io.nwin=%d "
643 cfg
->io
.nwin
, dflt
.io
.nwin
);
644 link
->io
.NumPorts1
= link
->io
.NumPorts2
= 0;
645 if ((cfg
->io
.nwin
> 0) || (dflt
.io
.nwin
> 0)) {
646 cistpl_io_t
*io
= (cfg
->io
.nwin
) ? &cfg
->io
: &dflt
.io
;
647 link
->io
.Attributes1
= IO_DATA_PATH_WIDTH_AUTO
;
648 PDEBUG(DEBUG_EXTRA
, "io->flags = 0x%04X, "
649 "io.base=0x%04x, len=%d\n", io
->flags
,
650 io
->win
[0].base
, io
->win
[0].len
);
651 if (!(io
->flags
& CISTPL_IO_8BIT
))
652 link
->io
.Attributes1
= IO_DATA_PATH_WIDTH_16
;
653 if (!(io
->flags
& CISTPL_IO_16BIT
))
654 link
->io
.Attributes1
= IO_DATA_PATH_WIDTH_8
;
655 link
->io
.IOAddrLines
= io
->flags
&
656 CISTPL_IO_LINES_MASK
;
657 link
->io
.BasePort1
= io
->win
[0].base
;
658 link
->io
.NumPorts1
= io
->win
[0].len
;
660 link
->io
.Attributes2
= link
->io
.Attributes1
;
661 link
->io
.BasePort2
= io
->win
[1].base
;
662 link
->io
.NumPorts2
= io
->win
[1].len
;
666 /* This reserves IO space but doesn't actually enable it */
667 CFG_CHECK2(RequestIO
,
668 pcmcia_request_io(link
, &link
->io
));
670 /* This configuration table entry is OK */
674 CS_CHECK(GetNextTuple
,
675 pcmcia_get_next_tuple(link
, &tuple
));
678 /* Need to allocate net_device before requesting IRQ handler */
679 dev
= prism2_init_local_data(&prism2_pccard_funcs
, 0,
680 &handle_to_dev(link
));
685 iface
= netdev_priv(dev
);
686 local
= iface
->local
;
687 local
->hw_priv
= hw_priv
;
688 hw_priv
->link
= link
;
689 strcpy(hw_priv
->node
.dev_name
, dev
->name
);
690 link
->dev_node
= &hw_priv
->node
;
693 * Allocate an interrupt line. Note that this does not assign a
694 * handler to the interrupt, unless the 'Handler' member of the
695 * irq structure is initialized.
697 if (link
->conf
.Attributes
& CONF_ENABLE_IRQ
) {
698 link
->irq
.Attributes
= IRQ_TYPE_EXCLUSIVE
| IRQ_HANDLE_PRESENT
;
699 link
->irq
.IRQInfo1
= IRQ_LEVEL_ID
;
700 link
->irq
.Handler
= prism2_interrupt
;
701 link
->irq
.Instance
= dev
;
703 pcmcia_request_irq(link
, &link
->irq
));
707 * This actually configures the PCMCIA socket -- setting up
708 * the I/O windows and the interrupt mapping, and putting the
709 * card and host interface into "Memory and IO" mode.
711 CS_CHECK(RequestConfiguration
,
712 pcmcia_request_configuration(link
, &link
->conf
));
714 dev
->irq
= link
->irq
.AssignedIRQ
;
715 dev
->base_addr
= link
->io
.BasePort1
;
717 /* Finally, report what we've done */
718 printk(KERN_INFO
"%s: index 0x%02x: ",
719 dev_info
, link
->conf
.ConfigIndex
);
721 printk(", Vpp %d.%d", link
->conf
.Vpp
/ 10,
722 link
->conf
.Vpp
% 10);
723 if (link
->conf
.Attributes
& CONF_ENABLE_IRQ
)
724 printk(", irq %d", link
->irq
.AssignedIRQ
);
725 if (link
->io
.NumPorts1
)
726 printk(", io 0x%04x-0x%04x", link
->io
.BasePort1
,
727 link
->io
.BasePort1
+link
->io
.NumPorts1
-1);
728 if (link
->io
.NumPorts2
)
729 printk(" & 0x%04x-0x%04x", link
->io
.BasePort2
,
730 link
->io
.BasePort2
+link
->io
.NumPorts2
-1);
735 sandisk_enable_wireless(dev
);
737 ret
= prism2_hw_config(dev
, 1);
739 ret
= hostap_hw_ready(dev
);
740 if (ret
== 0 && local
->ddev
)
741 strcpy(hw_priv
->node
.dev_name
, local
->ddev
->name
);
747 cs_error(link
, last_fn
, last_ret
);
752 prism2_release((u_long
)link
);
757 static void prism2_release(u_long arg
)
759 struct pcmcia_device
*link
= (struct pcmcia_device
*)arg
;
761 PDEBUG(DEBUG_FLOW
, "prism2_release\n");
764 struct net_device
*dev
= link
->priv
;
765 struct hostap_interface
*iface
;
767 iface
= netdev_priv(dev
);
768 prism2_hw_shutdown(dev
, 0);
769 iface
->local
->shutdown
= 1;
772 pcmcia_disable_device(link
);
773 PDEBUG(DEBUG_FLOW
, "release - done\n");
776 static int hostap_cs_suspend(struct pcmcia_device
*link
)
778 struct net_device
*dev
= (struct net_device
*) link
->priv
;
780 struct hostap_interface
*iface
= NULL
;
783 iface
= netdev_priv(dev
);
785 PDEBUG(DEBUG_EXTRA
, "%s: CS_EVENT_PM_SUSPEND\n", dev_info
);
786 if (iface
&& iface
->local
)
787 dev_open
= iface
->local
->num_dev_open
> 0;
789 netif_stop_queue(dev
);
790 netif_device_detach(dev
);
797 static int hostap_cs_resume(struct pcmcia_device
*link
)
799 struct net_device
*dev
= (struct net_device
*) link
->priv
;
801 struct hostap_interface
*iface
= NULL
;
804 iface
= netdev_priv(dev
);
806 PDEBUG(DEBUG_EXTRA
, "%s: CS_EVENT_PM_RESUME\n", dev_info
);
808 if (iface
&& iface
->local
)
809 dev_open
= iface
->local
->num_dev_open
> 0;
811 prism2_hw_shutdown(dev
, 1);
812 prism2_hw_config(dev
, dev_open
? 0 : 1);
814 netif_device_attach(dev
);
815 netif_start_queue(dev
);
821 static struct pcmcia_device_id hostap_cs_ids
[] = {
822 PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100),
823 PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300),
824 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777),
825 PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000),
826 PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002),
827 PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002),
828 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x030b),
829 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612),
830 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613),
831 PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002),
832 PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002),
833 PCMCIA_DEVICE_MANF_CARD(0x02d2, 0x0001),
834 PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x0001),
835 PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300),
836 /* PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000), conflict with pcnet_cs */
837 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
838 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
839 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010),
840 PCMCIA_DEVICE_MANF_CARD(0x0126, 0x0002),
841 PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "INTERSIL",
843 PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "Intersil",
845 PCMCIA_MFC_DEVICE_PROD_ID12(0, "SanDisk", "ConnectPlus",
846 0x7a954bd9, 0x74be00c6),
847 PCMCIA_DEVICE_PROD_ID1234(
848 "Intersil", "PRISM 2_5 PCMCIA ADAPTER", "ISL37300P",
850 0x4b801a17, 0x6345a0bf, 0xc9049a39, 0xc23adc0e),
851 PCMCIA_DEVICE_PROD_ID123(
852 "Addtron", "AWP-100 Wireless PCMCIA", "Version 01.02",
853 0xe6ec52ce, 0x08649af2, 0x4b74baa0),
854 PCMCIA_DEVICE_PROD_ID123(
855 "D", "Link DWL-650 11Mbps WLAN Card", "Version 01.02",
856 0x71b18589, 0xb6f1b0ab, 0x4b74baa0),
857 PCMCIA_DEVICE_PROD_ID123(
858 "Instant Wireless ", " Network PC CARD", "Version 01.02",
859 0x11d901af, 0x6e9bd926, 0x4b74baa0),
860 PCMCIA_DEVICE_PROD_ID123(
861 "SMC", "SMC2632W", "Version 01.02",
862 0xc4f8b18b, 0x474a1f2a, 0x4b74baa0),
863 PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-CF-S11G",
864 0x2decece3, 0x82067c18),
865 PCMCIA_DEVICE_PROD_ID12("Compaq", "WL200_11Mbps_Wireless_PCI_Card",
866 0x54f7c49c, 0x15a75e5b),
867 PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE",
868 0x74c5e40d, 0xdb472a18),
869 PCMCIA_DEVICE_PROD_ID12("Linksys", "Wireless CompactFlash Card",
870 0x0733cc81, 0x0c52f395),
871 PCMCIA_DEVICE_PROD_ID12(
872 "ZoomAir 11Mbps High", "Rate wireless Networking",
873 0x273fe3db, 0x32a1eaee),
874 PCMCIA_DEVICE_PROD_ID123(
875 "Pretec", "CompactWLAN Card 802.11b", "2.5",
876 0x1cadd3e5, 0xe697636c, 0x7a5bfcf1),
877 PCMCIA_DEVICE_PROD_ID123(
878 "U.S. Robotics", "IEEE 802.11b PC-CARD", "Version 01.02",
879 0xc7b8df9d, 0x1700d087, 0x4b74baa0),
880 PCMCIA_DEVICE_PROD_ID123(
881 "Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio",
883 0x5cd01705, 0x4271660f, 0x9d08ee12),
884 PCMCIA_DEVICE_PROD_ID123(
885 "corega", "WL PCCL-11", "ISL37300P",
886 0xa21501a, 0x59868926, 0xc9049a39),
889 MODULE_DEVICE_TABLE(pcmcia
, hostap_cs_ids
);
892 static struct pcmcia_driver hostap_driver
= {
896 .probe
= hostap_cs_probe
,
897 .remove
= prism2_detach
,
898 .owner
= THIS_MODULE
,
899 .id_table
= hostap_cs_ids
,
900 .suspend
= hostap_cs_suspend
,
901 .resume
= hostap_cs_resume
,
904 static int __init
init_prism2_pccard(void)
906 printk(KERN_INFO
"%s: %s\n", dev_info
, version
);
907 return pcmcia_register_driver(&hostap_driver
);
910 static void __exit
exit_prism2_pccard(void)
912 pcmcia_unregister_driver(&hostap_driver
);
913 printk(KERN_INFO
"%s: Driver unloaded\n", dev_info
);
917 module_init(init_prism2_pccard
);
918 module_exit(exit_prism2_pccard
);