diff options
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_cs.c')
-rw-r--r-- | drivers/net/wireless/hostap/hostap_cs.c | 102 |
1 files changed, 10 insertions, 92 deletions
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index ba54d1b04d22..bd8a4134edeb 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/wireless.h> | 12 | #include <linux/wireless.h> |
13 | #include <net/iw_handler.h> | 13 | #include <net/iw_handler.h> |
14 | 14 | ||
15 | #include <pcmcia/cs.h> | ||
16 | #include <pcmcia/cistpl.h> | 15 | #include <pcmcia/cistpl.h> |
17 | #include <pcmcia/cisreg.h> | 16 | #include <pcmcia/cisreg.h> |
18 | #include <pcmcia/ds.h> | 17 | #include <pcmcia/ds.h> |
@@ -437,7 +436,6 @@ static int hostap_cs_probe(struct pcmcia_device *p_dev) | |||
437 | int ret; | 436 | int ret; |
438 | 437 | ||
439 | PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info); | 438 | PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info); |
440 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | ||
441 | 439 | ||
442 | ret = prism2_config(p_dev); | 440 | ret = prism2_config(p_dev); |
443 | if (ret) { | 441 | if (ret) { |
@@ -468,74 +466,11 @@ static void prism2_detach(struct pcmcia_device *link) | |||
468 | } | 466 | } |
469 | 467 | ||
470 | 468 | ||
471 | /* run after a CARD_INSERTION event is received to configure the PCMCIA | 469 | static int prism2_config_check(struct pcmcia_device *p_dev, void *priv_data) |
472 | * socket and make the device available to the system */ | ||
473 | |||
474 | static int prism2_config_check(struct pcmcia_device *p_dev, | ||
475 | cistpl_cftable_entry_t *cfg, | ||
476 | cistpl_cftable_entry_t *dflt, | ||
477 | unsigned int vcc, | ||
478 | void *priv_data) | ||
479 | { | 470 | { |
480 | if (cfg->index == 0) | 471 | if (p_dev->config_index == 0) |
481 | return -ENODEV; | 472 | return -EINVAL; |
482 | |||
483 | PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X " | ||
484 | "(default 0x%02X)\n", cfg->index, dflt->index); | ||
485 | |||
486 | /* Does this card need audio output? */ | ||
487 | if (cfg->flags & CISTPL_CFTABLE_AUDIO) { | ||
488 | p_dev->conf.Attributes |= CONF_ENABLE_SPKR; | ||
489 | p_dev->conf.Status = CCSR_AUDIO_ENA; | ||
490 | } | ||
491 | |||
492 | /* Use power settings for Vcc and Vpp if present */ | ||
493 | /* Note that the CIS values need to be rescaled */ | ||
494 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { | ||
495 | if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / | ||
496 | 10000 && !ignore_cis_vcc) { | ||
497 | PDEBUG(DEBUG_EXTRA, " Vcc mismatch - skipping" | ||
498 | " this entry\n"); | ||
499 | return -ENODEV; | ||
500 | } | ||
501 | } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { | ||
502 | if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / | ||
503 | 10000 && !ignore_cis_vcc) { | ||
504 | PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch " | ||
505 | "- skipping this entry\n"); | ||
506 | return -ENODEV; | ||
507 | } | ||
508 | } | ||
509 | 473 | ||
510 | if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) | ||
511 | p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
512 | else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) | ||
513 | p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
514 | |||
515 | /* Do we need to allocate an interrupt? */ | ||
516 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | ||
517 | |||
518 | /* IO window settings */ | ||
519 | PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d " | ||
520 | "dflt->io.nwin=%d\n", | ||
521 | cfg->io.nwin, dflt->io.nwin); | ||
522 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; | ||
523 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | ||
524 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | ||
525 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; | ||
526 | p_dev->resource[0]->flags |= | ||
527 | pcmcia_io_cfg_data_width(io->flags); | ||
528 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; | ||
529 | p_dev->resource[0]->start = io->win[0].base; | ||
530 | p_dev->resource[0]->end = io->win[0].len; | ||
531 | if (io->nwin > 1) { | ||
532 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; | ||
533 | p_dev->resource[1]->start = io->win[1].base; | ||
534 | p_dev->resource[1]->end = io->win[1].len; | ||
535 | } | ||
536 | } | ||
537 | |||
538 | /* This reserves IO space but doesn't actually enable it */ | ||
539 | return pcmcia_request_io(p_dev); | 474 | return pcmcia_request_io(p_dev); |
540 | } | 475 | } |
541 | 476 | ||
@@ -557,6 +492,10 @@ static int prism2_config(struct pcmcia_device *link) | |||
557 | } | 492 | } |
558 | 493 | ||
559 | /* Look for an appropriate configuration table entry in the CIS */ | 494 | /* Look for an appropriate configuration table entry in the CIS */ |
495 | link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO | | ||
496 | CONF_AUTO_CHECK_VCC | CONF_AUTO_SET_IO | CONF_ENABLE_IRQ; | ||
497 | if (ignore_cis_vcc) | ||
498 | link->config_flags &= ~CONF_AUTO_CHECK_VCC; | ||
560 | ret = pcmcia_loop_config(link, prism2_config_check, NULL); | 499 | ret = pcmcia_loop_config(link, prism2_config_check, NULL); |
561 | if (ret) { | 500 | if (ret) { |
562 | if (!ignore_cis_vcc) | 501 | if (!ignore_cis_vcc) |
@@ -588,12 +527,7 @@ static int prism2_config(struct pcmcia_device *link) | |||
588 | if (ret) | 527 | if (ret) |
589 | goto failed_unlock; | 528 | goto failed_unlock; |
590 | 529 | ||
591 | /* | 530 | ret = pcmcia_enable_device(link); |
592 | * This actually configures the PCMCIA socket -- setting up | ||
593 | * the I/O windows and the interrupt mapping, and putting the | ||
594 | * card and host interface into "Memory and IO" mode. | ||
595 | */ | ||
596 | ret = pcmcia_request_configuration(link, &link->conf); | ||
597 | if (ret) | 531 | if (ret) |
598 | goto failed_unlock; | 532 | goto failed_unlock; |
599 | 533 | ||
@@ -602,20 +536,6 @@ static int prism2_config(struct pcmcia_device *link) | |||
602 | 536 | ||
603 | spin_unlock_irqrestore(&local->irq_init_lock, flags); | 537 | spin_unlock_irqrestore(&local->irq_init_lock, flags); |
604 | 538 | ||
605 | /* Finally, report what we've done */ | ||
606 | printk(KERN_INFO "%s: index 0x%02x: ", | ||
607 | dev_info, link->conf.ConfigIndex); | ||
608 | if (link->conf.Vpp) | ||
609 | printk(", Vpp %d.%d", link->conf.Vpp / 10, | ||
610 | link->conf.Vpp % 10); | ||
611 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | ||
612 | printk(", irq %d", link->irq); | ||
613 | if (link->resource[0]) | ||
614 | printk(" & %pR", link->resource[0]); | ||
615 | if (link->resource[1]) | ||
616 | printk(" & %pR", link->resource[1]); | ||
617 | printk("\n"); | ||
618 | |||
619 | local->shutdown = 0; | 539 | local->shutdown = 0; |
620 | 540 | ||
621 | sandisk_enable_wireless(dev); | 541 | sandisk_enable_wireless(dev); |
@@ -627,7 +547,7 @@ static int prism2_config(struct pcmcia_device *link) | |||
627 | return ret; | 547 | return ret; |
628 | 548 | ||
629 | failed_unlock: | 549 | failed_unlock: |
630 | spin_unlock_irqrestore(&local->irq_init_lock, flags); | 550 | spin_unlock_irqrestore(&local->irq_init_lock, flags); |
631 | failed: | 551 | failed: |
632 | kfree(hw_priv); | 552 | kfree(hw_priv); |
633 | prism2_release((u_long)link); | 553 | prism2_release((u_long)link); |
@@ -779,9 +699,7 @@ MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids); | |||
779 | 699 | ||
780 | 700 | ||
781 | static struct pcmcia_driver hostap_driver = { | 701 | static struct pcmcia_driver hostap_driver = { |
782 | .drv = { | 702 | .name = "hostap_cs", |
783 | .name = "hostap_cs", | ||
784 | }, | ||
785 | .probe = hostap_cs_probe, | 703 | .probe = hostap_cs_probe, |
786 | .remove = prism2_detach, | 704 | .remove = prism2_detach, |
787 | .owner = THIS_MODULE, | 705 | .owner = THIS_MODULE, |