diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2010-07-30 07:13:46 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2010-09-29 11:20:24 -0400 |
commit | 00990e7ce0b0e596fe41d9c64d6933ea70084003 (patch) | |
tree | 189e0dd92860feba84231c66955749574cac5d6d /drivers/net/wireless/hostap/hostap_cs.c | |
parent | 440eed43e2a95bb842488755683716814da10f2b (diff) |
pcmcia: use autoconfiguration feature for ioports and iomem
When CONF_AUTO_SET_IO or CONF_AUTO_SET_IOMEM are set, the corresponding
fields in struct pcmcia_device *p_dev->resource[0,1,2] are set
accordinly. Drivers wishing to override certain settings may do so in
the callback function, but they no longer need to parse the CIS entries
stored in cistpl_cftable_entry_t themselves.
CC: netdev@vger.kernel.org
CC: linux-wireless@vger.kernel.org
CC: linux-ide@vger.kernel.org
CC: linux-usb@vger.kernel.org
CC: laforge@gnumonks.org
CC: linux-mtd@lists.infradead.org
CC: linux-bluetooth@vger.kernel.org
CC: alsa-devel@alsa-project.org
CC: linux-serial@vger.kernel.org
CC: Jiri Kosina <jkosina@suse.cz>
CC: linux-scsi@vger.kernel.org
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_cs.c')
-rw-r--r-- | drivers/net/wireless/hostap/hostap_cs.c | 43 |
1 files changed, 4 insertions, 39 deletions
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index d4f19af1757f..e57b20134d39 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -469,46 +469,11 @@ static void prism2_detach(struct pcmcia_device *link) | |||
469 | /* run after a CARD_INSERTION event is received to configure the PCMCIA | 469 | /* run after a CARD_INSERTION event is received to configure the PCMCIA |
470 | * socket and make the device available to the system */ | 470 | * socket and make the device available to the system */ |
471 | 471 | ||
472 | static int prism2_config_check(struct pcmcia_device *p_dev, | 472 | static int prism2_config_check(struct pcmcia_device *p_dev, void *priv_data) |
473 | cistpl_cftable_entry_t *cfg, | ||
474 | cistpl_cftable_entry_t *dflt, | ||
475 | void *priv_data) | ||
476 | { | 473 | { |
477 | if (cfg->index == 0) | 474 | if (p_dev->config_index == 0) |
478 | return -ENODEV; | 475 | return -EINVAL; |
479 | |||
480 | PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X " | ||
481 | "(default 0x%02X)\n", cfg->index, dflt->index); | ||
482 | |||
483 | if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) | ||
484 | p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
485 | else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) | ||
486 | p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
487 | |||
488 | /* Do we need to allocate an interrupt? */ | ||
489 | p_dev->config_flags |= CONF_ENABLE_IRQ; | ||
490 | |||
491 | /* IO window settings */ | ||
492 | PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d " | ||
493 | "dflt->io.nwin=%d\n", | ||
494 | cfg->io.nwin, dflt->io.nwin); | ||
495 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; | ||
496 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | ||
497 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | ||
498 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; | ||
499 | p_dev->resource[0]->flags |= | ||
500 | pcmcia_io_cfg_data_width(io->flags); | ||
501 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; | ||
502 | p_dev->resource[0]->start = io->win[0].base; | ||
503 | p_dev->resource[0]->end = io->win[0].len; | ||
504 | if (io->nwin > 1) { | ||
505 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; | ||
506 | p_dev->resource[1]->start = io->win[1].base; | ||
507 | p_dev->resource[1]->end = io->win[1].len; | ||
508 | } | ||
509 | } | ||
510 | 476 | ||
511 | /* This reserves IO space but doesn't actually enable it */ | ||
512 | return pcmcia_request_io(p_dev); | 477 | return pcmcia_request_io(p_dev); |
513 | } | 478 | } |
514 | 479 | ||
@@ -531,7 +496,7 @@ static int prism2_config(struct pcmcia_device *link) | |||
531 | 496 | ||
532 | /* Look for an appropriate configuration table entry in the CIS */ | 497 | /* Look for an appropriate configuration table entry in the CIS */ |
533 | link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO | | 498 | link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO | |
534 | CONF_AUTO_CHECK_VCC; | 499 | CONF_AUTO_CHECK_VCC | CONF_AUTO_SET_IO | CONF_ENABLE_IRQ; |
535 | if (ignore_cis_vcc) | 500 | if (ignore_cis_vcc) |
536 | link->config_flags &= ~CONF_AUTO_CHECK_VCC; | 501 | link->config_flags &= ~CONF_AUTO_CHECK_VCC; |
537 | ret = pcmcia_loop_config(link, prism2_config_check, NULL); | 502 | ret = pcmcia_loop_config(link, prism2_config_check, NULL); |