blob: 31b60dd87bfe430cca4c10a004756970db6b29a5 [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
Jouni Malinenff1d2762005-05-12 22:54:16 -040025static dev_info_t dev_info = "hostap_cs";
Jouni Malinenff1d2762005-05-12 22:54:16 -040026
27MODULE_AUTHOR("Jouni Malinen");
28MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN "
29 "cards (PC Card).");
30MODULE_SUPPORTED_DEVICE("Intersil Prism2-based WLAN cards (PC Card)");
31MODULE_LICENSE("GPL");
32
33
Jouni Malinenff1d2762005-05-12 22:54:16 -040034static int ignore_cis_vcc;
35module_param(ignore_cis_vcc, int, 0444);
36MODULE_PARM_DESC(ignore_cis_vcc, "Ignore broken CIS VCC entry");
37
38
Jouni Malinen67e0e472005-08-14 19:08:41 -070039/* struct local_info::hw_priv */
40struct hostap_cs_priv {
41 dev_node_t node;
Dominik Brodowskifba395e2006-03-31 17:21:06 +020042 struct pcmcia_device *link;
Jouni Malinen67e0e472005-08-14 19:08:41 -070043 int sandisk_connectplus;
44};
45
46
Jouni Malinenff1d2762005-05-12 22:54:16 -040047#ifdef PRISM2_IO_DEBUG
48
49static inline void hfa384x_outb_debug(struct net_device *dev, int a, u8 v)
50{
51 struct hostap_interface *iface;
52 local_info_t *local;
53 unsigned long flags;
54
55 iface = netdev_priv(dev);
56 local = iface->local;
57 spin_lock_irqsave(&local->lock, flags);
58 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTB, a, v);
59 outb(v, dev->base_addr + a);
60 spin_unlock_irqrestore(&local->lock, flags);
61}
62
63static inline u8 hfa384x_inb_debug(struct net_device *dev, int a)
64{
65 struct hostap_interface *iface;
66 local_info_t *local;
67 unsigned long flags;
68 u8 v;
69
70 iface = netdev_priv(dev);
71 local = iface->local;
72 spin_lock_irqsave(&local->lock, flags);
73 v = inb(dev->base_addr + a);
74 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INB, a, v);
75 spin_unlock_irqrestore(&local->lock, flags);
76 return v;
77}
78
79static inline void hfa384x_outw_debug(struct net_device *dev, int a, u16 v)
80{
81 struct hostap_interface *iface;
82 local_info_t *local;
83 unsigned long flags;
84
85 iface = netdev_priv(dev);
86 local = iface->local;
87 spin_lock_irqsave(&local->lock, flags);
88 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTW, a, v);
89 outw(v, dev->base_addr + a);
90 spin_unlock_irqrestore(&local->lock, flags);
91}
92
93static inline u16 hfa384x_inw_debug(struct net_device *dev, int a)
94{
95 struct hostap_interface *iface;
96 local_info_t *local;
97 unsigned long flags;
98 u16 v;
99
100 iface = netdev_priv(dev);
101 local = iface->local;
102 spin_lock_irqsave(&local->lock, flags);
103 v = inw(dev->base_addr + a);
104 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INW, a, v);
105 spin_unlock_irqrestore(&local->lock, flags);
106 return v;
107}
108
109static inline void hfa384x_outsw_debug(struct net_device *dev, int a,
110 u8 *buf, int wc)
111{
112 struct hostap_interface *iface;
113 local_info_t *local;
114 unsigned long flags;
115
116 iface = netdev_priv(dev);
117 local = iface->local;
118 spin_lock_irqsave(&local->lock, flags);
119 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTSW, a, wc);
120 outsw(dev->base_addr + a, buf, wc);
121 spin_unlock_irqrestore(&local->lock, flags);
122}
123
124static inline void hfa384x_insw_debug(struct net_device *dev, int a,
125 u8 *buf, int wc)
126{
127 struct hostap_interface *iface;
128 local_info_t *local;
129 unsigned long flags;
130
131 iface = netdev_priv(dev);
132 local = iface->local;
133 spin_lock_irqsave(&local->lock, flags);
134 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INSW, a, wc);
135 insw(dev->base_addr + a, buf, wc);
136 spin_unlock_irqrestore(&local->lock, flags);
137}
138
139#define HFA384X_OUTB(v,a) hfa384x_outb_debug(dev, (a), (v))
140#define HFA384X_INB(a) hfa384x_inb_debug(dev, (a))
141#define HFA384X_OUTW(v,a) hfa384x_outw_debug(dev, (a), (v))
142#define HFA384X_INW(a) hfa384x_inw_debug(dev, (a))
143#define HFA384X_OUTSW(a, buf, wc) hfa384x_outsw_debug(dev, (a), (buf), (wc))
144#define HFA384X_INSW(a, buf, wc) hfa384x_insw_debug(dev, (a), (buf), (wc))
145
146#else /* PRISM2_IO_DEBUG */
147
148#define HFA384X_OUTB(v,a) outb((v), dev->base_addr + (a))
149#define HFA384X_INB(a) inb(dev->base_addr + (a))
150#define HFA384X_OUTW(v,a) outw((v), dev->base_addr + (a))
151#define HFA384X_INW(a) inw(dev->base_addr + (a))
152#define HFA384X_INSW(a, buf, wc) insw(dev->base_addr + (a), buf, wc)
153#define HFA384X_OUTSW(a, buf, wc) outsw(dev->base_addr + (a), buf, wc)
154
155#endif /* PRISM2_IO_DEBUG */
156
157
158static int hfa384x_from_bap(struct net_device *dev, u16 bap, void *buf,
159 int len)
160{
161 u16 d_off;
162 u16 *pos;
163
164 d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF;
165 pos = (u16 *) buf;
166
167 if (len / 2)
168 HFA384X_INSW(d_off, buf, len / 2);
169 pos += len / 2;
170
171 if (len & 1)
172 *((char *) pos) = HFA384X_INB(d_off);
173
174 return 0;
175}
176
177
178static int hfa384x_to_bap(struct net_device *dev, u16 bap, void *buf, int len)
179{
180 u16 d_off;
181 u16 *pos;
182
183 d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF;
184 pos = (u16 *) buf;
185
186 if (len / 2)
187 HFA384X_OUTSW(d_off, buf, len / 2);
188 pos += len / 2;
189
190 if (len & 1)
191 HFA384X_OUTB(*((char *) pos), d_off);
192
193 return 0;
194}
195
196
197/* FIX: This might change at some point.. */
198#include "hostap_hw.c"
199
200
201
Dominik Brodowskicc3b4862005-11-14 21:23:14 +0100202static void prism2_detach(struct pcmcia_device *p_dev);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400203static void prism2_release(u_long arg);
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200204static int prism2_config(struct pcmcia_device *link);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400205
206
207static int prism2_pccard_card_present(local_info_t *local)
208{
Jouni Malinen67e0e472005-08-14 19:08:41 -0700209 struct hostap_cs_priv *hw_priv = local->hw_priv;
Dominik Brodowski9940ec32006-03-05 11:04:33 +0100210 if (hw_priv != NULL && hw_priv->link != NULL && pcmcia_dev_present(hw_priv->link))
Jouni Malinenff1d2762005-05-12 22:54:16 -0400211 return 1;
212 return 0;
213}
214
215
216/*
217 * SanDisk CompactFlash WLAN Flashcard - Product Manual v1.0
218 * Document No. 20-10-00058, January 2004
219 * http://www.sandisk.com/pdf/industrial/ProdManualCFWLANv1.0.pdf
220 */
221#define SANDISK_WLAN_ACTIVATION_OFF 0x40
222#define SANDISK_HCR_OFF 0x42
223
224
225static void sandisk_set_iobase(local_info_t *local)
226{
227 int res;
228 conf_reg_t reg;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700229 struct hostap_cs_priv *hw_priv = local->hw_priv;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400230
231 reg.Function = 0;
232 reg.Action = CS_WRITE;
233 reg.Offset = 0x10; /* 0x3f0 IO base 1 */
Jouni Malinen67e0e472005-08-14 19:08:41 -0700234 reg.Value = hw_priv->link->io.BasePort1 & 0x00ff;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200235 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700236 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200237 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400238 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -"
239 " res=%d\n", res);
240 }
241 udelay(10);
242
243 reg.Function = 0;
244 reg.Action = CS_WRITE;
245 reg.Offset = 0x12; /* 0x3f2 IO base 2 */
Jouni Malinen67e0e472005-08-14 19:08:41 -0700246 reg.Value = (hw_priv->link->io.BasePort1 & 0xff00) >> 8;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200247 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700248 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200249 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400250 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -"
251 " res=%d\n", res);
252 }
253}
254
255
256static void sandisk_write_hcr(local_info_t *local, int hcr)
257{
258 struct net_device *dev = local->dev;
259 int i;
260
261 HFA384X_OUTB(0x80, SANDISK_WLAN_ACTIVATION_OFF);
262 udelay(50);
263 for (i = 0; i < 10; i++) {
264 HFA384X_OUTB(hcr, SANDISK_HCR_OFF);
265 }
266 udelay(55);
267 HFA384X_OUTB(0x45, SANDISK_WLAN_ACTIVATION_OFF);
268}
269
270
271static int sandisk_enable_wireless(struct net_device *dev)
272{
273 int res, ret = 0;
274 conf_reg_t reg;
Yoann Padioleau6dbc9c82007-08-03 19:37:16 +0200275 struct hostap_interface *iface = netdev_priv(dev);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400276 local_info_t *local = iface->local;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700277 struct hostap_cs_priv *hw_priv = local->hw_priv;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400278
Jouni Malinen67e0e472005-08-14 19:08:41 -0700279 if (hw_priv->link->io.NumPorts1 < 0x42) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400280 /* Not enough ports to be SanDisk multi-function card */
281 ret = -ENODEV;
282 goto done;
283 }
284
Dominik Brodowskiefd50582006-10-25 21:28:53 -0400285 if (hw_priv->link->manf_id != 0xd601 || hw_priv->link->card_id != 0x0101) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400286 /* No SanDisk manfid found */
287 ret = -ENODEV;
288 goto done;
289 }
290
Dominik Brodowski7d2e8d02009-10-18 18:22:32 +0200291 if (hw_priv->link->socket->functions < 2) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400292 /* No multi-function links found */
293 ret = -ENODEV;
294 goto done;
295 }
296
297 printk(KERN_DEBUG "%s: Multi-function SanDisk ConnectPlus detected"
298 " - using vendor-specific initialization\n", dev->name);
Jouni Malinen67e0e472005-08-14 19:08:41 -0700299 hw_priv->sandisk_connectplus = 1;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400300
301 reg.Function = 0;
302 reg.Action = CS_WRITE;
303 reg.Offset = CISREG_COR;
304 reg.Value = COR_SOFT_RESET;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200305 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700306 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200307 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400308 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
309 dev->name, res);
310 goto done;
311 }
312 mdelay(5);
313
314 reg.Function = 0;
315 reg.Action = CS_WRITE;
316 reg.Offset = CISREG_COR;
317 /*
318 * Do not enable interrupts here to avoid some bogus events. Interrupts
319 * will be enabled during the first cor_sreset call.
320 */
321 reg.Value = COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | COR_FUNC_ENA;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200322 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700323 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200324 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400325 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
326 dev->name, res);
327 goto done;
328 }
329 mdelay(5);
330
331 sandisk_set_iobase(local);
332
333 HFA384X_OUTB(0xc5, SANDISK_WLAN_ACTIVATION_OFF);
334 udelay(10);
335 HFA384X_OUTB(0x4b, SANDISK_WLAN_ACTIVATION_OFF);
336 udelay(10);
337
338done:
Jouni Malinenff1d2762005-05-12 22:54:16 -0400339 return ret;
340}
341
342
343static void prism2_pccard_cor_sreset(local_info_t *local)
344{
345 int res;
346 conf_reg_t reg;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700347 struct hostap_cs_priv *hw_priv = local->hw_priv;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400348
349 if (!prism2_pccard_card_present(local))
350 return;
351
352 reg.Function = 0;
353 reg.Action = CS_READ;
354 reg.Offset = CISREG_COR;
355 reg.Value = 0;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200356 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700357 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200358 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400359 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n",
360 res);
361 return;
362 }
363 printk(KERN_DEBUG "prism2_pccard_cor_sreset: original COR %02x\n",
364 reg.Value);
365
366 reg.Action = CS_WRITE;
367 reg.Value |= COR_SOFT_RESET;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200368 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700369 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200370 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400371 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n",
372 res);
373 return;
374 }
375
Jouni Malinen67e0e472005-08-14 19:08:41 -0700376 mdelay(hw_priv->sandisk_connectplus ? 5 : 2);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400377
378 reg.Value &= ~COR_SOFT_RESET;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700379 if (hw_priv->sandisk_connectplus)
Jouni Malinenff1d2762005-05-12 22:54:16 -0400380 reg.Value |= COR_IREQ_ENA;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200381 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700382 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200383 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400384 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n",
385 res);
386 return;
387 }
388
Jouni Malinen67e0e472005-08-14 19:08:41 -0700389 mdelay(hw_priv->sandisk_connectplus ? 5 : 2);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400390
Jouni Malinen67e0e472005-08-14 19:08:41 -0700391 if (hw_priv->sandisk_connectplus)
Jouni Malinenff1d2762005-05-12 22:54:16 -0400392 sandisk_set_iobase(local);
393}
394
395
396static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
397{
398 int res;
399 conf_reg_t reg;
400 int old_cor;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700401 struct hostap_cs_priv *hw_priv = local->hw_priv;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400402
403 if (!prism2_pccard_card_present(local))
404 return;
405
Jouni Malinen67e0e472005-08-14 19:08:41 -0700406 if (hw_priv->sandisk_connectplus) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400407 sandisk_write_hcr(local, hcr);
408 return;
409 }
410
411 reg.Function = 0;
412 reg.Action = CS_READ;
413 reg.Offset = CISREG_COR;
414 reg.Value = 0;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200415 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700416 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200417 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400418 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 "
419 "(%d)\n", res);
420 return;
421 }
422 printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n",
423 reg.Value);
424 old_cor = reg.Value;
425
426 reg.Action = CS_WRITE;
427 reg.Value |= COR_SOFT_RESET;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200428 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700429 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200430 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400431 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 "
432 "(%d)\n", res);
433 return;
434 }
435
436 mdelay(10);
437
438 /* Setup Genesis mode */
439 reg.Action = CS_WRITE;
440 reg.Value = hcr;
441 reg.Offset = CISREG_CCSR;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200442 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700443 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200444 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400445 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 "
446 "(%d)\n", res);
447 return;
448 }
449 mdelay(10);
450
451 reg.Action = CS_WRITE;
452 reg.Offset = CISREG_COR;
453 reg.Value = old_cor & ~COR_SOFT_RESET;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200454 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700455 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200456 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400457 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 "
458 "(%d)\n", res);
459 return;
460 }
461
462 mdelay(10);
463}
464
465
Jouni Malinenff1d2762005-05-12 22:54:16 -0400466static struct prism2_helper_functions prism2_pccard_funcs =
467{
468 .card_present = prism2_pccard_card_present,
469 .cor_sreset = prism2_pccard_cor_sreset,
Jouni Malinenff1d2762005-05-12 22:54:16 -0400470 .genesis_reset = prism2_pccard_genesis_reset,
471 .hw_type = HOSTAP_HW_PCCARD,
472};
473
474
475/* allocate local data and register with CardServices
476 * initialize dev_link structure, but do not configure the card yet */
Dominik Brodowski15b99ac2006-03-31 17:26:06 +0200477static int hostap_cs_probe(struct pcmcia_device *p_dev)
Jouni Malinenff1d2762005-05-12 22:54:16 -0400478{
Dominik Brodowski15b99ac2006-03-31 17:26:06 +0200479 int ret;
480
Jouni Malinenff1d2762005-05-12 22:54:16 -0400481 PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info);
Dominik Brodowskifd238232006-03-05 10:45:09 +0100482 p_dev->conf.IntType = INT_MEMORY_AND_IO;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400483
Dominik Brodowski15b99ac2006-03-31 17:26:06 +0200484 ret = prism2_config(p_dev);
485 if (ret) {
Dominik Brodowskif8cfa612005-11-14 21:25:51 +0100486 PDEBUG(DEBUG_EXTRA, "prism2_config() failed\n");
Dominik Brodowski15b99ac2006-03-31 17:26:06 +0200487 }
Dominik Brodowskif8cfa612005-11-14 21:25:51 +0100488
Dominik Brodowski15b99ac2006-03-31 17:26:06 +0200489 return ret;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400490}
491
492
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200493static void prism2_detach(struct pcmcia_device *link)
Jouni Malinenff1d2762005-05-12 22:54:16 -0400494{
Jouni Malinenff1d2762005-05-12 22:54:16 -0400495 PDEBUG(DEBUG_FLOW, "prism2_detach\n");
496
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100497 prism2_release((u_long)link);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400498
Jouni Malinenff1d2762005-05-12 22:54:16 -0400499 /* release net devices */
500 if (link->priv) {
Jouni Malinenc3551842005-10-02 17:19:00 -0700501 struct hostap_cs_priv *hw_priv;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700502 struct net_device *dev;
503 struct hostap_interface *iface;
504 dev = link->priv;
505 iface = netdev_priv(dev);
Jouni Malinenc3551842005-10-02 17:19:00 -0700506 hw_priv = iface->local->hw_priv;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700507 prism2_free_local_data(dev);
Jouni Malinenc3551842005-10-02 17:19:00 -0700508 kfree(hw_priv);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400509 }
Jouni Malinenff1d2762005-05-12 22:54:16 -0400510}
511
512
513#define CS_CHECK(fn, ret) \
514do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
515
Jouni Malinenff1d2762005-05-12 22:54:16 -0400516
517/* run after a CARD_INSERTION event is received to configure the PCMCIA
518 * socket and make the device available to the system */
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200519
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200520static int prism2_config_check(struct pcmcia_device *p_dev,
521 cistpl_cftable_entry_t *cfg,
Dominik Brodowski8e2fc392008-08-02 15:30:31 +0200522 cistpl_cftable_entry_t *dflt,
Dominik Brodowskiad913c12008-08-02 16:12:00 +0200523 unsigned int vcc,
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200524 void *priv_data)
525{
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200526 if (cfg->index == 0)
527 return -ENODEV;
528
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200529 PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X "
Dominik Brodowski8e2fc392008-08-02 15:30:31 +0200530 "(default 0x%02X)\n", cfg->index, dflt->index);
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200531
532 /* Does this card need audio output? */
533 if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
534 p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
535 p_dev->conf.Status = CCSR_AUDIO_ENA;
536 }
537
538 /* Use power settings for Vcc and Vpp if present */
539 /* Note that the CIS values need to be rescaled */
540 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
Dominik Brodowskiad913c12008-08-02 16:12:00 +0200541 if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] /
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200542 10000 && !ignore_cis_vcc) {
543 PDEBUG(DEBUG_EXTRA, " Vcc mismatch - skipping"
544 " this entry\n");
545 return -ENODEV;
546 }
Dominik Brodowski8e2fc392008-08-02 15:30:31 +0200547 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
Dominik Brodowskiad913c12008-08-02 16:12:00 +0200548 if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] /
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200549 10000 && !ignore_cis_vcc) {
550 PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch "
551 "- skipping this entry\n");
552 return -ENODEV;
553 }
554 }
555
556 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
557 p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
Dominik Brodowski8e2fc392008-08-02 15:30:31 +0200558 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
559 p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200560
561 /* Do we need to allocate an interrupt? */
Dominik Brodowski8e2fc392008-08-02 15:30:31 +0200562 if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1)
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200563 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
564 else if (!(p_dev->conf.Attributes & CONF_ENABLE_IRQ)) {
565 /* At least Compaq WL200 does not have IRQInfo1 set,
566 * but it does not work without interrupts.. */
567 printk(KERN_WARNING "Config has no IRQ info, but trying to "
568 "enable IRQ anyway..\n");
569 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
570 }
571
572 /* IO window settings */
573 PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d "
Dominik Brodowski8e2fc392008-08-02 15:30:31 +0200574 "dflt->io.nwin=%d\n",
575 cfg->io.nwin, dflt->io.nwin);
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200576 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
Dominik Brodowski8e2fc392008-08-02 15:30:31 +0200577 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
578 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200579 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
580 PDEBUG(DEBUG_EXTRA, "io->flags = 0x%04X, "
581 "io.base=0x%04x, len=%d\n", io->flags,
582 io->win[0].base, io->win[0].len);
583 if (!(io->flags & CISTPL_IO_8BIT))
584 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
585 if (!(io->flags & CISTPL_IO_16BIT))
586 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
587 p_dev->io.IOAddrLines = io->flags &
588 CISTPL_IO_LINES_MASK;
589 p_dev->io.BasePort1 = io->win[0].base;
590 p_dev->io.NumPorts1 = io->win[0].len;
591 if (io->nwin > 1) {
592 p_dev->io.Attributes2 = p_dev->io.Attributes1;
593 p_dev->io.BasePort2 = io->win[1].base;
594 p_dev->io.NumPorts2 = io->win[1].len;
595 }
596 }
597
598 /* This reserves IO space but doesn't actually enable it */
599 return pcmcia_request_io(p_dev, &p_dev->io);
600}
601
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200602static int prism2_config(struct pcmcia_device *link)
Jouni Malinenff1d2762005-05-12 22:54:16 -0400603{
604 struct net_device *dev;
605 struct hostap_interface *iface;
606 local_info_t *local;
607 int ret = 1;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400608 int last_fn, last_ret;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700609 struct hostap_cs_priv *hw_priv;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400610
611 PDEBUG(DEBUG_FLOW, "prism2_config()\n");
612
Yan Burmanb0471bb72006-12-02 13:33:40 +0200613 hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL);
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200614 if (hw_priv == NULL) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400615 ret = -ENOMEM;
616 goto failed;
617 }
618
Jouni Malinenff1d2762005-05-12 22:54:16 -0400619 /* Look for an appropriate configuration table entry in the CIS */
Dominik Brodowskiad913c12008-08-02 16:12:00 +0200620 last_ret = pcmcia_loop_config(link, prism2_config_check, NULL);
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200621 if (last_ret) {
622 if (!ignore_cis_vcc)
623 printk(KERN_ERR "GetNextTuple(): No matching "
624 "CIS configuration. Maybe you need the "
625 "ignore_cis_vcc=1 parameter.\n");
626 cs_error(link, RequestIO, last_ret);
627 goto failed;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400628 }
629
630 /* Need to allocate net_device before requesting IRQ handler */
Dave Hansen0cd545d2005-07-30 12:49:58 -0700631 dev = prism2_init_local_data(&prism2_pccard_funcs, 0,
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200632 &handle_to_dev(link));
Jouni Malinenff1d2762005-05-12 22:54:16 -0400633 if (dev == NULL)
634 goto failed;
635 link->priv = dev;
636
Jouni Malinenfbff8682005-08-28 17:53:32 -0700637 iface = netdev_priv(dev);
638 local = iface->local;
639 local->hw_priv = hw_priv;
640 hw_priv->link = link;
641 strcpy(hw_priv->node.dev_name, dev->name);
Dominik Brodowskifd238232006-03-05 10:45:09 +0100642 link->dev_node = &hw_priv->node;
Jouni Malinenfbff8682005-08-28 17:53:32 -0700643
Jouni Malinenff1d2762005-05-12 22:54:16 -0400644 /*
645 * Allocate an interrupt line. Note that this does not assign a
646 * handler to the interrupt, unless the 'Handler' member of the
647 * irq structure is initialized.
648 */
649 if (link->conf.Attributes & CONF_ENABLE_IRQ) {
Larry Fingerea9edaf2009-07-15 22:49:27 -0500650 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING |
651 IRQ_HANDLE_PRESENT;
Jar0ef79ee2005-07-30 12:49:57 -0700652 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400653 link->irq.Handler = prism2_interrupt;
654 link->irq.Instance = dev;
655 CS_CHECK(RequestIRQ,
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200656 pcmcia_request_irq(link, &link->irq));
Jouni Malinenff1d2762005-05-12 22:54:16 -0400657 }
658
659 /*
660 * This actually configures the PCMCIA socket -- setting up
661 * the I/O windows and the interrupt mapping, and putting the
662 * card and host interface into "Memory and IO" mode.
663 */
664 CS_CHECK(RequestConfiguration,
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200665 pcmcia_request_configuration(link, &link->conf));
Jouni Malinenff1d2762005-05-12 22:54:16 -0400666
667 dev->irq = link->irq.AssignedIRQ;
668 dev->base_addr = link->io.BasePort1;
669
670 /* Finally, report what we've done */
Dominik Brodowski70294b42006-01-15 12:43:16 +0100671 printk(KERN_INFO "%s: index 0x%02x: ",
672 dev_info, link->conf.ConfigIndex);
673 if (link->conf.Vpp)
674 printk(", Vpp %d.%d", link->conf.Vpp / 10,
675 link->conf.Vpp % 10);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400676 if (link->conf.Attributes & CONF_ENABLE_IRQ)
677 printk(", irq %d", link->irq.AssignedIRQ);
678 if (link->io.NumPorts1)
679 printk(", io 0x%04x-0x%04x", link->io.BasePort1,
680 link->io.BasePort1+link->io.NumPorts1-1);
681 if (link->io.NumPorts2)
682 printk(" & 0x%04x-0x%04x", link->io.BasePort2,
683 link->io.BasePort2+link->io.NumPorts2-1);
684 printk("\n");
685
Jouni Malinenff1d2762005-05-12 22:54:16 -0400686 local->shutdown = 0;
687
688 sandisk_enable_wireless(dev);
689
690 ret = prism2_hw_config(dev, 1);
691 if (!ret) {
692 ret = hostap_hw_ready(dev);
693 if (ret == 0 && local->ddev)
Jouni Malinen67e0e472005-08-14 19:08:41 -0700694 strcpy(hw_priv->node.dev_name, local->ddev->name);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400695 }
Jouni Malinenff1d2762005-05-12 22:54:16 -0400696 return ret;
697
698 cs_failed:
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200699 cs_error(link, last_fn, last_ret);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400700
701 failed:
Jouni Malinen67e0e472005-08-14 19:08:41 -0700702 kfree(hw_priv);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400703 prism2_release((u_long)link);
704 return ret;
705}
706
707
708static void prism2_release(u_long arg)
709{
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200710 struct pcmcia_device *link = (struct pcmcia_device *)arg;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400711
712 PDEBUG(DEBUG_FLOW, "prism2_release\n");
713
714 if (link->priv) {
715 struct net_device *dev = link->priv;
716 struct hostap_interface *iface;
717
718 iface = netdev_priv(dev);
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100719 prism2_hw_shutdown(dev, 0);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400720 iface->local->shutdown = 1;
721 }
722
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200723 pcmcia_disable_device(link);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400724 PDEBUG(DEBUG_FLOW, "release - done\n");
725}
726
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200727static int hostap_cs_suspend(struct pcmcia_device *link)
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100728{
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100729 struct net_device *dev = (struct net_device *) link->priv;
730 int dev_open = 0;
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100731 struct hostap_interface *iface = NULL;
732
John W. Linvillefcee7a02008-07-02 11:04:24 -0400733 if (!dev)
734 return -ENODEV;
735
736 iface = netdev_priv(dev);
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100737
738 PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_SUSPEND\n", dev_info);
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100739 if (iface && iface->local)
740 dev_open = iface->local->num_dev_open > 0;
741 if (dev_open) {
742 netif_stop_queue(dev);
743 netif_device_detach(dev);
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100744 }
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100745 prism2_suspend(dev);
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100746
747 return 0;
748}
749
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200750static int hostap_cs_resume(struct pcmcia_device *link)
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100751{
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100752 struct net_device *dev = (struct net_device *) link->priv;
753 int dev_open = 0;
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100754 struct hostap_interface *iface = NULL;
755
John W. Linvillefcee7a02008-07-02 11:04:24 -0400756 if (!dev)
757 return -ENODEV;
758
759 iface = netdev_priv(dev);
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100760
761 PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_RESUME\n", dev_info);
762
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100763 if (iface && iface->local)
764 dev_open = iface->local->num_dev_open > 0;
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100765
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100766 prism2_hw_shutdown(dev, 1);
767 prism2_hw_config(dev, dev_open ? 0 : 1);
768 if (dev_open) {
769 netif_device_attach(dev);
770 netif_start_queue(dev);
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100771 }
772
773 return 0;
774}
Jouni Malinenff1d2762005-05-12 22:54:16 -0400775
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700776static struct pcmcia_device_id hostap_cs_ids[] = {
777 PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100),
778 PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300),
779 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777),
780 PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000),
781 PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002),
Stefan Lippers-Hollmann46232d22007-10-05 23:42:51 +0200782 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x3301),
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700783 PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002),
Richard Purdie1e4adbd2005-08-04 00:16:27 +0100784 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x030b),
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700785 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612),
786 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613),
787 PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002),
788 PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002),
789 PCMCIA_DEVICE_MANF_CARD(0x02d2, 0x0001),
790 PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x0001),
791 PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300),
Komurofd99ddd072006-04-17 21:41:21 +0900792/* PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000), conflict with pcnet_cs */
Pavel Roskin449fecc2008-05-16 17:52:57 -0400793 PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002),
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700794 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
795 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
796 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010),
Christian Steineck884d3a22006-09-08 23:51:34 +0200797 PCMCIA_DEVICE_MANF_CARD(0x0126, 0x0002),
Marcin Juszkiewicz25ac6c22007-03-30 15:34:14 +0200798 PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0xd601, 0x0005, "ADLINK 345 CF",
799 0x2d858104),
Pavel Roskin40e3cad2006-02-28 01:18:31 -0500800 PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "INTERSIL",
801 0x74c5e40d),
802 PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "Intersil",
803 0x4b801a17),
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700804 PCMCIA_MFC_DEVICE_PROD_ID12(0, "SanDisk", "ConnectPlus",
805 0x7a954bd9, 0x74be00c6),
Pavel Roskin17f65f82008-01-09 22:16:58 -0500806 PCMCIA_DEVICE_PROD_ID123(
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700807 "Intersil", "PRISM 2_5 PCMCIA ADAPTER", "ISL37300P",
Pavel Roskin17f65f82008-01-09 22:16:58 -0500808 0x4b801a17, 0x6345a0bf, 0xc9049a39),
Jouni Malinen99d31842007-02-27 19:46:46 -0800809 /* D-Link DWL-650 Rev. P1; manfid 0x000b, 0x7110 */
Pavel Roskin17f65f82008-01-09 22:16:58 -0500810 PCMCIA_DEVICE_PROD_ID123(
Jouni Malinen99d31842007-02-27 19:46:46 -0800811 "D-Link", "DWL-650 Wireless PC Card RevP", "ISL37101P-10",
Pavel Roskin17f65f82008-01-09 22:16:58 -0500812 0x1a424a1c, 0x6ea57632, 0xdd97a26b),
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700813 PCMCIA_DEVICE_PROD_ID123(
814 "Addtron", "AWP-100 Wireless PCMCIA", "Version 01.02",
815 0xe6ec52ce, 0x08649af2, 0x4b74baa0),
816 PCMCIA_DEVICE_PROD_ID123(
817 "D", "Link DWL-650 11Mbps WLAN Card", "Version 01.02",
818 0x71b18589, 0xb6f1b0ab, 0x4b74baa0),
819 PCMCIA_DEVICE_PROD_ID123(
820 "Instant Wireless ", " Network PC CARD", "Version 01.02",
821 0x11d901af, 0x6e9bd926, 0x4b74baa0),
822 PCMCIA_DEVICE_PROD_ID123(
823 "SMC", "SMC2632W", "Version 01.02",
824 0xc4f8b18b, 0x474a1f2a, 0x4b74baa0),
Richard Purdie1e4adbd2005-08-04 00:16:27 +0100825 PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-CF-S11G",
Jouni Malinen6c5b90d2005-08-28 10:51:36 -0700826 0x2decece3, 0x82067c18),
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700827 PCMCIA_DEVICE_PROD_ID12("Compaq", "WL200_11Mbps_Wireless_PCI_Card",
828 0x54f7c49c, 0x15a75e5b),
829 PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE",
830 0x74c5e40d, 0xdb472a18),
831 PCMCIA_DEVICE_PROD_ID12("Linksys", "Wireless CompactFlash Card",
832 0x0733cc81, 0x0c52f395),
833 PCMCIA_DEVICE_PROD_ID12(
834 "ZoomAir 11Mbps High", "Rate wireless Networking",
835 0x273fe3db, 0x32a1eaee),
Marcin Juszkiewiczdf8ccb92006-05-22 10:56:55 +0200836 PCMCIA_DEVICE_PROD_ID123(
837 "Pretec", "CompactWLAN Card 802.11b", "2.5",
838 0x1cadd3e5, 0xe697636c, 0x7a5bfcf1),
839 PCMCIA_DEVICE_PROD_ID123(
840 "U.S. Robotics", "IEEE 802.11b PC-CARD", "Version 01.02",
841 0xc7b8df9d, 0x1700d087, 0x4b74baa0),
Dominik Brodowski01918d12006-07-02 21:21:51 +0200842 PCMCIA_DEVICE_PROD_ID123(
843 "Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio",
844 "Ver. 1.00",
845 0x5cd01705, 0x4271660f, 0x9d08ee12),
846 PCMCIA_DEVICE_PROD_ID123(
847 "corega", "WL PCCL-11", "ISL37300P",
848 0xa21501a, 0x59868926, 0xc9049a39),
Pavel Roskin17f65f82008-01-09 22:16:58 -0500849 PCMCIA_DEVICE_PROD_ID123(
Marcin Juszkiewicz04dd9d32007-10-07 20:51:08 +0200850 "The Linksys Group, Inc.", "Wireless Network CF Card", "ISL37300P",
Pavel Roskin17f65f82008-01-09 22:16:58 -0500851 0xa5f472c2, 0x9c05598d, 0xc9049a39),
Marcin Juszkiewicz5d635ea2008-01-29 09:42:53 +0100852 PCMCIA_DEVICE_PROD_ID123(
853 "Wireless LAN" , "11Mbps PC Card", "Version 01.02",
854 0x4b8870ff, 0x70e946d1, 0x4b74baa0),
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700855 PCMCIA_DEVICE_NULL
856};
857MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids);
858
859
Jouni Malinenff1d2762005-05-12 22:54:16 -0400860static struct pcmcia_driver hostap_driver = {
861 .drv = {
862 .name = "hostap_cs",
863 },
Dominik Brodowski15b99ac2006-03-31 17:26:06 +0200864 .probe = hostap_cs_probe,
Dominik Brodowskicc3b4862005-11-14 21:23:14 +0100865 .remove = prism2_detach,
Jouni Malinenff1d2762005-05-12 22:54:16 -0400866 .owner = THIS_MODULE,
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700867 .id_table = hostap_cs_ids,
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100868 .suspend = hostap_cs_suspend,
869 .resume = hostap_cs_resume,
Jouni Malinenff1d2762005-05-12 22:54:16 -0400870};
871
872static int __init init_prism2_pccard(void)
873{
Jouni Malinenff1d2762005-05-12 22:54:16 -0400874 return pcmcia_register_driver(&hostap_driver);
875}
876
877static void __exit exit_prism2_pccard(void)
878{
879 pcmcia_unregister_driver(&hostap_driver);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400880}
881
882
883module_init(init_prism2_pccard);
884module_exit(exit_prism2_pccard);