blob: 2f4b6d4350ab5a5de2c37a289ab7fe83760ebf51 [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>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +09006#include <linux/slab.h>
Jouni Malinenff1d2762005-05-12 22:54:16 -04007#include <linux/wait.h>
8#include <linux/timer.h>
9#include <linux/skbuff.h>
10#include <linux/netdevice.h>
11#include <linux/workqueue.h>
12#include <linux/wireless.h>
13#include <net/iw_handler.h>
14
Jouni Malinenff1d2762005-05-12 22:54:16 -040015#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
Dominik Brodowskiac8b4222010-07-21 22:38:13 +020025static char *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 {
Dominik Brodowskifba395e2006-03-31 17:21:06 +020041 struct pcmcia_device *link;
Jouni Malinen67e0e472005-08-14 19:08:41 -070042 int sandisk_connectplus;
43};
44
45
Jouni Malinenff1d2762005-05-12 22:54:16 -040046#ifdef PRISM2_IO_DEBUG
47
48static inline void hfa384x_outb_debug(struct net_device *dev, int a, u8 v)
49{
50 struct hostap_interface *iface;
51 local_info_t *local;
52 unsigned long flags;
53
54 iface = netdev_priv(dev);
55 local = iface->local;
56 spin_lock_irqsave(&local->lock, flags);
57 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTB, a, v);
58 outb(v, dev->base_addr + a);
59 spin_unlock_irqrestore(&local->lock, flags);
60}
61
62static inline u8 hfa384x_inb_debug(struct net_device *dev, int a)
63{
64 struct hostap_interface *iface;
65 local_info_t *local;
66 unsigned long flags;
67 u8 v;
68
69 iface = netdev_priv(dev);
70 local = iface->local;
71 spin_lock_irqsave(&local->lock, flags);
72 v = inb(dev->base_addr + a);
73 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INB, a, v);
74 spin_unlock_irqrestore(&local->lock, flags);
75 return v;
76}
77
78static inline void hfa384x_outw_debug(struct net_device *dev, int a, u16 v)
79{
80 struct hostap_interface *iface;
81 local_info_t *local;
82 unsigned long flags;
83
84 iface = netdev_priv(dev);
85 local = iface->local;
86 spin_lock_irqsave(&local->lock, flags);
87 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTW, a, v);
88 outw(v, dev->base_addr + a);
89 spin_unlock_irqrestore(&local->lock, flags);
90}
91
92static inline u16 hfa384x_inw_debug(struct net_device *dev, int a)
93{
94 struct hostap_interface *iface;
95 local_info_t *local;
96 unsigned long flags;
97 u16 v;
98
99 iface = netdev_priv(dev);
100 local = iface->local;
101 spin_lock_irqsave(&local->lock, flags);
102 v = inw(dev->base_addr + a);
103 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INW, a, v);
104 spin_unlock_irqrestore(&local->lock, flags);
105 return v;
106}
107
108static inline void hfa384x_outsw_debug(struct net_device *dev, int a,
109 u8 *buf, int wc)
110{
111 struct hostap_interface *iface;
112 local_info_t *local;
113 unsigned long flags;
114
115 iface = netdev_priv(dev);
116 local = iface->local;
117 spin_lock_irqsave(&local->lock, flags);
118 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_OUTSW, a, wc);
119 outsw(dev->base_addr + a, buf, wc);
120 spin_unlock_irqrestore(&local->lock, flags);
121}
122
123static inline void hfa384x_insw_debug(struct net_device *dev, int a,
124 u8 *buf, int wc)
125{
126 struct hostap_interface *iface;
127 local_info_t *local;
128 unsigned long flags;
129
130 iface = netdev_priv(dev);
131 local = iface->local;
132 spin_lock_irqsave(&local->lock, flags);
133 prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INSW, a, wc);
134 insw(dev->base_addr + a, buf, wc);
135 spin_unlock_irqrestore(&local->lock, flags);
136}
137
138#define HFA384X_OUTB(v,a) hfa384x_outb_debug(dev, (a), (v))
139#define HFA384X_INB(a) hfa384x_inb_debug(dev, (a))
140#define HFA384X_OUTW(v,a) hfa384x_outw_debug(dev, (a), (v))
141#define HFA384X_INW(a) hfa384x_inw_debug(dev, (a))
142#define HFA384X_OUTSW(a, buf, wc) hfa384x_outsw_debug(dev, (a), (buf), (wc))
143#define HFA384X_INSW(a, buf, wc) hfa384x_insw_debug(dev, (a), (buf), (wc))
144
145#else /* PRISM2_IO_DEBUG */
146
147#define HFA384X_OUTB(v,a) outb((v), dev->base_addr + (a))
148#define HFA384X_INB(a) inb(dev->base_addr + (a))
149#define HFA384X_OUTW(v,a) outw((v), dev->base_addr + (a))
150#define HFA384X_INW(a) inw(dev->base_addr + (a))
151#define HFA384X_INSW(a, buf, wc) insw(dev->base_addr + (a), buf, wc)
152#define HFA384X_OUTSW(a, buf, wc) outsw(dev->base_addr + (a), buf, wc)
153
154#endif /* PRISM2_IO_DEBUG */
155
156
157static int hfa384x_from_bap(struct net_device *dev, u16 bap, void *buf,
158 int len)
159{
160 u16 d_off;
161 u16 *pos;
162
163 d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF;
164 pos = (u16 *) buf;
165
166 if (len / 2)
167 HFA384X_INSW(d_off, buf, len / 2);
168 pos += len / 2;
169
170 if (len & 1)
171 *((char *) pos) = HFA384X_INB(d_off);
172
173 return 0;
174}
175
176
177static int hfa384x_to_bap(struct net_device *dev, u16 bap, void *buf, int len)
178{
179 u16 d_off;
180 u16 *pos;
181
182 d_off = (bap == 1) ? HFA384X_DATA1_OFF : HFA384X_DATA0_OFF;
183 pos = (u16 *) buf;
184
185 if (len / 2)
186 HFA384X_OUTSW(d_off, buf, len / 2);
187 pos += len / 2;
188
189 if (len & 1)
190 HFA384X_OUTB(*((char *) pos), d_off);
191
192 return 0;
193}
194
195
196/* FIX: This might change at some point.. */
197#include "hostap_hw.c"
198
199
200
Dominik Brodowskicc3b4862005-11-14 21:23:14 +0100201static void prism2_detach(struct pcmcia_device *p_dev);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400202static void prism2_release(u_long arg);
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200203static int prism2_config(struct pcmcia_device *link);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400204
205
206static int prism2_pccard_card_present(local_info_t *local)
207{
Jouni Malinen67e0e472005-08-14 19:08:41 -0700208 struct hostap_cs_priv *hw_priv = local->hw_priv;
Dominik Brodowski9940ec32006-03-05 11:04:33 +0100209 if (hw_priv != NULL && hw_priv->link != NULL && pcmcia_dev_present(hw_priv->link))
Jouni Malinenff1d2762005-05-12 22:54:16 -0400210 return 1;
211 return 0;
212}
213
214
215/*
216 * SanDisk CompactFlash WLAN Flashcard - Product Manual v1.0
217 * Document No. 20-10-00058, January 2004
218 * http://www.sandisk.com/pdf/industrial/ProdManualCFWLANv1.0.pdf
219 */
220#define SANDISK_WLAN_ACTIVATION_OFF 0x40
221#define SANDISK_HCR_OFF 0x42
222
223
224static void sandisk_set_iobase(local_info_t *local)
225{
226 int res;
227 conf_reg_t reg;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700228 struct hostap_cs_priv *hw_priv = local->hw_priv;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400229
230 reg.Function = 0;
231 reg.Action = CS_WRITE;
232 reg.Offset = 0x10; /* 0x3f0 IO base 1 */
Jouni Malinen67e0e472005-08-14 19:08:41 -0700233 reg.Value = hw_priv->link->io.BasePort1 & 0x00ff;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200234 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700235 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200236 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400237 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -"
238 " res=%d\n", res);
239 }
240 udelay(10);
241
242 reg.Function = 0;
243 reg.Action = CS_WRITE;
244 reg.Offset = 0x12; /* 0x3f2 IO base 2 */
Jouni Malinen67e0e472005-08-14 19:08:41 -0700245 reg.Value = (hw_priv->link->io.BasePort1 & 0xff00) >> 8;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200246 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700247 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200248 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400249 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -"
250 " res=%d\n", res);
251 }
252}
253
254
255static void sandisk_write_hcr(local_info_t *local, int hcr)
256{
257 struct net_device *dev = local->dev;
258 int i;
259
260 HFA384X_OUTB(0x80, SANDISK_WLAN_ACTIVATION_OFF);
261 udelay(50);
262 for (i = 0; i < 10; i++) {
263 HFA384X_OUTB(hcr, SANDISK_HCR_OFF);
264 }
265 udelay(55);
266 HFA384X_OUTB(0x45, SANDISK_WLAN_ACTIVATION_OFF);
267}
268
269
270static int sandisk_enable_wireless(struct net_device *dev)
271{
272 int res, ret = 0;
273 conf_reg_t reg;
Yoann Padioleau6dbc9c82007-08-03 19:37:16 +0200274 struct hostap_interface *iface = netdev_priv(dev);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400275 local_info_t *local = iface->local;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700276 struct hostap_cs_priv *hw_priv = local->hw_priv;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400277
Jouni Malinen67e0e472005-08-14 19:08:41 -0700278 if (hw_priv->link->io.NumPorts1 < 0x42) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400279 /* Not enough ports to be SanDisk multi-function card */
280 ret = -ENODEV;
281 goto done;
282 }
283
Dominik Brodowskiefd50582006-10-25 21:28:53 -0400284 if (hw_priv->link->manf_id != 0xd601 || hw_priv->link->card_id != 0x0101) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400285 /* No SanDisk manfid found */
286 ret = -ENODEV;
287 goto done;
288 }
289
Dominik Brodowski7d2e8d02009-10-18 18:22:32 +0200290 if (hw_priv->link->socket->functions < 2) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400291 /* No multi-function links found */
292 ret = -ENODEV;
293 goto done;
294 }
295
296 printk(KERN_DEBUG "%s: Multi-function SanDisk ConnectPlus detected"
297 " - using vendor-specific initialization\n", dev->name);
Jouni Malinen67e0e472005-08-14 19:08:41 -0700298 hw_priv->sandisk_connectplus = 1;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400299
300 reg.Function = 0;
301 reg.Action = CS_WRITE;
302 reg.Offset = CISREG_COR;
303 reg.Value = COR_SOFT_RESET;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200304 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700305 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200306 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400307 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
308 dev->name, res);
309 goto done;
310 }
311 mdelay(5);
312
313 reg.Function = 0;
314 reg.Action = CS_WRITE;
315 reg.Offset = CISREG_COR;
316 /*
317 * Do not enable interrupts here to avoid some bogus events. Interrupts
318 * will be enabled during the first cor_sreset call.
319 */
320 reg.Value = COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | COR_FUNC_ENA;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200321 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700322 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200323 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400324 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
325 dev->name, res);
326 goto done;
327 }
328 mdelay(5);
329
330 sandisk_set_iobase(local);
331
332 HFA384X_OUTB(0xc5, SANDISK_WLAN_ACTIVATION_OFF);
333 udelay(10);
334 HFA384X_OUTB(0x4b, SANDISK_WLAN_ACTIVATION_OFF);
335 udelay(10);
336
337done:
Jouni Malinenff1d2762005-05-12 22:54:16 -0400338 return ret;
339}
340
341
342static void prism2_pccard_cor_sreset(local_info_t *local)
343{
344 int res;
345 conf_reg_t reg;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700346 struct hostap_cs_priv *hw_priv = local->hw_priv;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400347
348 if (!prism2_pccard_card_present(local))
349 return;
350
351 reg.Function = 0;
352 reg.Action = CS_READ;
353 reg.Offset = CISREG_COR;
354 reg.Value = 0;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200355 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700356 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200357 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400358 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n",
359 res);
360 return;
361 }
362 printk(KERN_DEBUG "prism2_pccard_cor_sreset: original COR %02x\n",
363 reg.Value);
364
365 reg.Action = CS_WRITE;
366 reg.Value |= COR_SOFT_RESET;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200367 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700368 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200369 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400370 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n",
371 res);
372 return;
373 }
374
Jouni Malinen67e0e472005-08-14 19:08:41 -0700375 mdelay(hw_priv->sandisk_connectplus ? 5 : 2);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400376
377 reg.Value &= ~COR_SOFT_RESET;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700378 if (hw_priv->sandisk_connectplus)
Jouni Malinenff1d2762005-05-12 22:54:16 -0400379 reg.Value |= COR_IREQ_ENA;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200380 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700381 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200382 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400383 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n",
384 res);
385 return;
386 }
387
Jouni Malinen67e0e472005-08-14 19:08:41 -0700388 mdelay(hw_priv->sandisk_connectplus ? 5 : 2);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400389
Jouni Malinen67e0e472005-08-14 19:08:41 -0700390 if (hw_priv->sandisk_connectplus)
Jouni Malinenff1d2762005-05-12 22:54:16 -0400391 sandisk_set_iobase(local);
392}
393
394
395static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
396{
397 int res;
398 conf_reg_t reg;
399 int old_cor;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700400 struct hostap_cs_priv *hw_priv = local->hw_priv;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400401
402 if (!prism2_pccard_card_present(local))
403 return;
404
Jouni Malinen67e0e472005-08-14 19:08:41 -0700405 if (hw_priv->sandisk_connectplus) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400406 sandisk_write_hcr(local, hcr);
407 return;
408 }
409
410 reg.Function = 0;
411 reg.Action = CS_READ;
412 reg.Offset = CISREG_COR;
413 reg.Value = 0;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200414 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700415 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200416 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400417 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 "
418 "(%d)\n", res);
419 return;
420 }
421 printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n",
422 reg.Value);
423 old_cor = reg.Value;
424
425 reg.Action = CS_WRITE;
426 reg.Value |= COR_SOFT_RESET;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200427 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700428 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200429 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400430 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 "
431 "(%d)\n", res);
432 return;
433 }
434
435 mdelay(10);
436
437 /* Setup Genesis mode */
438 reg.Action = CS_WRITE;
439 reg.Value = hcr;
440 reg.Offset = CISREG_CCSR;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200441 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700442 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200443 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400444 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 "
445 "(%d)\n", res);
446 return;
447 }
448 mdelay(10);
449
450 reg.Action = CS_WRITE;
451 reg.Offset = CISREG_COR;
452 reg.Value = old_cor & ~COR_SOFT_RESET;
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200453 res = pcmcia_access_configuration_register(hw_priv->link,
Jouni Malinen67e0e472005-08-14 19:08:41 -0700454 &reg);
Dominik Brodowski4c89e882008-08-03 10:07:45 +0200455 if (res != 0) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400456 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 "
457 "(%d)\n", res);
458 return;
459 }
460
461 mdelay(10);
462}
463
464
Jouni Malinenff1d2762005-05-12 22:54:16 -0400465static struct prism2_helper_functions prism2_pccard_funcs =
466{
467 .card_present = prism2_pccard_card_present,
468 .cor_sreset = prism2_pccard_cor_sreset,
Jouni Malinenff1d2762005-05-12 22:54:16 -0400469 .genesis_reset = prism2_pccard_genesis_reset,
470 .hw_type = HOSTAP_HW_PCCARD,
471};
472
473
474/* allocate local data and register with CardServices
475 * initialize dev_link structure, but do not configure the card yet */
Dominik Brodowski15b99ac2006-03-31 17:26:06 +0200476static int hostap_cs_probe(struct pcmcia_device *p_dev)
Jouni Malinenff1d2762005-05-12 22:54:16 -0400477{
Dominik Brodowski15b99ac2006-03-31 17:26:06 +0200478 int ret;
479
Jouni Malinenff1d2762005-05-12 22:54:16 -0400480 PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info);
Dominik Brodowskifd238232006-03-05 10:45:09 +0100481 p_dev->conf.IntType = INT_MEMORY_AND_IO;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400482
Dominik Brodowski15b99ac2006-03-31 17:26:06 +0200483 ret = prism2_config(p_dev);
484 if (ret) {
Dominik Brodowskif8cfa612005-11-14 21:25:51 +0100485 PDEBUG(DEBUG_EXTRA, "prism2_config() failed\n");
Dominik Brodowski15b99ac2006-03-31 17:26:06 +0200486 }
Dominik Brodowskif8cfa612005-11-14 21:25:51 +0100487
Dominik Brodowski15b99ac2006-03-31 17:26:06 +0200488 return ret;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400489}
490
491
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200492static void prism2_detach(struct pcmcia_device *link)
Jouni Malinenff1d2762005-05-12 22:54:16 -0400493{
Jouni Malinenff1d2762005-05-12 22:54:16 -0400494 PDEBUG(DEBUG_FLOW, "prism2_detach\n");
495
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100496 prism2_release((u_long)link);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400497
Jouni Malinenff1d2762005-05-12 22:54:16 -0400498 /* release net devices */
499 if (link->priv) {
Jouni Malinenc3551842005-10-02 17:19:00 -0700500 struct hostap_cs_priv *hw_priv;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700501 struct net_device *dev;
502 struct hostap_interface *iface;
503 dev = link->priv;
504 iface = netdev_priv(dev);
Jouni Malinenc3551842005-10-02 17:19:00 -0700505 hw_priv = iface->local->hw_priv;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700506 prism2_free_local_data(dev);
Jouni Malinenc3551842005-10-02 17:19:00 -0700507 kfree(hw_priv);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400508 }
Jouni Malinenff1d2762005-05-12 22:54:16 -0400509}
510
511
Jouni Malinenff1d2762005-05-12 22:54:16 -0400512/* run after a CARD_INSERTION event is received to configure the PCMCIA
513 * socket and make the device available to the system */
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200514
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200515static int prism2_config_check(struct pcmcia_device *p_dev,
516 cistpl_cftable_entry_t *cfg,
Dominik Brodowski8e2fc392008-08-02 15:30:31 +0200517 cistpl_cftable_entry_t *dflt,
Dominik Brodowskiad913c12008-08-02 16:12:00 +0200518 unsigned int vcc,
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200519 void *priv_data)
520{
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200521 if (cfg->index == 0)
522 return -ENODEV;
523
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200524 PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X "
Dominik Brodowski8e2fc392008-08-02 15:30:31 +0200525 "(default 0x%02X)\n", cfg->index, dflt->index);
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200526
527 /* Does this card need audio output? */
528 if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
529 p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
530 p_dev->conf.Status = CCSR_AUDIO_ENA;
531 }
532
533 /* Use power settings for Vcc and Vpp if present */
534 /* Note that the CIS values need to be rescaled */
535 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
Dominik Brodowskiad913c12008-08-02 16:12:00 +0200536 if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] /
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200537 10000 && !ignore_cis_vcc) {
538 PDEBUG(DEBUG_EXTRA, " Vcc mismatch - skipping"
539 " this entry\n");
540 return -ENODEV;
541 }
Dominik Brodowski8e2fc392008-08-02 15:30:31 +0200542 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
Dominik Brodowskiad913c12008-08-02 16:12:00 +0200543 if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] /
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200544 10000 && !ignore_cis_vcc) {
545 PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch "
546 "- skipping this entry\n");
547 return -ENODEV;
548 }
549 }
550
551 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
552 p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
Dominik Brodowski8e2fc392008-08-02 15:30:31 +0200553 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
554 p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200555
556 /* Do we need to allocate an interrupt? */
Dominik Brodowskieb141202010-03-07 12:21:16 +0100557 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200558
559 /* IO window settings */
560 PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d "
Dominik Brodowski8e2fc392008-08-02 15:30:31 +0200561 "dflt->io.nwin=%d\n",
562 cfg->io.nwin, dflt->io.nwin);
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200563 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0;
Dominik Brodowski8e2fc392008-08-02 15:30:31 +0200564 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
565 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200566 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
567 PDEBUG(DEBUG_EXTRA, "io->flags = 0x%04X, "
568 "io.base=0x%04x, len=%d\n", io->flags,
569 io->win[0].base, io->win[0].len);
570 if (!(io->flags & CISTPL_IO_8BIT))
571 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16;
572 if (!(io->flags & CISTPL_IO_16BIT))
573 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
574 p_dev->io.IOAddrLines = io->flags &
575 CISTPL_IO_LINES_MASK;
576 p_dev->io.BasePort1 = io->win[0].base;
577 p_dev->io.NumPorts1 = io->win[0].len;
578 if (io->nwin > 1) {
579 p_dev->io.Attributes2 = p_dev->io.Attributes1;
580 p_dev->io.BasePort2 = io->win[1].base;
581 p_dev->io.NumPorts2 = io->win[1].len;
582 }
583 }
584
585 /* This reserves IO space but doesn't actually enable it */
586 return pcmcia_request_io(p_dev, &p_dev->io);
587}
588
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200589static int prism2_config(struct pcmcia_device *link)
Jouni Malinenff1d2762005-05-12 22:54:16 -0400590{
591 struct net_device *dev;
592 struct hostap_interface *iface;
593 local_info_t *local;
594 int ret = 1;
Jouni Malinen67e0e472005-08-14 19:08:41 -0700595 struct hostap_cs_priv *hw_priv;
Tim Gardnerd6a574f2010-06-08 11:33:02 -0600596 unsigned long flags;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400597
598 PDEBUG(DEBUG_FLOW, "prism2_config()\n");
599
Yan Burmanb0471bb72006-12-02 13:33:40 +0200600 hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL);
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200601 if (hw_priv == NULL) {
Jouni Malinenff1d2762005-05-12 22:54:16 -0400602 ret = -ENOMEM;
603 goto failed;
604 }
605
Jouni Malinenff1d2762005-05-12 22:54:16 -0400606 /* Look for an appropriate configuration table entry in the CIS */
Dominik Brodowski2caff1472009-10-24 15:53:36 +0200607 ret = pcmcia_loop_config(link, prism2_config_check, NULL);
608 if (ret) {
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200609 if (!ignore_cis_vcc)
610 printk(KERN_ERR "GetNextTuple(): No matching "
611 "CIS configuration. Maybe you need the "
612 "ignore_cis_vcc=1 parameter.\n");
Dominik Brodowskib54bf942008-08-02 14:28:43 +0200613 goto failed;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400614 }
615
616 /* Need to allocate net_device before requesting IRQ handler */
Dave Hansen0cd545d2005-07-30 12:49:58 -0700617 dev = prism2_init_local_data(&prism2_pccard_funcs, 0,
Dominik Brodowskidd2e5a12009-11-03 10:27:34 +0100618 &link->dev);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400619 if (dev == NULL)
620 goto failed;
621 link->priv = dev;
622
Jouni Malinenfbff8682005-08-28 17:53:32 -0700623 iface = netdev_priv(dev);
624 local = iface->local;
625 local->hw_priv = hw_priv;
626 hw_priv->link = link;
Jouni Malinenfbff8682005-08-28 17:53:32 -0700627
Tim Gardnerd6a574f2010-06-08 11:33:02 -0600628 /*
629 * Make sure the IRQ handler cannot proceed until at least
630 * dev->base_addr is initialized.
631 */
632 spin_lock_irqsave(&local->irq_init_lock, flags);
633
Dominik Brodowskieb141202010-03-07 12:21:16 +0100634 ret = pcmcia_request_irq(link, prism2_interrupt);
635 if (ret)
Tim Gardnerd6a574f2010-06-08 11:33:02 -0600636 goto failed_unlock;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400637
638 /*
639 * This actually configures the PCMCIA socket -- setting up
640 * the I/O windows and the interrupt mapping, and putting the
641 * card and host interface into "Memory and IO" mode.
642 */
Dominik Brodowski2caff1472009-10-24 15:53:36 +0200643 ret = pcmcia_request_configuration(link, &link->conf);
644 if (ret)
Tim Gardnerd6a574f2010-06-08 11:33:02 -0600645 goto failed_unlock;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400646
Dominik Brodowskieb141202010-03-07 12:21:16 +0100647 dev->irq = link->irq;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400648 dev->base_addr = link->io.BasePort1;
649
Tim Gardnerd6a574f2010-06-08 11:33:02 -0600650 spin_unlock_irqrestore(&local->irq_init_lock, flags);
651
Jouni Malinenff1d2762005-05-12 22:54:16 -0400652 /* Finally, report what we've done */
Dominik Brodowski70294b42006-01-15 12:43:16 +0100653 printk(KERN_INFO "%s: index 0x%02x: ",
654 dev_info, link->conf.ConfigIndex);
655 if (link->conf.Vpp)
656 printk(", Vpp %d.%d", link->conf.Vpp / 10,
657 link->conf.Vpp % 10);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400658 if (link->conf.Attributes & CONF_ENABLE_IRQ)
Dominik Brodowskieb141202010-03-07 12:21:16 +0100659 printk(", irq %d", link->irq);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400660 if (link->io.NumPorts1)
661 printk(", io 0x%04x-0x%04x", link->io.BasePort1,
662 link->io.BasePort1+link->io.NumPorts1-1);
663 if (link->io.NumPorts2)
664 printk(" & 0x%04x-0x%04x", link->io.BasePort2,
665 link->io.BasePort2+link->io.NumPorts2-1);
666 printk("\n");
667
Jouni Malinenff1d2762005-05-12 22:54:16 -0400668 local->shutdown = 0;
669
670 sandisk_enable_wireless(dev);
671
672 ret = prism2_hw_config(dev, 1);
Dominik Brodowski317b6d62010-03-20 19:26:51 +0100673 if (!ret)
Jouni Malinenff1d2762005-05-12 22:54:16 -0400674 ret = hostap_hw_ready(dev);
Dominik Brodowski317b6d62010-03-20 19:26:51 +0100675
Jouni Malinenff1d2762005-05-12 22:54:16 -0400676 return ret;
677
Tim Gardnerd6a574f2010-06-08 11:33:02 -0600678 failed_unlock:
679 spin_unlock_irqrestore(&local->irq_init_lock, flags);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400680 failed:
Jouni Malinen67e0e472005-08-14 19:08:41 -0700681 kfree(hw_priv);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400682 prism2_release((u_long)link);
683 return ret;
684}
685
686
687static void prism2_release(u_long arg)
688{
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200689 struct pcmcia_device *link = (struct pcmcia_device *)arg;
Jouni Malinenff1d2762005-05-12 22:54:16 -0400690
691 PDEBUG(DEBUG_FLOW, "prism2_release\n");
692
693 if (link->priv) {
694 struct net_device *dev = link->priv;
695 struct hostap_interface *iface;
696
697 iface = netdev_priv(dev);
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100698 prism2_hw_shutdown(dev, 0);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400699 iface->local->shutdown = 1;
700 }
701
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200702 pcmcia_disable_device(link);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400703 PDEBUG(DEBUG_FLOW, "release - done\n");
704}
705
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200706static int hostap_cs_suspend(struct pcmcia_device *link)
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100707{
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100708 struct net_device *dev = (struct net_device *) link->priv;
709 int dev_open = 0;
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100710 struct hostap_interface *iface = NULL;
711
John W. Linvillefcee7a02008-07-02 11:04:24 -0400712 if (!dev)
713 return -ENODEV;
714
715 iface = netdev_priv(dev);
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100716
717 PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_SUSPEND\n", dev_info);
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100718 if (iface && iface->local)
719 dev_open = iface->local->num_dev_open > 0;
720 if (dev_open) {
721 netif_stop_queue(dev);
722 netif_device_detach(dev);
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100723 }
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100724 prism2_suspend(dev);
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100725
726 return 0;
727}
728
Dominik Brodowskifba395e2006-03-31 17:21:06 +0200729static int hostap_cs_resume(struct pcmcia_device *link)
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100730{
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100731 struct net_device *dev = (struct net_device *) link->priv;
732 int dev_open = 0;
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100733 struct hostap_interface *iface = NULL;
734
John W. Linvillefcee7a02008-07-02 11:04:24 -0400735 if (!dev)
736 return -ENODEV;
737
738 iface = netdev_priv(dev);
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100739
740 PDEBUG(DEBUG_EXTRA, "%s: CS_EVENT_PM_RESUME\n", dev_info);
741
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100742 if (iface && iface->local)
743 dev_open = iface->local->num_dev_open > 0;
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100744
Dominik Brodowskie2d40962006-03-02 00:09:29 +0100745 prism2_hw_shutdown(dev, 1);
746 prism2_hw_config(dev, dev_open ? 0 : 1);
747 if (dev_open) {
748 netif_device_attach(dev);
749 netif_start_queue(dev);
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100750 }
751
752 return 0;
753}
Jouni Malinenff1d2762005-05-12 22:54:16 -0400754
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700755static struct pcmcia_device_id hostap_cs_ids[] = {
756 PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100),
757 PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300),
758 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777),
759 PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000),
760 PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002),
Stefan Lippers-Hollmann46232d22007-10-05 23:42:51 +0200761 PCMCIA_DEVICE_MANF_CARD(0x01bf, 0x3301),
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700762 PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002),
Richard Purdie1e4adbd2005-08-04 00:16:27 +0100763 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x030b),
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700764 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612),
765 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613),
766 PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002),
767 PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002),
768 PCMCIA_DEVICE_MANF_CARD(0x02d2, 0x0001),
769 PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x0001),
770 PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300),
Komurofd99ddd072006-04-17 21:41:21 +0900771/* PCMCIA_DEVICE_MANF_CARD(0xc00f, 0x0000), conflict with pcnet_cs */
Pavel Roskin449fecc2008-05-16 17:52:57 -0400772 PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002),
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700773 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
774 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
775 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010),
Christian Steineck884d3a22006-09-08 23:51:34 +0200776 PCMCIA_DEVICE_MANF_CARD(0x0126, 0x0002),
Marcin Juszkiewicz25ac6c22007-03-30 15:34:14 +0200777 PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0xd601, 0x0005, "ADLINK 345 CF",
778 0x2d858104),
Pavel Roskin40e3cad2006-02-28 01:18:31 -0500779 PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "INTERSIL",
780 0x74c5e40d),
781 PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "Intersil",
782 0x4b801a17),
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700783 PCMCIA_MFC_DEVICE_PROD_ID12(0, "SanDisk", "ConnectPlus",
784 0x7a954bd9, 0x74be00c6),
Pavel Roskin17f65f82008-01-09 22:16:58 -0500785 PCMCIA_DEVICE_PROD_ID123(
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700786 "Addtron", "AWP-100 Wireless PCMCIA", "Version 01.02",
787 0xe6ec52ce, 0x08649af2, 0x4b74baa0),
788 PCMCIA_DEVICE_PROD_ID123(
789 "D", "Link DWL-650 11Mbps WLAN Card", "Version 01.02",
790 0x71b18589, 0xb6f1b0ab, 0x4b74baa0),
791 PCMCIA_DEVICE_PROD_ID123(
792 "Instant Wireless ", " Network PC CARD", "Version 01.02",
793 0x11d901af, 0x6e9bd926, 0x4b74baa0),
794 PCMCIA_DEVICE_PROD_ID123(
795 "SMC", "SMC2632W", "Version 01.02",
796 0xc4f8b18b, 0x474a1f2a, 0x4b74baa0),
Richard Purdie1e4adbd2005-08-04 00:16:27 +0100797 PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-CF-S11G",
Jouni Malinen6c5b90d2005-08-28 10:51:36 -0700798 0x2decece3, 0x82067c18),
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700799 PCMCIA_DEVICE_PROD_ID12("Compaq", "WL200_11Mbps_Wireless_PCI_Card",
800 0x54f7c49c, 0x15a75e5b),
801 PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE",
802 0x74c5e40d, 0xdb472a18),
803 PCMCIA_DEVICE_PROD_ID12("Linksys", "Wireless CompactFlash Card",
804 0x0733cc81, 0x0c52f395),
805 PCMCIA_DEVICE_PROD_ID12(
806 "ZoomAir 11Mbps High", "Rate wireless Networking",
807 0x273fe3db, 0x32a1eaee),
Marcin Juszkiewiczdf8ccb92006-05-22 10:56:55 +0200808 PCMCIA_DEVICE_PROD_ID123(
809 "Pretec", "CompactWLAN Card 802.11b", "2.5",
810 0x1cadd3e5, 0xe697636c, 0x7a5bfcf1),
811 PCMCIA_DEVICE_PROD_ID123(
812 "U.S. Robotics", "IEEE 802.11b PC-CARD", "Version 01.02",
813 0xc7b8df9d, 0x1700d087, 0x4b74baa0),
Dominik Brodowski01918d12006-07-02 21:21:51 +0200814 PCMCIA_DEVICE_PROD_ID123(
815 "Allied Telesyn", "AT-WCL452 Wireless PCMCIA Radio",
816 "Ver. 1.00",
817 0x5cd01705, 0x4271660f, 0x9d08ee12),
818 PCMCIA_DEVICE_PROD_ID123(
Marcin Juszkiewicz5d635ea2008-01-29 09:42:53 +0100819 "Wireless LAN" , "11Mbps PC Card", "Version 01.02",
820 0x4b8870ff, 0x70e946d1, 0x4b74baa0),
Pavel Roskinfbc87d62010-02-11 17:56:06 -0500821 PCMCIA_DEVICE_PROD_ID3("HFA3863", 0x355cb092),
822 PCMCIA_DEVICE_PROD_ID3("ISL37100P", 0x630d52b2),
823 PCMCIA_DEVICE_PROD_ID3("ISL37101P-10", 0xdd97a26b),
824 PCMCIA_DEVICE_PROD_ID3("ISL37300P", 0xc9049a39),
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700825 PCMCIA_DEVICE_NULL
826};
827MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids);
828
829
Jouni Malinenff1d2762005-05-12 22:54:16 -0400830static struct pcmcia_driver hostap_driver = {
831 .drv = {
832 .name = "hostap_cs",
833 },
Dominik Brodowski15b99ac2006-03-31 17:26:06 +0200834 .probe = hostap_cs_probe,
Dominik Brodowskicc3b4862005-11-14 21:23:14 +0100835 .remove = prism2_detach,
Jouni Malinenff1d2762005-05-12 22:54:16 -0400836 .owner = THIS_MODULE,
Henrik Brix Andersen093853c2005-07-30 12:49:59 -0700837 .id_table = hostap_cs_ids,
Dominik Brodowski98e4c282005-11-14 21:21:18 +0100838 .suspend = hostap_cs_suspend,
839 .resume = hostap_cs_resume,
Jouni Malinenff1d2762005-05-12 22:54:16 -0400840};
841
842static int __init init_prism2_pccard(void)
843{
Jouni Malinenff1d2762005-05-12 22:54:16 -0400844 return pcmcia_register_driver(&hostap_driver);
845}
846
847static void __exit exit_prism2_pccard(void)
848{
849 pcmcia_unregister_driver(&hostap_driver);
Jouni Malinenff1d2762005-05-12 22:54:16 -0400850}
851
852
853module_init(init_prism2_pccard);
854module_exit(exit_prism2_pccard);