[PATCH] pcmcia: move event handler
[powerpc.git] / drivers / net / wireless / orinoco_cs.c
1 /* orinoco_cs.c (formerly known as dldwd_cs.c)
2  *
3  * A driver for "Hermes" chipset based PCMCIA wireless adaptors, such
4  * as the Lucent WavelanIEEE/Orinoco cards and their OEM (Cabletron/
5  * EnteraSys RoamAbout 802.11, ELSA Airlancer, Melco Buffalo and others).
6  * It should also be usable on various Prism II based cards such as the
7  * Linksys, D-Link and Farallon Skyline. It should also work on Symbol
8  * cards such as the 3Com AirConnect and Ericsson WLAN.
9  * 
10  * Copyright notice & release notes in file orinoco.c
11  */
12
13 #define DRIVER_NAME "orinoco_cs"
14 #define PFX DRIVER_NAME ": "
15
16 #include <linux/config.h>
17 #ifdef  __IN_PCMCIA_PACKAGE__
18 #include <pcmcia/k_compat.h>
19 #endif /* __IN_PCMCIA_PACKAGE__ */
20
21 #include <linux/module.h>
22 #include <linux/kernel.h>
23 #include <linux/init.h>
24 #include <linux/sched.h>
25 #include <linux/ptrace.h>
26 #include <linux/slab.h>
27 #include <linux/string.h>
28 #include <linux/ioport.h>
29 #include <linux/netdevice.h>
30 #include <linux/if_arp.h>
31 #include <linux/etherdevice.h>
32 #include <linux/wireless.h>
33
34 #include <pcmcia/version.h>
35 #include <pcmcia/cs_types.h>
36 #include <pcmcia/cs.h>
37 #include <pcmcia/cistpl.h>
38 #include <pcmcia/cisreg.h>
39 #include <pcmcia/ds.h>
40
41 #include <asm/uaccess.h>
42 #include <asm/io.h>
43 #include <asm/system.h>
44
45 #include "orinoco.h"
46
47 /********************************************************************/
48 /* Module stuff                                                     */
49 /********************************************************************/
50
51 MODULE_AUTHOR("David Gibson <hermes@gibson.dropbear.id.au>");
52 MODULE_DESCRIPTION("Driver for PCMCIA Lucent Orinoco, Prism II based and similar wireless cards");
53 MODULE_LICENSE("Dual MPL/GPL");
54
55 /* Module parameters */
56
57 /* Some D-Link cards have buggy CIS. They do work at 5v properly, but
58  * don't have any CIS entry for it. This workaround it... */
59 static int ignore_cis_vcc; /* = 0 */
60 module_param(ignore_cis_vcc, int, 0);
61 MODULE_PARM_DESC(ignore_cis_vcc, "Allow voltage mismatch between card and socket");
62
63 /********************************************************************/
64 /* Magic constants                                                  */
65 /********************************************************************/
66
67 /*
68  * The dev_info variable is the "key" that is used to match up this
69  * device driver with appropriate cards, through the card
70  * configuration database.
71  */
72 static dev_info_t dev_info = DRIVER_NAME;
73
74 /********************************************************************/
75 /* Data structures                                                  */
76 /********************************************************************/
77
78 /* PCMCIA specific device information (goes in the card field of
79  * struct orinoco_private */
80 struct orinoco_pccard {
81         dev_link_t link;
82         dev_node_t node;
83
84         /* Used to handle hard reset */
85         /* yuck, we need this hack to work around the insanity of the
86          * PCMCIA layer */
87         unsigned long hard_reset_in_progress; 
88 };
89
90 /*
91  * A linked list of "instances" of the device.  Each actual PCMCIA
92  * card corresponds to one device instance, and is described by one
93  * dev_link_t structure (defined in ds.h).
94  */
95 static dev_link_t *dev_list; /* = NULL */
96
97 /********************************************************************/
98 /* Function prototypes                                              */
99 /********************************************************************/
100
101 /* device methods */
102 static int orinoco_cs_hard_reset(struct orinoco_private *priv);
103
104 /* PCMCIA gumpf */
105 static void orinoco_cs_config(dev_link_t * link);
106 static void orinoco_cs_release(dev_link_t * link);
107 static int orinoco_cs_event(event_t event, int priority,
108                             event_callback_args_t * args);
109
110 static dev_link_t *orinoco_cs_attach(void);
111 static void orinoco_cs_detach(dev_link_t *);
112
113 /********************************************************************/
114 /* Device methods                                                   */
115 /********************************************************************/
116
117 static int
118 orinoco_cs_hard_reset(struct orinoco_private *priv)
119 {
120         struct orinoco_pccard *card = priv->card;
121         dev_link_t *link = &card->link;
122         int err;
123
124         /* We need atomic ops here, because we're not holding the lock */
125         set_bit(0, &card->hard_reset_in_progress);
126
127         err = pcmcia_reset_card(link->handle, NULL);
128         if (err)
129                 return err;
130
131         msleep(100);
132         clear_bit(0, &card->hard_reset_in_progress);
133
134         return 0;
135 }
136
137 /********************************************************************/
138 /* PCMCIA stuff                                                     */
139 /********************************************************************/
140
141 /*
142  * This creates an "instance" of the driver, allocating local data
143  * structures for one device.  The device is registered with Card
144  * Services.
145  * 
146  * The dev_link structure is initialized, but we don't actually
147  * configure the card at this point -- we wait until we receive a card
148  * insertion event.  */
149 static dev_link_t *
150 orinoco_cs_attach(void)
151 {
152         struct net_device *dev;
153         struct orinoco_private *priv;
154         struct orinoco_pccard *card;
155         dev_link_t *link;
156         client_reg_t client_reg;
157         int ret;
158
159         dev = alloc_orinocodev(sizeof(*card), orinoco_cs_hard_reset);
160         if (! dev)
161                 return NULL;
162         priv = netdev_priv(dev);
163         card = priv->card;
164
165         /* Link both structures together */
166         link = &card->link;
167         link->priv = dev;
168
169         /* Interrupt setup */
170         link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
171         link->irq.IRQInfo1 = IRQ_LEVEL_ID;
172         link->irq.Handler = orinoco_interrupt;
173         link->irq.Instance = dev; 
174
175         /* General socket configuration defaults can go here.  In this
176          * client, we assume very little, and rely on the CIS for
177          * almost everything.  In most clients, many details (i.e.,
178          * number, sizes, and attributes of IO windows) are fixed by
179          * the nature of the device, and can be hard-wired here. */
180         link->conf.Attributes = 0;
181         link->conf.IntType = INT_MEMORY_AND_IO;
182
183         /* Register with Card Services */
184         /* FIXME: need a lock? */
185         link->next = dev_list;
186         dev_list = link;
187
188         client_reg.dev_info = &dev_info;
189         client_reg.Version = 0x0210; /* FIXME: what does this mean? */
190         client_reg.event_callback_args.client_data = link;
191
192         ret = pcmcia_register_client(&link->handle, &client_reg);
193         if (ret != CS_SUCCESS) {
194                 cs_error(link->handle, RegisterClient, ret);
195                 orinoco_cs_detach(link);
196                 return NULL;
197         }
198
199         return link;
200 }                               /* orinoco_cs_attach */
201
202 /*
203  * This deletes a driver "instance".  The device is de-registered with
204  * Card Services.  If it has been released, all local data structures
205  * are freed.  Otherwise, the structures will be freed when the device
206  * is released.
207  */
208 static void orinoco_cs_detach(dev_link_t *link)
209 {
210         dev_link_t **linkp;
211         struct net_device *dev = link->priv;
212
213         /* Locate device structure */
214         for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
215                 if (*linkp == link)
216                         break;
217
218         BUG_ON(*linkp == NULL);
219
220         if (link->state & DEV_CONFIG)
221                 orinoco_cs_release(link);
222
223         /* Break the link with Card Services */
224         if (link->handle)
225                 pcmcia_deregister_client(link->handle);
226
227         /* Unlink device structure, and free it */
228         *linkp = link->next;
229         DEBUG(0, PFX "detach: link=%p link->dev=%p\n", link, link->dev);
230         if (link->dev) {
231                 DEBUG(0, PFX "About to unregister net device %p\n",
232                       dev);
233                 unregister_netdev(dev);
234         }
235         free_orinocodev(dev);
236 }                               /* orinoco_cs_detach */
237
238 /*
239  * orinoco_cs_config() is scheduled to run after a CARD_INSERTION
240  * event is received, to configure the PCMCIA socket, and to make the
241  * device available to the system.
242  */
243
244 #define CS_CHECK(fn, ret) do { \
245                 last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; \
246         } while (0)
247
248 static void
249 orinoco_cs_config(dev_link_t *link)
250 {
251         struct net_device *dev = link->priv;
252         client_handle_t handle = link->handle;
253         struct orinoco_private *priv = netdev_priv(dev);
254         struct orinoco_pccard *card = priv->card;
255         hermes_t *hw = &priv->hw;
256         int last_fn, last_ret;
257         u_char buf[64];
258         config_info_t conf;
259         cisinfo_t info;
260         tuple_t tuple;
261         cisparse_t parse;
262         void __iomem *mem;
263
264         CS_CHECK(ValidateCIS, pcmcia_validate_cis(handle, &info));
265
266         /*
267          * This reads the card's CONFIG tuple to find its
268          * configuration registers.
269          */
270         tuple.DesiredTuple = CISTPL_CONFIG;
271         tuple.Attributes = 0;
272         tuple.TupleData = buf;
273         tuple.TupleDataMax = sizeof(buf);
274         tuple.TupleOffset = 0;
275         CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
276         CS_CHECK(GetTupleData, pcmcia_get_tuple_data(handle, &tuple));
277         CS_CHECK(ParseTuple, pcmcia_parse_tuple(handle, &tuple, &parse));
278         link->conf.ConfigBase = parse.config.base;
279         link->conf.Present = parse.config.rmask[0];
280
281         /* Configure card */
282         link->state |= DEV_CONFIG;
283
284         /* Look up the current Vcc */
285         CS_CHECK(GetConfigurationInfo,
286                  pcmcia_get_configuration_info(handle, &conf));
287         link->conf.Vcc = conf.Vcc;
288
289         /*
290          * In this loop, we scan the CIS for configuration table
291          * entries, each of which describes a valid card
292          * configuration, including voltage, IO window, memory window,
293          * and interrupt settings.
294          *
295          * We make no assumptions about the card to be configured: we
296          * use just the information available in the CIS.  In an ideal
297          * world, this would work for any PCMCIA card, but it requires
298          * a complete and accurate CIS.  In practice, a driver usually
299          * "knows" most of these things without consulting the CIS,
300          * and most client drivers will only use the CIS to fill in
301          * implementation-defined details.
302          */
303         tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
304         CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(handle, &tuple));
305         while (1) {
306                 cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
307                 cistpl_cftable_entry_t dflt = { .index = 0 };
308
309                 if ( (pcmcia_get_tuple_data(handle, &tuple) != 0)
310                     || (pcmcia_parse_tuple(handle, &tuple, &parse) != 0))
311                         goto next_entry;
312
313                 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
314                         dflt = *cfg;
315                 if (cfg->index == 0)
316                         goto next_entry;
317                 link->conf.ConfigIndex = cfg->index;
318
319                 /* Does this card need audio output? */
320                 if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
321                         link->conf.Attributes |= CONF_ENABLE_SPKR;
322                         link->conf.Status = CCSR_AUDIO_ENA;
323                 }
324
325                 /* Use power settings for Vcc and Vpp if present */
326                 /* Note that the CIS values need to be rescaled */
327                 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
328                         if (conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) {
329                                 DEBUG(2, "orinoco_cs_config: Vcc mismatch (conf.Vcc = %d, CIS = %d)\n",  conf.Vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000);
330                                 if (!ignore_cis_vcc)
331                                         goto next_entry;
332                         }
333                 } else if (dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) {
334                         if (conf.Vcc != dflt.vcc.param[CISTPL_POWER_VNOM] / 10000) {
335                                 DEBUG(2, "orinoco_cs_config: Vcc mismatch (conf.Vcc = %d, CIS = %d)\n",  conf.Vcc, dflt.vcc.param[CISTPL_POWER_VNOM] / 10000);
336                                 if(!ignore_cis_vcc)
337                                         goto next_entry;
338                         }
339                 }
340
341                 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
342                         link->conf.Vpp1 = link->conf.Vpp2 =
343                             cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
344                 else if (dflt.vpp1.present & (1 << CISTPL_POWER_VNOM))
345                         link->conf.Vpp1 = link->conf.Vpp2 =
346                             dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000;
347                 
348                 /* Do we need to allocate an interrupt? */
349                 link->conf.Attributes |= CONF_ENABLE_IRQ;
350
351                 /* IO window settings */
352                 link->io.NumPorts1 = link->io.NumPorts2 = 0;
353                 if ((cfg->io.nwin > 0) || (dflt.io.nwin > 0)) {
354                         cistpl_io_t *io =
355                             (cfg->io.nwin) ? &cfg->io : &dflt.io;
356                         link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO;
357                         if (!(io->flags & CISTPL_IO_8BIT))
358                                 link->io.Attributes1 =
359                                     IO_DATA_PATH_WIDTH_16;
360                         if (!(io->flags & CISTPL_IO_16BIT))
361                                 link->io.Attributes1 =
362                                     IO_DATA_PATH_WIDTH_8;
363                         link->io.IOAddrLines =
364                             io->flags & CISTPL_IO_LINES_MASK;
365                         link->io.BasePort1 = io->win[0].base;
366                         link->io.NumPorts1 = io->win[0].len;
367                         if (io->nwin > 1) {
368                                 link->io.Attributes2 =
369                                     link->io.Attributes1;
370                                 link->io.BasePort2 = io->win[1].base;
371                                 link->io.NumPorts2 = io->win[1].len;
372                         }
373
374                         /* This reserves IO space but doesn't actually enable it */
375                         if (pcmcia_request_io(link->handle, &link->io) != 0)
376                                 goto next_entry;
377                 }
378
379
380                 /* If we got this far, we're cool! */
381
382                 break;
383                 
384         next_entry:
385                 if (link->io.NumPorts1)
386                         pcmcia_release_io(link->handle, &link->io);
387                 last_ret = pcmcia_get_next_tuple(handle, &tuple);
388                 if (last_ret  == CS_NO_MORE_ITEMS) {
389                         printk(KERN_ERR PFX "GetNextTuple(): No matching "
390                                "CIS configuration.  Maybe you need the "
391                                "ignore_cis_vcc=1 parameter.\n");
392                         goto cs_failed;
393                 }
394         }
395
396         /*
397          * Allocate an interrupt line.  Note that this does not assign
398          * a handler to the interrupt, unless the 'Handler' member of
399          * the irq structure is initialized.
400          */
401         CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
402
403         /* We initialize the hermes structure before completing PCMCIA
404          * configuration just in case the interrupt handler gets
405          * called. */
406         mem = ioport_map(link->io.BasePort1, link->io.NumPorts1);
407         if (!mem)
408                 goto cs_failed;
409
410         hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING);
411
412         /*
413          * This actually configures the PCMCIA socket -- setting up
414          * the I/O windows and the interrupt mapping, and putting the
415          * card and host interface into "Memory and IO" mode.
416          */
417         CS_CHECK(RequestConfiguration,
418                  pcmcia_request_configuration(link->handle, &link->conf));
419
420         /* Ok, we have the configuration, prepare to register the netdev */
421         dev->base_addr = link->io.BasePort1;
422         dev->irq = link->irq.AssignedIRQ;
423         SET_MODULE_OWNER(dev);
424         card->node.major = card->node.minor = 0;
425
426         SET_NETDEV_DEV(dev, &handle_to_dev(handle));
427         /* Tell the stack we exist */
428         if (register_netdev(dev) != 0) {
429                 printk(KERN_ERR PFX "register_netdev() failed\n");
430                 goto failed;
431         }
432
433         /* At this point, the dev_node_t structure(s) needs to be
434          * initialized and arranged in a linked list at link->dev. */
435         strcpy(card->node.dev_name, dev->name);
436         link->dev = &card->node; /* link->dev being non-NULL is also
437                                     used to indicate that the
438                                     net_device has been registered */
439         link->state &= ~DEV_CONFIG_PENDING;
440
441         /* Finally, report what we've done */
442         printk(KERN_DEBUG "%s: index 0x%02x: Vcc %d.%d",
443                dev->name, link->conf.ConfigIndex,
444                link->conf.Vcc / 10, link->conf.Vcc % 10);
445         if (link->conf.Vpp1)
446                 printk(", Vpp %d.%d", link->conf.Vpp1 / 10,
447                        link->conf.Vpp1 % 10);
448         printk(", irq %d", link->irq.AssignedIRQ);
449         if (link->io.NumPorts1)
450                 printk(", io 0x%04x-0x%04x", link->io.BasePort1,
451                        link->io.BasePort1 + link->io.NumPorts1 - 1);
452         if (link->io.NumPorts2)
453                 printk(" & 0x%04x-0x%04x", link->io.BasePort2,
454                        link->io.BasePort2 + link->io.NumPorts2 - 1);
455         printk("\n");
456
457         return;
458
459  cs_failed:
460         cs_error(link->handle, last_fn, last_ret);
461
462  failed:
463         orinoco_cs_release(link);
464 }                               /* orinoco_cs_config */
465
466 /*
467  * After a card is removed, orinoco_cs_release() will unregister the
468  * device, and release the PCMCIA configuration.  If the device is
469  * still open, this will be postponed until it is closed.
470  */
471 static void
472 orinoco_cs_release(dev_link_t *link)
473 {
474         struct net_device *dev = link->priv;
475         struct orinoco_private *priv = netdev_priv(dev);
476         unsigned long flags;
477
478         /* We're committed to taking the device away now, so mark the
479          * hardware as unavailable */
480         spin_lock_irqsave(&priv->lock, flags);
481         priv->hw_unavailable++;
482         spin_unlock_irqrestore(&priv->lock, flags);
483
484         /* Don't bother checking to see if these succeed or not */
485         pcmcia_release_configuration(link->handle);
486         if (link->io.NumPorts1)
487                 pcmcia_release_io(link->handle, &link->io);
488         if (link->irq.AssignedIRQ)
489                 pcmcia_release_irq(link->handle, &link->irq);
490         link->state &= ~DEV_CONFIG;
491         if (priv->hw.iobase)
492                 ioport_unmap(priv->hw.iobase);
493 }                               /* orinoco_cs_release */
494
495 /*
496  * The card status event handler.  Mostly, this schedules other stuff
497  * to run after an event is received.
498  */
499 static int
500 orinoco_cs_event(event_t event, int priority,
501                        event_callback_args_t * args)
502 {
503         dev_link_t *link = args->client_data;
504         struct net_device *dev = link->priv;
505         struct orinoco_private *priv = netdev_priv(dev);
506         struct orinoco_pccard *card = priv->card;
507         int err = 0;
508         unsigned long flags;
509
510         switch (event) {
511         case CS_EVENT_CARD_REMOVAL:
512                 link->state &= ~DEV_PRESENT;
513                 if (link->state & DEV_CONFIG) {
514                         unsigned long flags;
515
516                         spin_lock_irqsave(&priv->lock, flags);
517                         netif_device_detach(dev);
518                         priv->hw_unavailable++;
519                         spin_unlock_irqrestore(&priv->lock, flags);
520                 }
521                 break;
522
523         case CS_EVENT_CARD_INSERTION:
524                 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
525                 orinoco_cs_config(link);
526                 break;
527
528         case CS_EVENT_PM_SUSPEND:
529                 link->state |= DEV_SUSPEND;
530                 /* Fall through... */
531         case CS_EVENT_RESET_PHYSICAL:
532                 /* Mark the device as stopped, to block IO until later */
533                 if (link->state & DEV_CONFIG) {
534                         /* This is probably racy, but I can't think of
535                            a better way, short of rewriting the PCMCIA
536                            layer to not suck :-( */
537                         if (! test_bit(0, &card->hard_reset_in_progress)) {
538                                 spin_lock_irqsave(&priv->lock, flags);
539
540                                 err = __orinoco_down(dev);
541                                 if (err)
542                                         printk(KERN_WARNING "%s: %s: Error %d downing interface\n",
543                                                dev->name,
544                                                event == CS_EVENT_PM_SUSPEND ? "SUSPEND" : "RESET_PHYSICAL",
545                                                err);
546                                 
547                                 netif_device_detach(dev);
548                                 priv->hw_unavailable++;
549
550                                 spin_unlock_irqrestore(&priv->lock, flags);
551                         }
552
553                         pcmcia_release_configuration(link->handle);
554                 }
555                 break;
556
557         case CS_EVENT_PM_RESUME:
558                 link->state &= ~DEV_SUSPEND;
559                 /* Fall through... */
560         case CS_EVENT_CARD_RESET:
561                 if (link->state & DEV_CONFIG) {
562                         /* FIXME: should we double check that this is
563                          * the same card as we had before */
564                         pcmcia_request_configuration(link->handle, &link->conf);
565
566                         if (! test_bit(0, &card->hard_reset_in_progress)) {
567                                 err = orinoco_reinit_firmware(dev);
568                                 if (err) {
569                                         printk(KERN_ERR "%s: Error %d re-initializing firmware\n",
570                                                dev->name, err);
571                                         break;
572                                 }
573                                 
574                                 spin_lock_irqsave(&priv->lock, flags);
575                                 
576                                 netif_device_attach(dev);
577                                 priv->hw_unavailable--;
578                                 
579                                 if (priv->open && ! priv->hw_unavailable) {
580                                         err = __orinoco_up(dev);
581                                         if (err)
582                                                 printk(KERN_ERR "%s: Error %d restarting card\n",
583                                                        dev->name, err);
584                                         
585                                 }
586
587                                 spin_unlock_irqrestore(&priv->lock, flags);
588                         }
589                 }
590                 break;
591         }
592
593         return err;
594 }                               /* orinoco_cs_event */
595
596 /********************************************************************/
597 /* Module initialization                                            */
598 /********************************************************************/
599
600 /* Can't be declared "const" or the whole __initdata section will
601  * become const */
602 static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION
603         " (David Gibson <hermes@gibson.dropbear.id.au>, "
604         "Pavel Roskin <proski@gnu.org>, et al)";
605
606 static struct pcmcia_device_id orinoco_cs_ids[] = {
607         PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300),
608         PCMCIA_DEVICE_MANF_CARD(0x0089, 0x0001),
609         PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002),
610         PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002),
611         PCMCIA_DEVICE_MANF_CARD(0x01eb, 0x080a),
612         PCMCIA_DEVICE_MANF_CARD(0x0261, 0x0002),
613         PCMCIA_DEVICE_MANF_CARD(0x0268, 0x0001),
614         PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0305),
615         PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1613),
616         PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0002),
617         PCMCIA_DEVICE_MANF_CARD(0x028a, 0x0673),
618         PCMCIA_DEVICE_MANF_CARD(0x02aa, 0x0002),
619         PCMCIA_DEVICE_MANF_CARD(0x02ac, 0x0002),
620         PCMCIA_DEVICE_MANF_CARD(0x14ea, 0xb001),
621         PCMCIA_DEVICE_MANF_CARD(0x50c2, 0x7300),
622         PCMCIA_DEVICE_MANF_CARD(0x9005, 0x0021),
623         PCMCIA_DEVICE_MANF_CARD(0xc250, 0x0002),
624         PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
625         PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
626         PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
627         PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
628         PCMCIA_DEVICE_PROD_ID12("3Com", "3CRWE737A AirConnect Wireless LAN PC Card", 0x41240e5b, 0x56010af3),
629         PCMCIA_DEVICE_PROD_ID123("Instant Wireless ", " Network PC CARD", "Version 01.02", 0x11d901af, 0x6e9bd926, 0x4b74baa0),
630         PCMCIA_DEVICE_PROD_ID12("ACTIONTEC", "PRISM Wireless LAN PC Card", 0x393089da, 0xa71e69d5),
631         PCMCIA_DEVICE_PROD_ID12("Avaya Communication", "Avaya Wireless PC Card", 0xd8a43b78, 0x0d341169),
632         PCMCIA_DEVICE_PROD_ID12("BUFFALO", "WLI-PCM-L11G", 0x2decece3, 0xf57ca4b3),
633         PCMCIA_DEVICE_PROD_ID12("Cabletron", "RoamAbout 802.11 DS", 0x32d445f5, 0xedeffd90),
634         PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCC-11", 0x5261440f, 0xa6405584),
635         PCMCIA_DEVICE_PROD_ID12("corega K.K.", "Wireless LAN PCCA-11", 0x5261440f, 0xdf6115f9),
636         PCMCIA_DEVICE_PROD_ID12("D", "Link DRC-650 11Mbps WLAN Card", 0x71b18589, 0xf144e3ac),
637         PCMCIA_DEVICE_PROD_ID12("D", "Link DWL-650 11Mbps WLAN Card", 0x71b18589, 0xb6f1b0ab),
638         PCMCIA_DEVICE_PROD_ID12("ELSA", "AirLancer MC-11", 0x4507a33a, 0xef54f0e3),
639         PCMCIA_DEVICE_PROD_ID12("HyperLink", "Wireless PC Card 11Mbps", 0x56cc3f1a, 0x0bcf220c),
640         PCMCIA_DEVICE_PROD_ID12("INTERSIL", "HFA384x/IEEE", 0x74c5e40d, 0xdb472a18),
641         PCMCIA_DEVICE_PROD_ID12("Lucent Technologies", "WaveLAN/IEEE", 0x23eb9949, 0xc562e72a),
642         PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11", 0x481e0094, 0x7360e410),
643         PCMCIA_DEVICE_PROD_ID12("MELCO", "WLI-PCM-L11G", 0x481e0094, 0xf57ca4b3),
644         PCMCIA_DEVICE_PROD_ID12("Microsoft", "Wireless Notebook Adapter MN-520", 0x5961bf85, 0x6eec8c01),
645         PCMCIA_DEVICE_PROD_ID12("NCR", "WaveLAN/IEEE", 0x24358cd4, 0xc562e72a),
646         PCMCIA_DEVICE_PROD_ID12("NETGEAR MA401RA Wireless PC", "Card", 0x0306467f, 0x9762e8f1),
647         PCMCIA_DEVICE_PROD_ID12("PLANEX", "GeoWave/GW-CF110", 0x209f40ab, 0xd9715264),
648         PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PC CARD HARMONY 80211B", 0xc6536a5e, 0x090c3cd9),
649         PCMCIA_DEVICE_PROD_ID12("PROXIM", "LAN PCI CARD HARMONY 80211B", 0xc6536a5e, 0x9f494e26),
650         PCMCIA_DEVICE_PROD_ID12("SAMSUNG", "11Mbps WLAN Card", 0x43d74cb4, 0x579bd91b),
651         PCMCIA_DEVICE_PROD_ID1("Symbol Technologies", 0x3f02b4d6),
652         PCMCIA_DEVICE_NULL,
653 };
654 MODULE_DEVICE_TABLE(pcmcia, orinoco_cs_ids);
655
656 static struct pcmcia_driver orinoco_driver = {
657         .owner          = THIS_MODULE,
658         .drv            = {
659                 .name   = DRIVER_NAME,
660         },
661         .attach         = orinoco_cs_attach,
662         .event          = orinoco_cs_event,
663         .detach         = orinoco_cs_detach,
664         .id_table       = orinoco_cs_ids,
665 };
666
667 static int __init
668 init_orinoco_cs(void)
669 {
670         printk(KERN_DEBUG "%s\n", version);
671
672         return pcmcia_register_driver(&orinoco_driver);
673 }
674
675 static void __exit
676 exit_orinoco_cs(void)
677 {
678         pcmcia_unregister_driver(&orinoco_driver);
679         BUG_ON(dev_list != NULL);
680 }
681
682 module_init(init_orinoco_cs);
683 module_exit(exit_orinoco_cs);