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