aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/hostap/hostap_cs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_cs.c')
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c117
1 files changed, 16 insertions, 101 deletions
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index ba54d1b04d22..c052a0d5cbdd 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 469static int prism2_config_check(struct pcmcia_device *p_dev, void *priv_data)
472 * socket and make the device available to the system */
473
474static 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
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 473
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)
@@ -579,43 +518,23 @@ static int prism2_config(struct pcmcia_device *link)
579 hw_priv->link = link; 518 hw_priv->link = link;
580 519
581 /* 520 /*
582 * Make sure the IRQ handler cannot proceed until at least 521 * We enable IRQ here, but IRQ handler will not proceed
583 * dev->base_addr is initialized. 522 * until dev->base_addr is set below. This protect us from
523 * receive interrupts when driver is not initialized.
584 */ 524 */
585 spin_lock_irqsave(&local->irq_init_lock, flags);
586
587 ret = pcmcia_request_irq(link, prism2_interrupt); 525 ret = pcmcia_request_irq(link, prism2_interrupt);
588 if (ret) 526 if (ret)
589 goto failed_unlock; 527 goto failed;
590 528
591 /* 529 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) 530 if (ret)
598 goto failed_unlock; 531 goto failed;
599 532
533 spin_lock_irqsave(&local->irq_init_lock, flags);
600 dev->irq = link->irq; 534 dev->irq = link->irq;
601 dev->base_addr = link->resource[0]->start; 535 dev->base_addr = link->resource[0]->start;
602
603 spin_unlock_irqrestore(&local->irq_init_lock, flags); 536 spin_unlock_irqrestore(&local->irq_init_lock, flags);
604 537
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; 538 local->shutdown = 0;
620 539
621 sandisk_enable_wireless(dev); 540 sandisk_enable_wireless(dev);
@@ -626,8 +545,6 @@ static int prism2_config(struct pcmcia_device *link)
626 545
627 return ret; 546 return ret;
628 547
629 failed_unlock:
630 spin_unlock_irqrestore(&local->irq_init_lock, flags);
631 failed: 548 failed:
632 kfree(hw_priv); 549 kfree(hw_priv);
633 prism2_release((u_long)link); 550 prism2_release((u_long)link);
@@ -703,7 +620,7 @@ static int hostap_cs_resume(struct pcmcia_device *link)
703 return 0; 620 return 0;
704} 621}
705 622
706static struct pcmcia_device_id hostap_cs_ids[] = { 623static const struct pcmcia_device_id hostap_cs_ids[] = {
707 PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100), 624 PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7100),
708 PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300), 625 PCMCIA_DEVICE_MANF_CARD(0x000b, 0x7300),
709 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777), 626 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777),
@@ -779,9 +696,7 @@ MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids);
779 696
780 697
781static struct pcmcia_driver hostap_driver = { 698static struct pcmcia_driver hostap_driver = {
782 .drv = { 699 .name = "hostap_cs",
783 .name = "hostap_cs",
784 },
785 .probe = hostap_cs_probe, 700 .probe = hostap_cs_probe,
786 .remove = prism2_detach, 701 .remove = prism2_detach,
787 .owner = THIS_MODULE, 702 .owner = THIS_MODULE,