blob: 8a7984bc8afc80ccee0ff086ccc8f4f594a6265c [file] [log] [blame]
Jouni Malinenff1d2762005-05-12 22:54:16 -04001#define PRISM2_PCCARD
2
Jouni Malinenff1d2762005-05-12 22:54:16 -04003#include <linux/module.h>
4#include <linux/init.h>
5#include <linux/if.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>
13
Jouni Malinenff1d2762005-05-12 22:54:16 -040014#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>
19
20#include <asm/io.h>
21
22#include "hostap_wlan.h"
23
24
25static char *version = PRISM2_VERSION " (Jouni Malinen <jkmaline@cc.hut.fi>)";
26static dev_info_t dev_info = "hostap_cs";
Jouni Malinenff1d2762005-05-12 22:54:16 -040027
28MODULE_AUTHOR("Jouni Malinen");
29MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN "
30 "cards (PC Card).");
31MODULE_SUPPORTED_DEVICE("Intersil Prism2-based WLAN cards (PC Card)");
32MODULE_LICENSE("GPL");
Jouni Malinenf06ac312005-07-30 12:50:00 -070033MODULE_VERSION(PRISM2_VERSION);
Jouni Malinenff1d2762005-05-12 22:54:16 -040034
35
Jouni Malinenff1d2762005-05-12 22:54:16 -040036static int ignore_cis_vcc;
37module_param(ignore_cis_vcc, int, 0444);
38MODULE_PARM_DESC(ignore_cis_vcc, "Ignore broken CIS VCC entry");
39
40
Jouni Malinen67e0e472005-08-14 19:08:41 -070041/* struct local_info::hw_priv */
42struct hostap_cs_priv {
43 dev_node_t node;
Dominik Brodowskifba395e2006-03-31 17:21:06 +020044 struct pcmcia_device *link;
Jouni Malinen67e0e472005-08-14 19:08:41 -070045 int sandisk_connectplus;
46};
47
48
Jouni Malinenff1d2762005-05-12 22:54:16 -040049#ifdef PRISM2_IO_DEBUG
50
51static inline void hfa384x_outb_debug(struct net_device *dev, int a, u8 v)
52{
53 struct hostap_interface *iface;
54 local_info_t *local;
55 unsigned long flags;
56
57 iface = netdev_priv(dev);
58 local = iface->local;
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);
63}
64
65static inline u8 hfa384x_inb_debug(struct net_device *dev, int a)
66{
67 struct hostap_interface *iface;
68 local_info_t *local;
69 unsigned long flags;
70 u8 v;
71
72 iface = netdev_priv(dev);
73 local = iface->local;
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);
78 return v;
79}
80
81static inline void hfa384x_outw_debug(struct net_device *dev, int a, u16 v)
82{
83 struct hostap_interface *iface;
84 local_info_t *local;
85 unsigned long flags;
86
87 iface = netdev_priv(dev);
88 local = iface->local;
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);
93}
94
95static inline u16 hfa384x_inw_debug(struct net_device *dev, int a)
96{
97 struct hostap_interface *iface;
98 local_info_t *local;
99 unsigned long flags;
100 u16 v;
101
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);
108 return v;
109}
110
111static inline void hfa384x_outsw_debug(struct net_device *dev, int a,
112 u8 *buf, int wc)
113{
114 struct hostap_interface *iface;
115 local_info_t *local;
116 unsigned long flags;
117
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);
124}
125
126static inline void hfa384x_insw_debug(struct net_device *dev, int a,
127 u8 *buf, int wc)
128{
129 struct hostap_interface *iface;
130 local_info_t *local;
131 unsigned long flags;
132
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);
139}
140
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))
147
148#else /* PRISM2_IO_DEBUG */
149
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)
156
157#endif /* PRISM2_IO_DEBUG */
158
159
160static int hfa384x_from_bap(struct net_device *dev, u16 bap, void *buf,
161 int len)
162{
163 u16 d_off;
164 u16 *pos;
165
166 d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF;
167 pos = (u16 *) buf;
168
169 if (len / 2)
170 HFA384X_INSW(d_off, buf, len / 2);
171 pos += len / 2;
172
173 if (len & 1)
174 *((char *) pos) = HFA384X_INB(d_off);
175
176 return 0;
177}
178
179
180static int hfa384x_to_bap(struct net_device *dev, u16 bap, void *buf, int len)
181{
182 u16 d_off;
183 u16 *pos;
184
185 d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF;
186 pos = (u16 *) buf;
187
188 if (len / 2)
189 HFA384X_OUTSW(d_off, buf, len / 2);
190 pos += len / 2;
191
192 if (len & 1)
193 HFA384X_OUTB(*((char *) pos), d_off);
194
195 return 0;
196}
197
198
199/* FIX: This might change at some point.. */
200#include "hostap_hw.c"
201
202
203
Dominik Brodowskicc3b4862005-11-14 21:23:14 +0100204static void prism2_detach(struct pcmcia_device *p_dev);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400205static void prism2_release(u_long arg);
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200206static int prism2_config(struct pcmcia_device *link);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400207
208
209static int prism2_pccard_card_present(local_info_t *local)
210{
Jouni Malinen67e0e472005-08-14 19:08:41 -0700211 struct hostap_cs_priv *hw_priv = local->hw_priv;
Dominik Brodowski9940ec32006-03-05 11:04:33 +0100212 if (hw_priv != NULL && hw_priv->link != NULL && pcmcia_dev_present(hw_priv->link))
Jouni Malinenff1d2762005-05-12 22:54:16 -0400213 return 1;
214 return 0;
215}
216
217
218/*
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
222 */
223#define SANDISK_WLAN_ACTIVATION_OFF 0x40
224#define SANDISK_HCR_OFF 0x42
225
226
227static void sandisk_set_iobase(local_info_t *local)
228{
229 int res;
230 conf_reg_t reg;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700231 struct hostap_cs_priv *hw_priv = local->hw_priv;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400232
233 reg.Function = 0;
234 reg.Action = CS_WRITE;
235 reg.Offset = 0x10; /* 0x3f0 IO base 1 */
Jouni Malinen67e0e472005-08-14 19:08:41 -0700236 reg.Value = hw_priv->link->io.BasePort1 & 0x00ff;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200237 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700238 &reg);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400239 if (res != CS_SUCCESS) {
240 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -"
241 " res=%d\n", res);
242 }
243 udelay(10);
244
245 reg.Function = 0;
246 reg.Action = CS_WRITE;
247 reg.Offset = 0x12; /* 0x3f2 IO base 2 */
Jouni Malinen67e0e472005-08-14 19:08:41 -0700248 reg.Value = (hw_priv->link->io.BasePort1 & 0xff00) >> 8;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200249 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700250 &reg);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400251 if (res != CS_SUCCESS) {
252 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -"
253 " res=%d\n", res);
254 }
255}
256
257
258static void sandisk_write_hcr(local_info_t *local, int hcr)
259{
260 struct net_device *dev = local->dev;
261 int i;
262
263 HFA384X_OUTB(0x80, SANDISK_WLAN_ACTIVATION_OFF);
264 udelay(50);
265 for (i = 0; i < 10; i++) {
266 HFA384X_OUTB(hcr, SANDISK_HCR_OFF);
267 }
268 udelay(55);
269 HFA384X_OUTB(0x45, SANDISK_WLAN_ACTIVATION_OFF);
270}
271
272
273static int sandisk_enable_wireless(struct net_device *dev)
274{
275 int res, ret = 0;
276 conf_reg_t reg;
277 struct hostap_interface *iface = dev->priv;
278 local_info_t *local = iface->local;
279 tuple_t tuple;
280 cisparse_t *parse = NULL;
281 u_char buf[64];
Jouni Malinen67e0e472005-08-14 19:08:41 -0700282 struct hostap_cs_priv *hw_priv = local->hw_priv;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400283
Jouni Malinen67e0e472005-08-14 19:08:41 -0700284 if (hw_priv->link->io.NumPorts1 < 0x42) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400285 /* Not enough ports to be SanDisk multi-function card */
286 ret = -ENODEV;
287 goto done;
288 }
289
290 parse = kmalloc(sizeof(cisparse_t), GFP_KERNEL);
291 if (parse == NULL) {
292 ret = -ENOMEM;
293 goto done;
294 }
295
Jouni Malinenff1d2762005-05-12 22:54:16 -0400296 tuple.Attributes = TUPLE_RETURN_COMMON;
297 tuple.TupleData = buf;
298 tuple.TupleDataMax = sizeof(buf);
299 tuple.TupleOffset = 0;
Dominik Brodowskiefd50582006-10-25 21:28:53 -0400300
301 if (hw_priv->link->manf_id != 0xd601 || hw_priv->link->card_id != 0x0101) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400302 /* No SanDisk manfid found */
303 ret = -ENODEV;
304 goto done;
305 }
306
307 tuple.DesiredTuple = CISTPL_LONGLINK_MFC;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200308 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) ||
Jouni Malinenff1d2762005-05-12 22:54:16 -0400311 parse->longlink_mfc.nfn < 2) {
312 /* No multi-function links found */
313 ret = -ENODEV;
314 goto done;
315 }
316
317 printk(KERN_DEBUG "%s: Multi-function SanDisk ConnectPlus detected"
318 " - using vendor-specific initialization\n", dev->name);
Jouni Malinen67e0e472005-08-14 19:08:41 -0700319 hw_priv->sandisk_connectplus = 1;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400320
321 reg.Function = 0;
322 reg.Action = CS_WRITE;
323 reg.Offset = CISREG_COR;
324 reg.Value = COR_SOFT_RESET;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200325 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700326 &reg);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400327 if (res != CS_SUCCESS) {
328 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
329 dev->name, res);
330 goto done;
331 }
332 mdelay(5);
333
334 reg.Function = 0;
335 reg.Action = CS_WRITE;
336 reg.Offset = CISREG_COR;
337 /*
338 * Do not enable interrupts here to avoid some bogus events. Interrupts
339 * will be enabled during the first cor_sreset call.
340 */
341 reg.Value = COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | COR_FUNC_ENA;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200342 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700343 &reg);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400344 if (res != CS_SUCCESS) {
345 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
346 dev->name, res);
347 goto done;
348 }
349 mdelay(5);
350
351 sandisk_set_iobase(local);
352
353 HFA384X_OUTB(0xc5, SANDISK_WLAN_ACTIVATION_OFF);
354 udelay(10);
355 HFA384X_OUTB(0x4b, SANDISK_WLAN_ACTIVATION_OFF);
356 udelay(10);
357
358done:
359 kfree(parse);
360 return ret;
361}
362
363
364static void prism2_pccard_cor_sreset(local_info_t *local)
365{
366 int res;
367 conf_reg_t reg;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700368 struct hostap_cs_priv *hw_priv = local->hw_priv;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400369
370 if (!prism2_pccard_card_present(local))
371 return;
372
373 reg.Function = 0;
374 reg.Action = CS_READ;
375 reg.Offset = CISREG_COR;
376 reg.Value = 0;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200377 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700378 &reg);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400379 if (res != CS_SUCCESS) {
380 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n",
381 res);
382 return;
383 }
384 printk(KERN_DEBUG "prism2_pccard_cor_sreset: original COR %02x\n",
385 reg.Value);
386
387 reg.Action = CS_WRITE;
388 reg.Value |= COR_SOFT_RESET;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200389 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700390 &reg);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400391 if (res != CS_SUCCESS) {
392 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n",
393 res);
394 return;
395 }
396
Jouni Malinen67e0e472005-08-14 19:08:41 -0700397 mdelay(hw_priv->sandisk_connectplus ? 5 : 2);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400398
399 reg.Value &= ~COR_SOFT_RESET;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700400 if (hw_priv->sandisk_connectplus)
Jouni Malinenff1d2762005-05-12 22:54:16 -0400401 reg.Value |= COR_IREQ_ENA;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200402 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700403 &reg);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400404 if (res != CS_SUCCESS) {
405 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n",
406 res);
407 return;
408 }
409
Jouni Malinen67e0e472005-08-14 19:08:41 -0700410 mdelay(hw_priv->sandisk_connectplus ? 5 : 2);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400411
Jouni Malinen67e0e472005-08-14 19:08:41 -0700412 if (hw_priv->sandisk_connectplus)
Jouni Malinenff1d2762005-05-12 22:54:16 -0400413 sandisk_set_iobase(local);
414}
415
416
417static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
418{
419 int res;
420 conf_reg_t reg;
421 int old_cor;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700422 struct hostap_cs_priv *hw_priv = local->hw_priv;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400423
424 if (!prism2_pccard_card_present(local))
425 return;
426
Jouni Malinen67e0e472005-08-14 19:08:41 -0700427 if (hw_priv->sandisk_connectplus) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400428 sandisk_write_hcr(local, hcr);
429 return;
430 }
431
432 reg.Function = 0;
433 reg.Action = CS_READ;
434 reg.Offset = CISREG_COR;
435 reg.Value = 0;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200436 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700437 &reg);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400438 if (res != CS_SUCCESS) {
439 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 "
440 "(%d)\n", res);
441 return;
442 }
443 printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n",
444 reg.Value);
445 old_cor = reg.Value;
446
447 reg.Action = CS_WRITE;
448 reg.Value |= COR_SOFT_RESET;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200449 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700450 &reg);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400451 if (res != CS_SUCCESS) {
452 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 "
453 "(%d)\n", res);
454 return;
455 }
456
457 mdelay(10);
458
459 /* Setup Genesis mode */
460 reg.Action = CS_WRITE;
461 reg.Value = hcr;
462 reg.Offset = CISREG_CCSR;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200463 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700464 &reg);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400465 if (res != CS_SUCCESS) {
466 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 "
467 "(%d)\n", res);
468 return;
469 }
470 mdelay(10);
471
472 reg.Action = CS_WRITE;
473 reg.Offset = CISREG_COR;
474 reg.Value = old_cor & ~COR_SOFT_RESET;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200475 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700476 &reg);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400477 if (res != CS_SUCCESS) {
478 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 "
479 "(%d)\n", res);
480 return;
481 }
482
483 mdelay(10);
484}
485
486
Jouni Malinenff1d2762005-05-12 22:54:16 -0400487static struct prism2_helper_functions prism2_pccard_funcs =
488{
489 .card_present = prism2_pccard_card_present,
490 .cor_sreset = prism2_pccard_cor_sreset,
Jouni Malinenff1d2762005-05-12 22:54:16 -0400491 .genesis_reset = prism2_pccard_genesis_reset,
492 .hw_type = HOSTAP_HW_PCCARD,
493};
494
495
496/* allocate local data and register with CardServices
497 * initialize dev_link structure, but do not configure the card yet */
Dominik Brodowski15b99ac2006-03-31 17:26:06 +0200498static int hostap_cs_probe(struct pcmcia_device *p_dev)
Jouni Malinenff1d2762005-05-12 22:54:16 -0400499{
Dominik Brodowski15b99ac2006-03-31 17:26:06 +0200500 int ret;
501
Jouni Malinenff1d2762005-05-12 22:54:16 -0400502 PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info);
Dominik Brodowskifd238232006-03-05 10:45:09 +0100503 p_dev->conf.IntType = INT_MEMORY_AND_IO;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400504
Dominik Brodowski15b99ac2006-03-31 17:26:06 +0200505 ret = prism2_config(p_dev);
506 if (ret) {
Dominik Brodowskif8cfa612005-11-14 21:25:51 +0100507 PDEBUG(DEBUG_EXTRA, "prism2_config() failed\n");
Dominik Brodowski15b99ac2006-03-31 17:26:06 +0200508 }
Dominik Brodowskif8cfa612005-11-14 21:25:51 +0100509
Dominik Brodowski15b99ac2006-03-31 17:26:06 +0200510 return ret;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400511}
512
513
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200514static void prism2_detach(struct pcmcia_device *link)
Jouni Malinenff1d2762005-05-12 22:54:16 -0400515{
Jouni Malinenff1d2762005-05-12 22:54:16 -0400516 PDEBUG(DEBUG_FLOW, "prism2_detach\n");
517
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100518 prism2_release((u_long)link);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400519
Jouni Malinenff1d2762005-05-12 22:54:16 -0400520 /* release net devices */
521 if (link->priv) {
Jouni Malinenc3551842005-10-02 17:19:00 -0700522 struct hostap_cs_priv *hw_priv;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700523 struct net_device *dev;
524 struct hostap_interface *iface;
525 dev = link->priv;
526 iface = netdev_priv(dev);
Jouni Malinenc3551842005-10-02 17:19:00 -0700527 hw_priv = iface->local->hw_priv;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700528 prism2_free_local_data(dev);
Jouni Malinenc3551842005-10-02 17:19:00 -0700529 kfree(hw_priv);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400530 }
Jouni Malinenff1d2762005-05-12 22:54:16 -0400531}
532
533
534#define CS_CHECK(fn, ret) \
535do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
536
537#define CFG_CHECK2(fn, retf) \
538do { int ret = (retf); \
539if (ret != 0) { \
540 PDEBUG(DEBUG_EXTRA, "CardServices(" #fn ") returned %d\n", ret); \
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200541 cs_error(link, fn, ret); \
Jouni Malinenff1d2762005-05-12 22:54:16 -0400542 goto next_entry; \
543} \
544} while (0)
545
546
547/* run after a CARD_INSERTION event is received to configure the PCMCIA
548 * socket and make the device available to the system */
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200549static int prism2_config(struct pcmcia_device *link)
Jouni Malinenff1d2762005-05-12 22:54:16 -0400550{
551 struct net_device *dev;
552 struct hostap_interface *iface;
553 local_info_t *local;
554 int ret = 1;
555 tuple_t tuple;
556 cisparse_t *parse;
557 int last_fn, last_ret;
558 u_char buf[64];
559 config_info_t conf;
560 cistpl_cftable_entry_t dflt = { 0 };
Jouni Malinen67e0e472005-08-14 19:08:41 -0700561 struct hostap_cs_priv *hw_priv;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400562
563 PDEBUG(DEBUG_FLOW, "prism2_config()\n");
564
565 parse = kmalloc(sizeof(cisparse_t), GFP_KERNEL);
Jouni Malinen67e0e472005-08-14 19:08:41 -0700566 hw_priv = kmalloc(sizeof(*hw_priv), GFP_KERNEL);
567 if (parse == NULL || hw_priv == NULL) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400568 ret = -ENOMEM;
569 goto failed;
570 }
Jouni Malinen67e0e472005-08-14 19:08:41 -0700571 memset(hw_priv, 0, sizeof(*hw_priv));
Jouni Malinenff1d2762005-05-12 22:54:16 -0400572
573 tuple.DesiredTuple = CISTPL_CONFIG;
574 tuple.Attributes = 0;
575 tuple.TupleData = buf;
576 tuple.TupleDataMax = sizeof(buf);
577 tuple.TupleOffset = 0;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200578 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
579 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
580 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
Jouni Malinenff1d2762005-05-12 22:54:16 -0400581 link->conf.ConfigBase = parse->config.base;
582 link->conf.Present = parse->config.rmask[0];
583
584 CS_CHECK(GetConfigurationInfo,
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200585 pcmcia_get_configuration_info(link, &conf));
Jouni Malinenff1d2762005-05-12 22:54:16 -0400586
587 /* Look for an appropriate configuration table entry in the CIS */
588 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200589 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
Jouni Malinenff1d2762005-05-12 22:54:16 -0400590 for (;;) {
591 cistpl_cftable_entry_t *cfg = &(parse->cftable_entry);
592 CFG_CHECK2(GetTupleData,
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200593 pcmcia_get_tuple_data(link, &tuple));
Jouni Malinenff1d2762005-05-12 22:54:16 -0400594 CFG_CHECK2(ParseTuple,
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200595 pcmcia_parse_tuple(link, &tuple, parse));
Jouni Malinenff1d2762005-05-12 22:54:16 -0400596
597 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
598 dflt = *cfg;
599 if (cfg->index == 0)
600 goto next_entry;
601 link->conf.ConfigIndex = cfg->index;
602 PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X "
603 "(default 0x%02X)\n", cfg->index, dflt.index);
Jeff Garzik74fae822005-07-31 13:08:32 -0400604
Jouni Malinenff1d2762005-05-12 22:54:16 -0400605 /* Does this card need audio output? */
606 if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
607 link->conf.Attributes |= CONF_ENABLE_SPKR;
608 link->conf.Status = CCSR_AUDIO_ENA;
609 }
Jeff Garzik74fae822005-07-31 13:08:32 -0400610
Jouni Malinenff1d2762005-05-12 22:54:16 -0400611 /* Use power settings for Vcc and Vpp if present */
612 /* Note that the CIS values need to be rescaled */
613 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
614 if (conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] /
615 10000 && !ignore_cis_vcc) {
616 PDEBUG(DEBUG_EXTRA, " Vcc mismatch - skipping"
617 " this entry\n");
618 goto next_entry;
619 }
620 } else if (dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) {
621 if (conf.Vcc != dflt.vcc.param[CISTPL_POWER_VNOM] /
622 10000 && !ignore_cis_vcc) {
623 PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch "
624 "- skipping this entry\n");
625 goto next_entry;
626 }
627 }
628
629 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
Dominik Brodowski70294b42006-01-15 12:43:16 +0100630 link->conf.Vpp =
Jouni Malinenff1d2762005-05-12 22:54:16 -0400631 cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
632 else if (dflt.vpp1.present & (1 << CISTPL_POWER_VNOM))
Dominik Brodowski70294b42006-01-15 12:43:16 +0100633 link->conf.Vpp =
Jouni Malinenff1d2762005-05-12 22:54:16 -0400634 dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000;
635
636 /* Do we need to allocate an interrupt? */
637 if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1)
638 link->conf.Attributes |= CONF_ENABLE_IRQ;
639 else if (!(link->conf.Attributes & CONF_ENABLE_IRQ)) {
640 /* At least Compaq WL200 does not have IRQInfo1 set,
641 * but it does not work without interrupts.. */
642 printk("Config has no IRQ info, but trying to enable "
643 "IRQ anyway..\n");
644 link->conf.Attributes |= CONF_ENABLE_IRQ;
645 }
646
647 /* IO window settings */
648 PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d "
649 "dflt.io.nwin=%d\n",
650 cfg->io.nwin, dflt.io.nwin);
651 link->io.NumPorts1 = link->io.NumPorts2 = 0;
652 if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) {
653 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt.io;
654 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
655 PDEBUG(DEBUG_EXTRA, "io->flags = 0x%04X, "
656 "io.base=0x%04x, len=%d\n", io->flags,
657 io->win[0].base, io->win[0].len);
658 if (!(io->flags & CISTPL_IO_8BIT))
659 link->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
660 if (!(io->flags & CISTPL_IO_16BIT))
661 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
662 link->io.IOAddrLines = io->flags &
663 CISTPL_IO_LINES_MASK;
664 link->io.BasePort1 = io->win[0].base;
665 link->io.NumPorts1 = io->win[0].len;
666 if (io->nwin > 1) {
667 link->io.Attributes2 = link->io.Attributes1;
668 link->io.BasePort2 = io->win[1].base;
669 link->io.NumPorts2 = io->win[1].len;
670 }
671 }
672
673 /* This reserves IO space but doesn't actually enable it */
674 CFG_CHECK2(RequestIO,
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200675 pcmcia_request_io(link, &link->io));
Jouni Malinenff1d2762005-05-12 22:54:16 -0400676
677 /* This configuration table entry is OK */
678 break;
679
680 next_entry:
681 CS_CHECK(GetNextTuple,
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200682 pcmcia_get_next_tuple(link, &tuple));
Jouni Malinenff1d2762005-05-12 22:54:16 -0400683 }
684
685 /* Need to allocate net_device before requesting IRQ handler */
Dave Hansen0cd545d2005-07-30 12:49:58 -0700686 dev = prism2_init_local_data(&prism2_pccard_funcs, 0,
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200687 &handle_to_dev(link));
Jouni Malinenff1d2762005-05-12 22:54:16 -0400688 if (dev == NULL)
689 goto failed;
690 link->priv = dev;
691
Jouni Malinenfbff8682005-08-28 17:53:32 -0700692 iface = netdev_priv(dev);
693 local = iface->local;
694 local->hw_priv = hw_priv;
695 hw_priv->link = link;
696 strcpy(hw_priv->node.dev_name, dev->name);
Dominik Brodowskifd238232006-03-05 10:45:09 +0100697 link->dev_node = &hw_priv->node;
Jouni Malinenfbff8682005-08-28 17:53:32 -0700698
Jouni Malinenff1d2762005-05-12 22:54:16 -0400699 /*
700 * Allocate an interrupt line. Note that this does not assign a
701 * handler to the interrupt, unless the 'Handler' member of the
702 * irq structure is initialized.
703 */
704 if (link->conf.Attributes & CONF_ENABLE_IRQ) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400705 link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
Jar0ef79ee2005-07-30 12:49:57 -0700706 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400707 link->irq.Handler = prism2_interrupt;
708 link->irq.Instance = dev;
709 CS_CHECK(RequestIRQ,
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200710 pcmcia_request_irq(link, &link->irq));
Jouni Malinenff1d2762005-05-12 22:54:16 -0400711 }
712
713 /*
714 * This actually configures the PCMCIA socket -- setting up
715 * the I/O windows and the interrupt mapping, and putting the
716 * card and host interface into "Memory and IO" mode.
717 */
718 CS_CHECK(RequestConfiguration,
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200719 pcmcia_request_configuration(link, &link->conf));
Jouni Malinenff1d2762005-05-12 22:54:16 -0400720
721 dev->irq = link->irq.AssignedIRQ;
722 dev->base_addr = link->io.BasePort1;
723
724 /* Finally, report what we've done */
Dominik Brodowski70294b42006-01-15 12:43:16 +0100725 printk(KERN_INFO "%s: index 0x%02x: ",
726 dev_info, link->conf.ConfigIndex);
727 if (link->conf.Vpp)
728 printk(", Vpp %d.%d", link->conf.Vpp / 10,
729 link->conf.Vpp % 10);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400730 if (link->conf.Attributes & CONF_ENABLE_IRQ)
731 printk(", irq %d", link->irq.AssignedIRQ);
732 if (link->io.NumPorts1)
733 printk(", io 0x%04x-0x%04x", link->io.BasePort1,
734 link->io.BasePort1+link->io.NumPorts1-1);
735 if (link->io.NumPorts2)
736 printk(" & 0x%04x-0x%04x", link->io.BasePort2,
737 link->io.BasePort2+link->io.NumPorts2-1);
738 printk("\n");
739
Jouni Malinenff1d2762005-05-12 22:54:16 -0400740 local->shutdown = 0;
741
742 sandisk_enable_wireless(dev);
743
744 ret = prism2_hw_config(dev, 1);
745 if (!ret) {
746 ret = hostap_hw_ready(dev);
747 if (ret == 0 && local->ddev)
Jouni Malinen67e0e472005-08-14 19:08:41 -0700748 strcpy(hw_priv->node.dev_name, local->ddev->name);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400749 }
750 kfree(parse);
751 return ret;
752
753 cs_failed:
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200754 cs_error(link, last_fn, last_ret);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400755
756 failed:
757 kfree(parse);
Jouni Malinen67e0e472005-08-14 19:08:41 -0700758 kfree(hw_priv);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400759 prism2_release((u_long)link);
760 return ret;
761}
762
763
764static void prism2_release(u_long arg)
765{
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200766 struct pcmcia_device *link = (struct pcmcia_device *)arg;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400767
768 PDEBUG(DEBUG_FLOW, "prism2_release\n");
769
770 if (link->priv) {
771 struct net_device *dev = link->priv;
772 struct hostap_interface *iface;
773
774 iface = netdev_priv(dev);
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100775 prism2_hw_shutdown(dev, 0);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400776 iface->local->shutdown = 1;
777 }
778
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200779 pcmcia_disable_device(link);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400780 PDEBUG(DEBUG_FLOW, "release - done\n");
781}
782
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200783static int hostap_cs_suspend(struct pcmcia_device *link)
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100784{
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100785 struct net_device *dev = (struct net_device *) link->priv;
786 int dev_open = 0;
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100787 struct hostap_interface *iface = NULL;
788
789 if (dev)
790 iface = netdev_priv(dev);
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100791
792 PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_SUSPEND\n", dev_info);
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100793 if (iface && iface->local)
794 dev_open = iface->local->num_dev_open > 0;
795 if (dev_open) {
796 netif_stop_queue(dev);
797 netif_device_detach(dev);
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100798 }
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100799 prism2_suspend(dev);
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100800
801 return 0;
802}
803
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200804static int hostap_cs_resume(struct pcmcia_device *link)
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100805{
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100806 struct net_device *dev = (struct net_device *) link->priv;
807 int dev_open = 0;
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100808 struct hostap_interface *iface = NULL;
809
810 if (dev)
811 iface = netdev_priv(dev);
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100812
813 PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_RESUME\n", dev_info);
814
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100815 if (iface && iface->local)
816 dev_open = iface->local->num_dev_open > 0;
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100817
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100818 prism2_hw_shutdown(dev, 1);
819 prism2_hw_config(dev, dev_open ? 0 : 1);
820 if (dev_open) {
821 netif_device_attach(dev);
822 netif_start_queue(dev);
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100823 }
824
825 return 0;
826}
Jouni Malinenff1d2762005-05-12 22:54:16 -0400827
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700828static struct pcmcia_device_id hostap_cs_ids[] = {
829 PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100),
830 PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300),
831 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777),
832 PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000),
833 PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002),
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700834 PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002),
Richard Purdie1e4adbd2005-08-04 00:16:27 +0100835 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x030b),
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700836 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612),
837 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613),
838 PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002),
839 PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002),
840 PCMCIA_DEVICE_MANF_CARD(0x02d2, 0x0001),
841 PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x0001),
842 PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300),
Komurofd99ddd072006-04-17 21:41:21 +0900843/* PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000), conflict with pcnet_cs */
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700844 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
845 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
846 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010),
Christian Steineck884d3a22006-09-08 23:51:34 +0200847 PCMCIA_DEVICE_MANF_CARD(0x0126, 0x0002),
Pavel Roskin40e3cad2006-02-28 01:18:31 -0500848 PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "INTERSIL",
849 0x74c5e40d),
850 PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "Intersil",
851 0x4b801a17),
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700852 PCMCIA_MFC_DEVICE_PROD_ID12(0, "SanDisk", "ConnectPlus",
853 0x7a954bd9, 0x74be00c6),
854 PCMCIA_DEVICE_PROD_ID1234(
855 "Intersil", "PRISM 2_5 PCMCIA ADAPTER", "ISL37300P",
856 "Eval-RevA",
857 0x4b801a17, 0x6345a0bf, 0xc9049a39, 0xc23adc0e),
858 PCMCIA_DEVICE_PROD_ID123(
859 "Addtron", "AWP-100 Wireless PCMCIA", "Version 01.02",
860 0xe6ec52ce, 0x08649af2, 0x4b74baa0),
861 PCMCIA_DEVICE_PROD_ID123(
862 "D", "Link DWL-650 11Mbps WLAN Card", "Version 01.02",
863 0x71b18589, 0xb6f1b0ab, 0x4b74baa0),
864 PCMCIA_DEVICE_PROD_ID123(
865 "Instant Wireless ", " Network PC CARD", "Version 01.02",
866 0x11d901af, 0x6e9bd926, 0x4b74baa0),
867 PCMCIA_DEVICE_PROD_ID123(
868 "SMC", "SMC2632W", "Version 01.02",
869 0xc4f8b18b, 0x474a1f2a, 0x4b74baa0),
Richard Purdie1e4adbd2005-08-04 00:16:27 +0100870 PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-CF-S11G",
Jouni Malinen6c5b90d2005-08-28 10:51:36 -0700871 0x2decece3, 0x82067c18),
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700872 PCMCIA_DEVICE_PROD_ID12("Compaq", "WL200_11Mbps_Wireless_PCI_Card",
873 0x54f7c49c, 0x15a75e5b),
874 PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE",
875 0x74c5e40d, 0xdb472a18),
876 PCMCIA_DEVICE_PROD_ID12("Linksys", "Wireless CompactFlash Card",
877 0x0733cc81, 0x0c52f395),
878 PCMCIA_DEVICE_PROD_ID12(
879 "ZoomAir 11Mbps High", "Rate wireless Networking",
880 0x273fe3db, 0x32a1eaee),
Marcin Juszkiewiczdf8ccb92006-05-22 10:56:55 +0200881 PCMCIA_DEVICE_PROD_ID123(
882 "Pretec", "CompactWLAN Card 802.11b", "2.5",
883 0x1cadd3e5, 0xe697636c, 0x7a5bfcf1),
884 PCMCIA_DEVICE_PROD_ID123(
885 "U.S. Robotics", "IEEE 802.11b PC-CARD", "Version 01.02",
886 0xc7b8df9d, 0x1700d087, 0x4b74baa0),
Dominik Brodowski01918d12006-07-02 21:21:51 +0200887 PCMCIA_DEVICE_PROD_ID123(
888 "Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio",
889 "Ver. 1.00",
890 0x5cd01705, 0x4271660f, 0x9d08ee12),
891 PCMCIA_DEVICE_PROD_ID123(
892 "corega", "WL PCCL-11", "ISL37300P",
893 0xa21501a, 0x59868926, 0xc9049a39),
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700894 PCMCIA_DEVICE_NULL
895};
896MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids);
897
898
Jouni Malinenff1d2762005-05-12 22:54:16 -0400899static struct pcmcia_driver hostap_driver = {
900 .drv = {
901 .name = "hostap_cs",
902 },
Dominik Brodowski15b99ac2006-03-31 17:26:06 +0200903 .probe = hostap_cs_probe,
Dominik Brodowskicc3b4862005-11-14 21:23:14 +0100904 .remove = prism2_detach,
Jouni Malinenff1d2762005-05-12 22:54:16 -0400905 .owner = THIS_MODULE,
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700906 .id_table = hostap_cs_ids,
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100907 .suspend = hostap_cs_suspend,
908 .resume = hostap_cs_resume,
Jouni Malinenff1d2762005-05-12 22:54:16 -0400909};
910
911static int __init init_prism2_pccard(void)
912{
913 printk(KERN_INFO "%s: %s\n", dev_info, version);
914 return pcmcia_register_driver(&hostap_driver);
915}
916
917static void __exit exit_prism2_pccard(void)
918{
919 pcmcia_unregister_driver(&hostap_driver);
920 printk(KERN_INFO "%s: Driver unloaded\n", dev_info);
921}
922
923
924module_init(init_prism2_pccard);
925module_exit(exit_prism2_pccard);