aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-07-30 03:51:52 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2010-09-29 11:20:23 -0400
commit440eed43e2a95bb842488755683716814da10f2b (patch)
tree45c49181a077f845cd366cfa7dc07f259fd01078
parent9485ee14e143c7076e88deea1e87ca3eb0b2f94e (diff)
pcmcia: introduce autoconfiguration feature
Introduce an autoconfiguration feature to set certain values in pcmcia_loop_config(), instead of copying the same code over and over in each PCMCIA driver. At first, introduce the following options: CONF_AUTO_CHECK_VCC check or matching Vcc entry CONF_AUTO_SET_VPP set Vpp CONF_AUTO_AUDIO enable the speaker line 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: alsa-devel@alsa-project.org CC: linux-serial@vger.kernel.org CC: Jiri Kosina <jkosina@suse.cz> CC: linux-scsi@vger.kernel.org Acked-by: Gustavo F. Padovan <padovan@profusion.mobi> (for drivers/bluetooth) Tested-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
-rw-r--r--drivers/ata/pata_pcmcia.c23
-rw-r--r--drivers/bluetooth/bt3c_cs.c7
-rw-r--r--drivers/bluetooth/btuart_cs.c7
-rw-r--r--drivers/bluetooth/dtl1_cs.c1
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c1
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c1
-rw-r--r--drivers/char/pcmcia/ipwireless/main.c1
-rw-r--r--drivers/char/pcmcia/synclink_cs.c1
-rw-r--r--drivers/ide/ide-cs.c23
-rw-r--r--drivers/isdn/hardware/avm/avm_cs.c1
-rw-r--r--drivers/isdn/hisax/avma1_cs.c1
-rw-r--r--drivers/isdn/hisax/elsa_cs.c1
-rw-r--r--drivers/isdn/hisax/sedlbauer_cs.c25
-rw-r--r--drivers/isdn/hisax/teles_cs.c1
-rw-r--r--drivers/net/pcmcia/axnet_cs.c1
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c1
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c1
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c2
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c5
-rw-r--r--drivers/net/wireless/airo_cs.c17
-rw-r--r--drivers/net/wireless/atmel_cs.c17
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c27
-rw-r--r--drivers/net/wireless/libertas/if_cs.c1
-rw-r--r--drivers/net/wireless/orinoco/orinoco_cs.c31
-rw-r--r--drivers/net/wireless/orinoco/spectrum_cs.c24
-rw-r--r--drivers/parport/parport_cs.c1
-rw-r--r--drivers/pcmcia/pcmcia_cis.c36
-rw-r--r--drivers/scsi/pcmcia/aha152x_stub.c1
-rw-r--r--drivers/scsi/pcmcia/fdomain_stub.c1
-rw-r--r--drivers/scsi/pcmcia/nsp_cs.c110
-rw-r--r--drivers/scsi/pcmcia/qlogic_stub.c1
-rw-r--r--drivers/scsi/pcmcia/sym53c500_cs.c1
-rw-r--r--drivers/serial/serial_cs.c10
-rw-r--r--drivers/staging/comedi/drivers/cb_das16_cs.c1
-rw-r--r--drivers/staging/comedi/drivers/das08_cs.c1
-rw-r--r--drivers/staging/comedi/drivers/ni_daq_700.c10
-rw-r--r--drivers/staging/comedi/drivers/ni_daq_dio24.c10
-rw-r--r--drivers/staging/comedi/drivers/ni_labpc_cs.c11
-rw-r--r--drivers/staging/comedi/drivers/ni_mio_cs.c1
-rw-r--r--drivers/staging/comedi/drivers/quatech_daqp_cs.c1
-rw-r--r--drivers/telephony/ixj_pcmcia.c1
-rw-r--r--drivers/usb/host/sl811_cs.c24
-rw-r--r--include/pcmcia/ds.h7
43 files changed, 120 insertions, 329 deletions
diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c
index 76da55d27e08..954f43c512f1 100644
--- a/drivers/ata/pata_pcmcia.c
+++ b/drivers/ata/pata_pcmcia.c
@@ -169,34 +169,16 @@ static struct ata_port_operations pcmcia_8bit_port_ops = {
169 169
170struct pcmcia_config_check { 170struct pcmcia_config_check {
171 unsigned long ctl_base; 171 unsigned long ctl_base;
172 int skip_vcc;
173 int is_kme; 172 int is_kme;
174}; 173};
175 174
176static int pcmcia_check_one_config(struct pcmcia_device *pdev, 175static int pcmcia_check_one_config(struct pcmcia_device *pdev,
177 cistpl_cftable_entry_t *cfg, 176 cistpl_cftable_entry_t *cfg,
178 cistpl_cftable_entry_t *dflt, 177 cistpl_cftable_entry_t *dflt,
179 unsigned int vcc,
180 void *priv_data) 178 void *priv_data)
181{ 179{
182 struct pcmcia_config_check *stk = priv_data; 180 struct pcmcia_config_check *stk = priv_data;
183 181
184 /* Check for matching Vcc, unless we're desperate */
185 if (!stk->skip_vcc) {
186 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
187 if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
188 return -ENODEV;
189 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
190 if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000)
191 return -ENODEV;
192 }
193 }
194
195 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
196 pdev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
197 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
198 pdev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
199
200 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 182 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
201 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 183 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
202 pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 184 pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
@@ -249,6 +231,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
249 pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 231 pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
250 pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 232 pdev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
251 pdev->config_flags |= CONF_ENABLE_IRQ; 233 pdev->config_flags |= CONF_ENABLE_IRQ;
234 pdev->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC;
252 235
253 /* See if we have a manufacturer identifier. Use it to set is_kme for 236 /* See if we have a manufacturer identifier. Use it to set is_kme for
254 vendor quirks */ 237 vendor quirks */
@@ -262,10 +245,10 @@ static int pcmcia_init_one(struct pcmcia_device *pdev)
262 if (!stk) 245 if (!stk)
263 goto out1; 246 goto out1;
264 stk->is_kme = is_kme; 247 stk->is_kme = is_kme;
265 stk->skip_vcc = io_base = ctl_base = 0; 248 io_base = ctl_base = 0;
266 249
267 if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) { 250 if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) {
268 stk->skip_vcc = 1; 251 pdev->config_flags &= ~CONF_AUTO_CHECK_VCC;
269 if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) 252 if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk))
270 goto failed; /* No suitable config found */ 253 goto failed; /* No suitable config found */
271 } 254 }
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c
index 3db95887cfd7..97338a3aae1a 100644
--- a/drivers/bluetooth/bt3c_cs.c
+++ b/drivers/bluetooth/bt3c_cs.c
@@ -659,7 +659,7 @@ static int bt3c_probe(struct pcmcia_device *link)
659 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 659 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
660 link->resource[0]->end = 8; 660 link->resource[0]->end = 8;
661 661
662 link->config_flags |= CONF_ENABLE_IRQ; 662 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP;
663 663
664 return bt3c_config(link); 664 return bt3c_config(link);
665} 665}
@@ -676,15 +676,11 @@ static void bt3c_detach(struct pcmcia_device *link)
676static int bt3c_check_config(struct pcmcia_device *p_dev, 676static int bt3c_check_config(struct pcmcia_device *p_dev,
677 cistpl_cftable_entry_t *cf, 677 cistpl_cftable_entry_t *cf,
678 cistpl_cftable_entry_t *dflt, 678 cistpl_cftable_entry_t *dflt,
679 unsigned int vcc,
680 void *priv_data) 679 void *priv_data)
681{ 680{
682 unsigned long try = (unsigned long) priv_data; 681 unsigned long try = (unsigned long) priv_data;
683
684 p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; 682 p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
685 683
686 if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
687 p_dev->vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
688 if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && 684 if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&
689 (cf->io.win[0].base != 0)) { 685 (cf->io.win[0].base != 0)) {
690 p_dev->resource[0]->start = cf->io.win[0].base; 686 p_dev->resource[0]->start = cf->io.win[0].base;
@@ -697,7 +693,6 @@ static int bt3c_check_config(struct pcmcia_device *p_dev,
697static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev, 693static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev,
698 cistpl_cftable_entry_t *cf, 694 cistpl_cftable_entry_t *cf,
699 cistpl_cftable_entry_t *dflt, 695 cistpl_cftable_entry_t *dflt,
700 unsigned int vcc,
701 void *priv_data) 696 void *priv_data)
702{ 697{
703 static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 698 static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
index c5c43594ae0e..8a6864fc8c38 100644
--- a/drivers/bluetooth/btuart_cs.c
+++ b/drivers/bluetooth/btuart_cs.c
@@ -588,7 +588,7 @@ static int btuart_probe(struct pcmcia_device *link)
588 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 588 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
589 link->resource[0]->end = 8; 589 link->resource[0]->end = 8;
590 590
591 link->config_flags |= CONF_ENABLE_IRQ; 591 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP;
592 592
593 return btuart_config(link); 593 return btuart_config(link);
594} 594}
@@ -605,15 +605,11 @@ static void btuart_detach(struct pcmcia_device *link)
605static int btuart_check_config(struct pcmcia_device *p_dev, 605static int btuart_check_config(struct pcmcia_device *p_dev,
606 cistpl_cftable_entry_t *cf, 606 cistpl_cftable_entry_t *cf,
607 cistpl_cftable_entry_t *dflt, 607 cistpl_cftable_entry_t *dflt,
608 unsigned int vcc,
609 void *priv_data) 608 void *priv_data)
610{ 609{
611 int *try = priv_data; 610 int *try = priv_data;
612
613 p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; 611 p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
614 612
615 if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
616 p_dev->vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
617 if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && 613 if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) &&
618 (cf->io.win[0].base != 0)) { 614 (cf->io.win[0].base != 0)) {
619 p_dev->resource[0]->start = cf->io.win[0].base; 615 p_dev->resource[0]->start = cf->io.win[0].base;
@@ -626,7 +622,6 @@ static int btuart_check_config(struct pcmcia_device *p_dev,
626static int btuart_check_config_notpicky(struct pcmcia_device *p_dev, 622static int btuart_check_config_notpicky(struct pcmcia_device *p_dev,
627 cistpl_cftable_entry_t *cf, 623 cistpl_cftable_entry_t *cf,
628 cistpl_cftable_entry_t *dflt, 624 cistpl_cftable_entry_t *dflt,
629 unsigned int vcc,
630 void *priv_data) 625 void *priv_data)
631{ 626{
632 static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 627 static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index 38206df7206b..4620cc398676 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -592,7 +592,6 @@ static void dtl1_detach(struct pcmcia_device *link)
592static int dtl1_confcheck(struct pcmcia_device *p_dev, 592static int dtl1_confcheck(struct pcmcia_device *p_dev,
593 cistpl_cftable_entry_t *cf, 593 cistpl_cftable_entry_t *cf,
594 cistpl_cftable_entry_t *dflt, 594 cistpl_cftable_entry_t *dflt,
595 unsigned int vcc,
596 void *priv_data) 595 void *priv_data)
597{ 596{
598 if ((cf->io.nwin != 1) || (cf->io.win[0].len <= 8)) 597 if ((cf->io.nwin != 1) || (cf->io.win[0].len <= 8))
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 75caa8c1b484..0b2f3b9d261a 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -1744,7 +1744,6 @@ static void cmm_cm4000_release(struct pcmcia_device * link)
1744static int cm4000_config_check(struct pcmcia_device *p_dev, 1744static int cm4000_config_check(struct pcmcia_device *p_dev,
1745 cistpl_cftable_entry_t *cfg, 1745 cistpl_cftable_entry_t *cfg,
1746 cistpl_cftable_entry_t *dflt, 1746 cistpl_cftable_entry_t *dflt,
1747 unsigned int vcc,
1748 void *priv_data) 1747 void *priv_data)
1749{ 1748{
1750 if (!cfg->io.nwin) 1749 if (!cfg->io.nwin)
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index 0c87b80bf641..acf88d5c72b2 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -518,7 +518,6 @@ static void cm4040_reader_release(struct pcmcia_device *link)
518static int cm4040_config_check(struct pcmcia_device *p_dev, 518static int cm4040_config_check(struct pcmcia_device *p_dev,
519 cistpl_cftable_entry_t *cfg, 519 cistpl_cftable_entry_t *cfg,
520 cistpl_cftable_entry_t *dflt, 520 cistpl_cftable_entry_t *dflt,
521 unsigned int vcc,
522 void *priv_data) 521 void *priv_data)
523{ 522{
524 int rc; 523 int rc;
diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c
index cd21b2bcdcd7..1b7f0920737b 100644
--- a/drivers/char/pcmcia/ipwireless/main.c
+++ b/drivers/char/pcmcia/ipwireless/main.c
@@ -78,7 +78,6 @@ static void signalled_reboot_callback(void *callback_data)
78static int ipwireless_probe(struct pcmcia_device *p_dev, 78static int ipwireless_probe(struct pcmcia_device *p_dev,
79 cistpl_cftable_entry_t *cfg, 79 cistpl_cftable_entry_t *cfg,
80 cistpl_cftable_entry_t *dflt, 80 cistpl_cftable_entry_t *dflt,
81 unsigned int vcc,
82 void *priv_data) 81 void *priv_data)
83{ 82{
84 struct ipw_dev *ipw = priv_data; 83 struct ipw_dev *ipw = priv_data;
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 99feaedc53a1..c701434f76b7 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -564,7 +564,6 @@ static int mgslpc_probe(struct pcmcia_device *link)
564static int mgslpc_ioprobe(struct pcmcia_device *p_dev, 564static int mgslpc_ioprobe(struct pcmcia_device *p_dev,
565 cistpl_cftable_entry_t *cfg, 565 cistpl_cftable_entry_t *cfg,
566 cistpl_cftable_entry_t *dflt, 566 cistpl_cftable_entry_t *dflt,
567 unsigned int vcc,
568 void *priv_data) 567 void *priv_data)
569{ 568{
570 if (!cfg->io.nwin) 569 if (!cfg->io.nwin)
diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c
index 87ad04925a9f..25b8a105a98d 100644
--- a/drivers/ide/ide-cs.c
+++ b/drivers/ide/ide-cs.c
@@ -99,6 +99,7 @@ static int ide_probe(struct pcmcia_device *link)
99 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 99 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
100 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; 100 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
101 link->config_flags |= CONF_ENABLE_IRQ; 101 link->config_flags |= CONF_ENABLE_IRQ;
102 link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC;
102 103
103 return ide_config(link); 104 return ide_config(link);
104} /* ide_attach */ 105} /* ide_attach */
@@ -195,34 +196,16 @@ out_release:
195 196
196struct pcmcia_config_check { 197struct pcmcia_config_check {
197 unsigned long ctl_base; 198 unsigned long ctl_base;
198 int skip_vcc;
199 int is_kme; 199 int is_kme;
200}; 200};
201 201
202static int pcmcia_check_one_config(struct pcmcia_device *pdev, 202static int pcmcia_check_one_config(struct pcmcia_device *pdev,
203 cistpl_cftable_entry_t *cfg, 203 cistpl_cftable_entry_t *cfg,
204 cistpl_cftable_entry_t *dflt, 204 cistpl_cftable_entry_t *dflt,
205 unsigned int vcc,
206 void *priv_data) 205 void *priv_data)
207{ 206{
208 struct pcmcia_config_check *stk = priv_data; 207 struct pcmcia_config_check *stk = priv_data;
209 208
210 /* Check for matching Vcc, unless we're desperate */
211 if (!stk->skip_vcc) {
212 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
213 if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
214 return -ENODEV;
215 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
216 if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000)
217 return -ENODEV;
218 }
219 }
220
221 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
222 pdev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
223 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
224 pdev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
225
226 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 209 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
227 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 210 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
228 pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK; 211 pdev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
@@ -271,10 +254,10 @@ static int ide_config(struct pcmcia_device *link)
271 if (!stk) 254 if (!stk)
272 goto err_mem; 255 goto err_mem;
273 stk->is_kme = is_kme; 256 stk->is_kme = is_kme;
274 stk->skip_vcc = io_base = ctl_base = 0; 257 io_base = ctl_base = 0;
275 258
276 if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) { 259 if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) {
277 stk->skip_vcc = 1; 260 link->config_flags &= ~CONF_AUTO_CHECK_VCC;
278 if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) 261 if (pcmcia_loop_config(link, pcmcia_check_one_config, stk))
279 goto failed; /* No suitable config found */ 262 goto failed; /* No suitable config found */
280 } 263 }
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c
index 6ea5cd28d349..9dbab9c99bea 100644
--- a/drivers/isdn/hardware/avm/avm_cs.c
+++ b/drivers/isdn/hardware/avm/avm_cs.c
@@ -110,7 +110,6 @@ static void avmcs_detach(struct pcmcia_device *link)
110static int avmcs_configcheck(struct pcmcia_device *p_dev, 110static int avmcs_configcheck(struct pcmcia_device *p_dev,
111 cistpl_cftable_entry_t *cf, 111 cistpl_cftable_entry_t *cf,
112 cistpl_cftable_entry_t *dflt, 112 cistpl_cftable_entry_t *dflt,
113 unsigned int vcc,
114 void *priv_data) 113 void *priv_data)
115{ 114{
116 if (cf->io.nwin <= 0) 115 if (cf->io.nwin <= 0)
diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c
index 5dd47ad6ecc9..2f2b0005f07b 100644
--- a/drivers/isdn/hisax/avma1_cs.c
+++ b/drivers/isdn/hisax/avma1_cs.c
@@ -117,7 +117,6 @@ static void __devexit avma1cs_detach(struct pcmcia_device *link)
117static int avma1cs_configcheck(struct pcmcia_device *p_dev, 117static int avma1cs_configcheck(struct pcmcia_device *p_dev,
118 cistpl_cftable_entry_t *cf, 118 cistpl_cftable_entry_t *cf,
119 cistpl_cftable_entry_t *dflt, 119 cistpl_cftable_entry_t *dflt,
120 unsigned int vcc,
121 void *priv_data) 120 void *priv_data)
122{ 121{
123 if (cf->io.nwin <= 0) 122 if (cf->io.nwin <= 0)
diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c
index 368c8a213f0b..0a65280be8d5 100644
--- a/drivers/isdn/hisax/elsa_cs.c
+++ b/drivers/isdn/hisax/elsa_cs.c
@@ -163,7 +163,6 @@ static void __devexit elsa_cs_detach(struct pcmcia_device *link)
163static int elsa_cs_configcheck(struct pcmcia_device *p_dev, 163static int elsa_cs_configcheck(struct pcmcia_device *p_dev,
164 cistpl_cftable_entry_t *cf, 164 cistpl_cftable_entry_t *cf,
165 cistpl_cftable_entry_t *dflt, 165 cistpl_cftable_entry_t *dflt,
166 unsigned int vcc,
167 void *priv_data) 166 void *priv_data)
168{ 167{
169 int j; 168 int j;
diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c
index 791e23a75f78..b69eccfdbb05 100644
--- a/drivers/isdn/hisax/sedlbauer_cs.c
+++ b/drivers/isdn/hisax/sedlbauer_cs.c
@@ -164,33 +164,11 @@ static void __devexit sedlbauer_detach(struct pcmcia_device *link)
164static int sedlbauer_config_check(struct pcmcia_device *p_dev, 164static int sedlbauer_config_check(struct pcmcia_device *p_dev,
165 cistpl_cftable_entry_t *cfg, 165 cistpl_cftable_entry_t *cfg,
166 cistpl_cftable_entry_t *dflt, 166 cistpl_cftable_entry_t *dflt,
167 unsigned int vcc,
168 void *priv_data) 167 void *priv_data)
169{ 168{
170 if (cfg->index == 0) 169 if (cfg->index == 0)
171 return -ENODEV; 170 return -ENODEV;
172 171
173 /* Does this card need audio output? */
174 if (cfg->flags & CISTPL_CFTABLE_AUDIO)
175 p_dev->config_flags |= CONF_ENABLE_SPKR;
176
177 /* Use power settings for Vcc and Vpp if present */
178 /* Note that the CIS values need to be rescaled */
179 if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) {
180 if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000)
181 return -ENODEV;
182 } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) {
183 if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000)
184 return -ENODEV;
185 }
186
187 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
188 p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
189 else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
190 p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
191
192 p_dev->config_flags |= CONF_ENABLE_IRQ;
193
194 /* IO window settings */ 172 /* IO window settings */
195 p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 173 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
196 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 174 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
@@ -223,6 +201,9 @@ static int __devinit sedlbauer_config(struct pcmcia_device *link)
223 201
224 dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link); 202 dev_dbg(&link->dev, "sedlbauer_config(0x%p)\n", link);
225 203
204 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_CHECK_VCC |
205 CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO;
206
226 /* 207 /*
227 In this loop, we scan the CIS for configuration table entries, 208 In this loop, we scan the CIS for configuration table entries,
228 each of which describes a valid card configuration, including 209 each of which describes a valid card configuration, including
diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c
index 2ae71e3297ba..6605480aa37f 100644
--- a/drivers/isdn/hisax/teles_cs.c
+++ b/drivers/isdn/hisax/teles_cs.c
@@ -145,7 +145,6 @@ static void __devexit teles_detach(struct pcmcia_device *link)
145static int teles_cs_configcheck(struct pcmcia_device *p_dev, 145static int teles_cs_configcheck(struct pcmcia_device *p_dev,
146 cistpl_cftable_entry_t *cf, 146 cistpl_cftable_entry_t *cf,
147 cistpl_cftable_entry_t *dflt, 147 cistpl_cftable_entry_t *dflt,
148 unsigned int vcc,
149 void *priv_data) 148 void *priv_data)
150{ 149{
151 int j; 150 int j;
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index f361d2865e34..17f1040e255e 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -287,7 +287,6 @@ static int try_io_port(struct pcmcia_device *link)
287static int axnet_configcheck(struct pcmcia_device *p_dev, 287static int axnet_configcheck(struct pcmcia_device *p_dev,
288 cistpl_cftable_entry_t *cfg, 288 cistpl_cftable_entry_t *cfg,
289 cistpl_cftable_entry_t *dflt, 289 cistpl_cftable_entry_t *dflt,
290 unsigned int vcc,
291 void *priv_data) 290 void *priv_data)
292{ 291{
293 int i; 292 int i;
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index f6865adb126d..c1479e3bfab4 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -322,7 +322,6 @@ static int ungermann_try_io_port(struct pcmcia_device *link)
322static int fmvj18x_ioprobe(struct pcmcia_device *p_dev, 322static int fmvj18x_ioprobe(struct pcmcia_device *p_dev,
323 cistpl_cftable_entry_t *cfg, 323 cistpl_cftable_entry_t *cfg,
324 cistpl_cftable_entry_t *dflt, 324 cistpl_cftable_entry_t *dflt,
325 unsigned int vcc,
326 void *priv_data) 325 void *priv_data)
327{ 326{
328 return 0; /* strange, but that's what the code did already before... */ 327 return 0; /* strange, but that's what the code did already before... */
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 4a3b6a43550f..12b028c6abc9 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -503,7 +503,6 @@ static int try_io_port(struct pcmcia_device *link)
503static int pcnet_confcheck(struct pcmcia_device *p_dev, 503static int pcnet_confcheck(struct pcmcia_device *p_dev,
504 cistpl_cftable_entry_t *cfg, 504 cistpl_cftable_entry_t *cfg,
505 cistpl_cftable_entry_t *dflt, 505 cistpl_cftable_entry_t *dflt,
506 unsigned int vcc,
507 void *priv_data) 506 void *priv_data)
508{ 507{
509 int *priv = priv_data; 508 int *priv = priv_data;
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 8c16ba672012..e127d2b546dd 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -420,7 +420,6 @@ static int mhz_3288_power(struct pcmcia_device *link)
420static int mhz_mfc_config_check(struct pcmcia_device *p_dev, 420static int mhz_mfc_config_check(struct pcmcia_device *p_dev,
421 cistpl_cftable_entry_t *cf, 421 cistpl_cftable_entry_t *cf,
422 cistpl_cftable_entry_t *dflt, 422 cistpl_cftable_entry_t *dflt,
423 unsigned int vcc,
424 void *priv_data) 423 void *priv_data)
425{ 424{
426 int k; 425 int k;
@@ -590,7 +589,6 @@ static int mot_setup(struct pcmcia_device *link)
590static int smc_configcheck(struct pcmcia_device *p_dev, 589static int smc_configcheck(struct pcmcia_device *p_dev,
591 cistpl_cftable_entry_t *cf, 590 cistpl_cftable_entry_t *cf,
592 cistpl_cftable_entry_t *dflt, 591 cistpl_cftable_entry_t *dflt,
593 unsigned int vcc,
594 void *priv_data) 592 void *priv_data)
595{ 593{
596 p_dev->resource[0]->start = cf->io.win[0].base; 594 p_dev->resource[0]->start = cf->io.win[0].base;
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 7a4a99b73d17..2bc2eb89c4cd 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -668,7 +668,6 @@ static int
668xirc2ps_config_modem(struct pcmcia_device *p_dev, 668xirc2ps_config_modem(struct pcmcia_device *p_dev,
669 cistpl_cftable_entry_t *cf, 669 cistpl_cftable_entry_t *cf,
670 cistpl_cftable_entry_t *dflt, 670 cistpl_cftable_entry_t *dflt,
671 unsigned int vcc,
672 void *priv_data) 671 void *priv_data)
673{ 672{
674 unsigned int ioaddr; 673 unsigned int ioaddr;
@@ -688,7 +687,6 @@ static int
688xirc2ps_config_check(struct pcmcia_device *p_dev, 687xirc2ps_config_check(struct pcmcia_device *p_dev,
689 cistpl_cftable_entry_t *cf, 688 cistpl_cftable_entry_t *cf,
690 cistpl_cftable_entry_t *dflt, 689 cistpl_cftable_entry_t *dflt,
691 unsigned int vcc,
692 void *priv_data) 690 void *priv_data)
693{ 691{
694 int *pass = priv_data; 692 int *pass = priv_data;
@@ -826,7 +824,8 @@ xirc2ps_config(struct pcmcia_device * link)
826 * the Mako if (on the first pass) the COR bit 5 is set. 824 * the Mako if (on the first pass) the COR bit 5 is set.
827 */ 825 */
828 for (pass=0; pass < 2; pass++) 826 for (pass=0; pass < 2; pass++)
829 if (!pcmcia_loop_config(link, xirc2ps_config_check, &pass)) 827 if (!pcmcia_loop_config(link, xirc2ps_config_check,
828 &pass))
830 goto port_found; 829 goto port_found;
831 /* if special option: 830 /* if special option:
832 * try to configure as Ethernet only. 831 * try to configure as Ethernet only.
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c
index 5939d0c7a5c8..63bf662e9c7f 100644
--- a/drivers/net/wireless/airo_cs.c
+++ b/drivers/net/wireless/airo_cs.c
@@ -140,25 +140,11 @@ static void airo_detach(struct pcmcia_device *link)
140static int airo_cs_config_check(struct pcmcia_device *p_dev, 140static int airo_cs_config_check(struct pcmcia_device *p_dev,
141 cistpl_cftable_entry_t *cfg, 141 cistpl_cftable_entry_t *cfg,
142 cistpl_cftable_entry_t *dflt, 142 cistpl_cftable_entry_t *dflt,
143 unsigned int vcc,
144 void *priv_data) 143 void *priv_data)
145{ 144{
146 if (cfg->index == 0) 145 if (cfg->index == 0)
147 return -ENODEV; 146 return -ENODEV;
148 147
149 /* Does this card need audio output? */
150 if (cfg->flags & CISTPL_CFTABLE_AUDIO)
151 p_dev->config_flags |= CONF_ENABLE_SPKR;
152
153 /* Use power settings for Vcc and Vpp if present */
154 /* Note that the CIS values need to be rescaled */
155 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
156 p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
157 else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
158 p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
159
160 p_dev->config_flags |= CONF_ENABLE_IRQ;
161
162 /* IO window settings */ 148 /* IO window settings */
163 p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 149 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
164 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 150 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
@@ -193,6 +179,9 @@ static int airo_config(struct pcmcia_device *link)
193 179
194 dev_dbg(&link->dev, "airo_config\n"); 180 dev_dbg(&link->dev, "airo_config\n");
195 181
182 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP |
183 CONF_AUTO_AUDIO;
184
196 /* 185 /*
197 * In this loop, we scan the CIS for configuration table 186 * In this loop, we scan the CIS for configuration table
198 * entries, each of which describes a valid card 187 * entries, each of which describes a valid card
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index 080266eba985..812decd3fbe9 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -157,25 +157,11 @@ static int card_present(void *arg)
157static int atmel_config_check(struct pcmcia_device *p_dev, 157static int atmel_config_check(struct pcmcia_device *p_dev,
158 cistpl_cftable_entry_t *cfg, 158 cistpl_cftable_entry_t *cfg,
159 cistpl_cftable_entry_t *dflt, 159 cistpl_cftable_entry_t *dflt,
160 unsigned int vcc,
161 void *priv_data) 160 void *priv_data)
162{ 161{
163 if (cfg->index == 0) 162 if (cfg->index == 0)
164 return -ENODEV; 163 return -ENODEV;
165 164
166 /* Does this card need audio output? */
167 if (cfg->flags & CISTPL_CFTABLE_AUDIO)
168 p_dev->config_flags |= CONF_ENABLE_SPKR;
169
170 /* Use power settings for Vcc and Vpp if present */
171 /* Note that the CIS values need to be rescaled */
172 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
173 p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
174 else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
175 p_dev->vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
176
177 p_dev->config_flags |= CONF_ENABLE_IRQ;
178
179 /* IO window settings */ 165 /* IO window settings */
180 p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 166 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
181 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 167 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
@@ -207,6 +193,9 @@ static int atmel_config(struct pcmcia_device *link)
207 193
208 dev_dbg(&link->dev, "atmel_config\n"); 194 dev_dbg(&link->dev, "atmel_config\n");
209 195
196 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP |
197 CONF_AUTO_AUDIO;
198
210 /* 199 /*
211 In this loop, we scan the CIS for configuration table entries, 200 In this loop, we scan the CIS for configuration table entries,
212 each of which describes a valid card configuration, including 201 each of which describes a valid card configuration, including
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index 5b0b5828b3cf..d4f19af1757f 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -472,7 +472,6 @@ static void prism2_detach(struct pcmcia_device *link)
472static int prism2_config_check(struct pcmcia_device *p_dev, 472static int prism2_config_check(struct pcmcia_device *p_dev,
473 cistpl_cftable_entry_t *cfg, 473 cistpl_cftable_entry_t *cfg,
474 cistpl_cftable_entry_t *dflt, 474 cistpl_cftable_entry_t *dflt,
475 unsigned int vcc,
476 void *priv_data) 475 void *priv_data)
477{ 476{
478 if (cfg->index == 0) 477 if (cfg->index == 0)
@@ -481,28 +480,6 @@ static int prism2_config_check(struct pcmcia_device *p_dev,
481 PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X " 480 PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X "
482 "(default 0x%02X)\n", cfg->index, dflt->index); 481 "(default 0x%02X)\n", cfg->index, dflt->index);
483 482
484 /* Does this card need audio output? */
485 if (cfg->flags & CISTPL_CFTABLE_AUDIO)
486 p_dev->config_flags |= CONF_ENABLE_SPKR;
487
488 /* Use power settings for Vcc and Vpp if present */
489 /* Note that the CIS values need to be rescaled */
490 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
491 if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] /
492 10000 && !ignore_cis_vcc) {
493 PDEBUG(DEBUG_EXTRA, " Vcc mismatch - skipping"
494 " this entry\n");
495 return -ENODEV;
496 }
497 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
498 if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] /
499 10000 && !ignore_cis_vcc) {
500 PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch "
501 "- skipping this entry\n");
502 return -ENODEV;
503 }
504 }
505
506 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) 483 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
507 p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; 484 p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
508 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) 485 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
@@ -553,6 +530,10 @@ static int prism2_config(struct pcmcia_device *link)
553 } 530 }
554 531
555 /* Look for an appropriate configuration table entry in the CIS */ 532 /* Look for an appropriate configuration table entry in the CIS */
533 link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO |
534 CONF_AUTO_CHECK_VCC;
535 if (ignore_cis_vcc)
536 link->config_flags &= ~CONF_AUTO_CHECK_VCC;
556 ret = pcmcia_loop_config(link, prism2_config_check, NULL); 537 ret = pcmcia_loop_config(link, prism2_config_check, NULL);
557 if (ret) { 538 if (ret) {
558 if (!ignore_cis_vcc) 539 if (!ignore_cis_vcc)
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index 6020c19b1bdb..031f3e6da3c9 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -797,7 +797,6 @@ static void if_cs_release(struct pcmcia_device *p_dev)
797static int if_cs_ioprobe(struct pcmcia_device *p_dev, 797static int if_cs_ioprobe(struct pcmcia_device *p_dev,
798 cistpl_cftable_entry_t *cfg, 798 cistpl_cftable_entry_t *cfg,
799 cistpl_cftable_entry_t *dflt, 799 cistpl_cftable_entry_t *dflt,
800 unsigned int vcc,
801 void *priv_data) 800 void *priv_data)
802{ 801{
803 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; 802 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c
index 00316a1a1092..b92173827b55 100644
--- a/drivers/net/wireless/orinoco/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco/orinoco_cs.c
@@ -145,39 +145,11 @@ static void orinoco_cs_detach(struct pcmcia_device *link)
145static int orinoco_cs_config_check(struct pcmcia_device *p_dev, 145static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
146 cistpl_cftable_entry_t *cfg, 146 cistpl_cftable_entry_t *cfg,
147 cistpl_cftable_entry_t *dflt, 147 cistpl_cftable_entry_t *dflt,
148 unsigned int vcc,
149 void *priv_data) 148 void *priv_data)
150{ 149{
151 if (cfg->index == 0) 150 if (cfg->index == 0)
152 goto next_entry; 151 goto next_entry;
153 152
154 /* Use power settings for Vcc and Vpp if present */
155 /* Note that the CIS values need to be rescaled */
156 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
157 if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) {
158 DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n",
159 __func__, vcc,
160 cfg->vcc.param[CISTPL_POWER_VNOM] / 10000);
161 if (!ignore_cis_vcc)
162 goto next_entry;
163 }
164 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
165 if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
166 DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n",
167 __func__, vcc,
168 dflt->vcc.param[CISTPL_POWER_VNOM] / 10000);
169 if (!ignore_cis_vcc)
170 goto next_entry;
171 }
172 }
173
174 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
175 p_dev->vpp =
176 cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
177 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
178 p_dev->vpp =
179 dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
180
181 /* Do we need to allocate an interrupt? */ 153 /* Do we need to allocate an interrupt? */
182 p_dev->config_flags |= CONF_ENABLE_IRQ; 154 p_dev->config_flags |= CONF_ENABLE_IRQ;
183 155
@@ -230,6 +202,9 @@ orinoco_cs_config(struct pcmcia_device *link)
230 * and most client drivers will only use the CIS to fill in 202 * and most client drivers will only use the CIS to fill in
231 * implementation-defined details. 203 * implementation-defined details.
232 */ 204 */
205 link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC;
206 if (ignore_cis_vcc)
207 link->config_flags &= ~CONF_AUTO_CHECK_VCC;
233 ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); 208 ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL);
234 if (ret) { 209 if (ret) {
235 if (!ignore_cis_vcc) 210 if (!ignore_cis_vcc)
diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c
index ca2c6c0c5576..f462c78856e9 100644
--- a/drivers/net/wireless/orinoco/spectrum_cs.c
+++ b/drivers/net/wireless/orinoco/spectrum_cs.c
@@ -207,32 +207,11 @@ static void spectrum_cs_detach(struct pcmcia_device *link)
207static int spectrum_cs_config_check(struct pcmcia_device *p_dev, 207static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
208 cistpl_cftable_entry_t *cfg, 208 cistpl_cftable_entry_t *cfg,
209 cistpl_cftable_entry_t *dflt, 209 cistpl_cftable_entry_t *dflt,
210 unsigned int vcc,
211 void *priv_data) 210 void *priv_data)
212{ 211{
213 if (cfg->index == 0) 212 if (cfg->index == 0)
214 goto next_entry; 213 goto next_entry;
215 214
216 /* Use power settings for Vcc and Vpp if present */
217 /* Note that the CIS values need to be rescaled */
218 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
219 if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) {
220 DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n",
221 __func__, vcc,
222 cfg->vcc.param[CISTPL_POWER_VNOM] / 10000);
223 if (!ignore_cis_vcc)
224 goto next_entry;
225 }
226 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
227 if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) {
228 DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n",
229 __func__, vcc,
230 dflt->vcc.param[CISTPL_POWER_VNOM] / 10000);
231 if (!ignore_cis_vcc)
232 goto next_entry;
233 }
234 }
235
236 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) 215 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
237 p_dev->vpp = 216 p_dev->vpp =
238 cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; 217 cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
@@ -292,6 +271,9 @@ spectrum_cs_config(struct pcmcia_device *link)
292 * and most client drivers will only use the CIS to fill in 271 * and most client drivers will only use the CIS to fill in
293 * implementation-defined details. 272 * implementation-defined details.
294 */ 273 */
274 link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC;
275 if (ignore_cis_vcc)
276 link->config_flags &= ~CONF_AUTO_CHECK_VCC;
295 ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL); 277 ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL);
296 if (ret) { 278 if (ret) {
297 if (!ignore_cis_vcc) 279 if (!ignore_cis_vcc)
diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c
index 63b3d3c18c34..8c2a4733bc19 100644
--- a/drivers/parport/parport_cs.c
+++ b/drivers/parport/parport_cs.c
@@ -136,7 +136,6 @@ static void parport_detach(struct pcmcia_device *link)
136static int parport_config_check(struct pcmcia_device *p_dev, 136static int parport_config_check(struct pcmcia_device *p_dev,
137 cistpl_cftable_entry_t *cfg, 137 cistpl_cftable_entry_t *cfg,
138 cistpl_cftable_entry_t *dflt, 138 cistpl_cftable_entry_t *dflt,
139 unsigned int vcc,
140 void *priv_data) 139 void *priv_data)
141{ 140{
142 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 141 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
diff --git a/drivers/pcmcia/pcmcia_cis.c b/drivers/pcmcia/pcmcia_cis.c
index ce8b94a3b675..160da0697335 100644
--- a/drivers/pcmcia/pcmcia_cis.c
+++ b/drivers/pcmcia/pcmcia_cis.c
@@ -131,7 +131,6 @@ struct pcmcia_cfg_mem {
131 int (*conf_check) (struct pcmcia_device *p_dev, 131 int (*conf_check) (struct pcmcia_device *p_dev,
132 cistpl_cftable_entry_t *cfg, 132 cistpl_cftable_entry_t *cfg,
133 cistpl_cftable_entry_t *dflt, 133 cistpl_cftable_entry_t *dflt,
134 unsigned int vcc,
135 void *priv_data); 134 void *priv_data);
136 cisparse_t parse; 135 cisparse_t parse;
137 cistpl_cftable_entry_t dflt; 136 cistpl_cftable_entry_t dflt;
@@ -146,16 +145,46 @@ struct pcmcia_cfg_mem {
146 */ 145 */
147static int pcmcia_do_loop_config(tuple_t *tuple, cisparse_t *parse, void *priv) 146static int pcmcia_do_loop_config(tuple_t *tuple, cisparse_t *parse, void *priv)
148{ 147{
149 cistpl_cftable_entry_t *cfg = &parse->cftable_entry;
150 struct pcmcia_cfg_mem *cfg_mem = priv; 148 struct pcmcia_cfg_mem *cfg_mem = priv;
149 struct pcmcia_device *p_dev = cfg_mem->p_dev;
150 cistpl_cftable_entry_t *cfg = &parse->cftable_entry;
151 cistpl_cftable_entry_t *dflt = &cfg_mem->dflt;
152 unsigned int flags = p_dev->config_flags;
153 unsigned int vcc = p_dev->socket->socket.Vcc;
154
155 dev_dbg(&p_dev->dev, "testing configuration %x, autoconf %x\n",
156 cfg->index, flags);
151 157
152 /* default values */ 158 /* default values */
153 cfg_mem->p_dev->config_index = cfg->index; 159 cfg_mem->p_dev->config_index = cfg->index;
154 if (cfg->flags & CISTPL_CFTABLE_DEFAULT) 160 if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
155 cfg_mem->dflt = *cfg; 161 cfg_mem->dflt = *cfg;
156 162
163 /* check for matching Vcc? */
164 if (flags & CONF_AUTO_CHECK_VCC) {
165 if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) {
166 if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000)
167 return -ENODEV;
168 } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) {
169 if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000)
170 return -ENODEV;
171 }
172 }
173
174 /* set Vpp? */
175 if (flags & CONF_AUTO_SET_VPP) {
176 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM))
177 p_dev->vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
178 else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM))
179 p_dev->vpp =
180 dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
181 }
182
183 /* enable audio? */
184 if ((flags & CONF_AUTO_AUDIO) && (cfg->flags & CISTPL_CFTABLE_AUDIO))
185 p_dev->config_flags |= CONF_ENABLE_SPKR;
186
157 return cfg_mem->conf_check(cfg_mem->p_dev, cfg, &cfg_mem->dflt, 187 return cfg_mem->conf_check(cfg_mem->p_dev, cfg, &cfg_mem->dflt,
158 cfg_mem->p_dev->socket->socket.Vcc,
159 cfg_mem->priv_data); 188 cfg_mem->priv_data);
160} 189}
161 190
@@ -176,7 +205,6 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev,
176 int (*conf_check) (struct pcmcia_device *p_dev, 205 int (*conf_check) (struct pcmcia_device *p_dev,
177 cistpl_cftable_entry_t *cfg, 206 cistpl_cftable_entry_t *cfg,
178 cistpl_cftable_entry_t *dflt, 207 cistpl_cftable_entry_t *dflt,
179 unsigned int vcc,
180 void *priv_data), 208 void *priv_data),
181 void *priv_data) 209 void *priv_data)
182{ 210{
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index e1f748517135..0b5fc2fa0589 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -124,7 +124,6 @@ static void aha152x_detach(struct pcmcia_device *link)
124static int aha152x_config_check(struct pcmcia_device *p_dev, 124static int aha152x_config_check(struct pcmcia_device *p_dev,
125 cistpl_cftable_entry_t *cfg, 125 cistpl_cftable_entry_t *cfg,
126 cistpl_cftable_entry_t *dflt, 126 cistpl_cftable_entry_t *dflt,
127 unsigned int vcc,
128 void *priv_data) 127 void *priv_data)
129{ 128{
130 p_dev->io_lines = 10; 129 p_dev->io_lines = 10;
diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c
index ae263b17bfa5..3b9f311cb035 100644
--- a/drivers/scsi/pcmcia/fdomain_stub.c
+++ b/drivers/scsi/pcmcia/fdomain_stub.c
@@ -106,7 +106,6 @@ static void fdomain_detach(struct pcmcia_device *link)
106static int fdomain_config_check(struct pcmcia_device *p_dev, 106static int fdomain_config_check(struct pcmcia_device *p_dev,
107 cistpl_cftable_entry_t *cfg, 107 cistpl_cftable_entry_t *cfg,
108 cistpl_cftable_entry_t *dflt, 108 cistpl_cftable_entry_t *dflt,
109 unsigned int vcc,
110 void *priv_data) 109 void *priv_data)
111{ 110{
112 p_dev->io_lines = 10; 111 p_dev->io_lines = 10;
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index d0546c03f57c..344d49900b4c 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1597,7 +1597,6 @@ static void nsp_cs_detach(struct pcmcia_device *link)
1597static int nsp_cs_config_check(struct pcmcia_device *p_dev, 1597static int nsp_cs_config_check(struct pcmcia_device *p_dev,
1598 cistpl_cftable_entry_t *cfg, 1598 cistpl_cftable_entry_t *cfg,
1599 cistpl_cftable_entry_t *dflt, 1599 cistpl_cftable_entry_t *dflt,
1600 unsigned int vcc,
1601 void *priv_data) 1600 void *priv_data)
1602{ 1601{
1603 nsp_hw_data *data = priv_data; 1602 nsp_hw_data *data = priv_data;
@@ -1605,77 +1604,49 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev,
1605 if (cfg->index == 0) 1604 if (cfg->index == 0)
1606 return -ENODEV; 1605 return -ENODEV;
1607 1606
1608 /* Does this card need audio output? */ 1607 /* IO window settings */
1609 if (cfg->flags & CISTPL_CFTABLE_AUDIO) 1608 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
1610 p_dev->config_flags |= CONF_ENABLE_SPKR; 1609 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
1611 1610 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
1612 /* Use power settings for Vcc and Vpp if present */ 1611 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
1613 /* Note that the CIS values need to be rescaled */ 1612 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
1614 if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) { 1613 p_dev->resource[0]->flags |=
1615 if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000) 1614 pcmcia_io_cfg_data_width(io->flags);
1616 return -ENODEV; 1615 p_dev->resource[0]->start = io->win[0].base;
1617 else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) { 1616 p_dev->resource[0]->end = io->win[0].len;
1618 if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000) 1617 if (io->nwin > 1) {
1619 return -ENODEV; 1618 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
1620 } 1619 p_dev->resource[1]->start = io->win[1].base;
1621 1620 p_dev->resource[1]->end = io->win[1].len;
1622 if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) {
1623 p_dev->vpp =
1624 cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000;
1625 } else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) {
1626 p_dev->vpp =
1627 dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000;
1628 }
1629
1630 /* Do we need to allocate an interrupt? */
1631 p_dev->config_flags |= CONF_ENABLE_IRQ;
1632
1633 /* IO window settings */
1634 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
1635 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
1636 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
1637 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
1638 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
1639 p_dev->resource[0]->flags |=
1640 pcmcia_io_cfg_data_width(io->flags);
1641 p_dev->resource[0]->start = io->win[0].base;
1642 p_dev->resource[0]->end = io->win[0].len;
1643 if (io->nwin > 1) {
1644 p_dev->resource[1]->flags =
1645 p_dev->resource[0]->flags;
1646 p_dev->resource[1]->start = io->win[1].base;
1647 p_dev->resource[1]->end = io->win[1].len;
1648 }
1649 /* This reserves IO space but doesn't actually enable it */
1650 if (pcmcia_request_io(p_dev) != 0)
1651 goto next_entry;
1652 } 1621 }
1622 /* This reserves IO space but doesn't actually enable it */
1623 if (pcmcia_request_io(p_dev) != 0)
1624 goto next_entry;
1625 }
1653 1626
1654 if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { 1627 if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) {
1655 cistpl_mem_t *mem = 1628 cistpl_mem_t *mem =
1656 (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; 1629 (cfg->mem.nwin) ? &cfg->mem : &dflt->mem;
1657 p_dev->resource[2]->flags |= (WIN_DATA_WIDTH_16 | 1630 p_dev->resource[2]->flags |= (WIN_DATA_WIDTH_16 |
1658 WIN_MEMORY_TYPE_CM | 1631 WIN_MEMORY_TYPE_CM |
1659 WIN_ENABLE); 1632 WIN_ENABLE);
1660 p_dev->resource[2]->start = mem->win[0].host_addr; 1633 p_dev->resource[2]->start = mem->win[0].host_addr;
1661 p_dev->resource[2]->end = mem->win[0].len; 1634 p_dev->resource[2]->end = mem->win[0].len;
1662 if (p_dev->resource[2]->end < 0x1000) 1635 if (p_dev->resource[2]->end < 0x1000)
1663 p_dev->resource[2]->end = 0x1000; 1636 p_dev->resource[2]->end = 0x1000;
1664 if (pcmcia_request_window(p_dev, p_dev->resource[2], 1637 if (pcmcia_request_window(p_dev, p_dev->resource[2], 0) != 0)
1665 0) != 0) 1638 goto next_entry;
1666 goto next_entry; 1639 if (pcmcia_map_mem_page(p_dev, p_dev->resource[2],
1667 if (pcmcia_map_mem_page(p_dev, p_dev->resource[2], 1640 mem->win[0].card_addr) != 0)
1668 mem->win[0].card_addr) != 0) 1641 goto next_entry;
1669 goto next_entry; 1642
1670 1643 data->MmioAddress = (unsigned long)
1671 data->MmioAddress = (unsigned long) 1644 ioremap_nocache(p_dev->resource[2]->start,
1672 ioremap_nocache(p_dev->resource[2]->start,
1673 resource_size(p_dev->resource[2])); 1645 resource_size(p_dev->resource[2]));
1674 data->MmioLength = resource_size(p_dev->resource[2]); 1646 data->MmioLength = resource_size(p_dev->resource[2]);
1675 }
1676 /* If we got this far, we're cool! */
1677 return 0;
1678 } 1647 }
1648 /* If we got this far, we're cool! */
1649 return 0;
1679 1650
1680next_entry: 1651next_entry:
1681 nsp_dbg(NSP_DEBUG_INIT, "next"); 1652 nsp_dbg(NSP_DEBUG_INIT, "next");
@@ -1692,6 +1663,9 @@ static int nsp_cs_config(struct pcmcia_device *link)
1692 1663
1693 nsp_dbg(NSP_DEBUG_INIT, "in"); 1664 nsp_dbg(NSP_DEBUG_INIT, "in");
1694 1665
1666 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_CHECK_VCC |
1667 CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO;
1668
1695 ret = pcmcia_loop_config(link, nsp_cs_config_check, data); 1669 ret = pcmcia_loop_config(link, nsp_cs_config_check, data);
1696 if (ret) 1670 if (ret)
1697 goto cs_failed; 1671 goto cs_failed;
diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c
index 7d3f49c431fd..468fd12fe98d 100644
--- a/drivers/scsi/pcmcia/qlogic_stub.c
+++ b/drivers/scsi/pcmcia/qlogic_stub.c
@@ -179,7 +179,6 @@ static void qlogic_detach(struct pcmcia_device *link)
179static int qlogic_config_check(struct pcmcia_device *p_dev, 179static int qlogic_config_check(struct pcmcia_device *p_dev,
180 cistpl_cftable_entry_t *cfg, 180 cistpl_cftable_entry_t *cfg,
181 cistpl_cftable_entry_t *dflt, 181 cistpl_cftable_entry_t *dflt,
182 unsigned int vcc,
183 void *priv_data) 182 void *priv_data)
184{ 183{
185 p_dev->io_lines = 10; 184 p_dev->io_lines = 10;
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c
index 600630eb7034..7a0bb9aea042 100644
--- a/drivers/scsi/pcmcia/sym53c500_cs.c
+++ b/drivers/scsi/pcmcia/sym53c500_cs.c
@@ -686,7 +686,6 @@ static struct scsi_host_template sym53c500_driver_template = {
686static int SYM53C500_config_check(struct pcmcia_device *p_dev, 686static int SYM53C500_config_check(struct pcmcia_device *p_dev,
687 cistpl_cftable_entry_t *cfg, 687 cistpl_cftable_entry_t *cfg,
688 cistpl_cftable_entry_t *dflt, 688 cistpl_cftable_entry_t *dflt,
689 unsigned int vcc,
690 void *priv_data) 689 void *priv_data)
691{ 690{
692 p_dev->io_lines = 10; 691 p_dev->io_lines = 10;
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c
index 47b1869026e7..a796a93fe39c 100644
--- a/drivers/serial/serial_cs.c
+++ b/drivers/serial/serial_cs.c
@@ -427,16 +427,11 @@ static int pfc_config(struct pcmcia_device *p_dev)
427static int simple_config_check(struct pcmcia_device *p_dev, 427static int simple_config_check(struct pcmcia_device *p_dev,
428 cistpl_cftable_entry_t *cf, 428 cistpl_cftable_entry_t *cf,
429 cistpl_cftable_entry_t *dflt, 429 cistpl_cftable_entry_t *dflt,
430 unsigned int vcc,
431 void *priv_data) 430 void *priv_data)
432{ 431{
433 static const int size_table[2] = { 8, 16 }; 432 static const int size_table[2] = { 8, 16 };
434 int *try = priv_data; 433 int *try = priv_data;
435 434
436 if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
437 p_dev->vpp =
438 cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
439
440 p_dev->io_lines = ((*try & 0x1) == 0) ? 435 p_dev->io_lines = ((*try & 0x1) == 0) ?
441 16 : cf->io.flags & CISTPL_IO_LINES_MASK; 436 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
442 437
@@ -452,7 +447,6 @@ static int simple_config_check(struct pcmcia_device *p_dev,
452static int simple_config_check_notpicky(struct pcmcia_device *p_dev, 447static int simple_config_check_notpicky(struct pcmcia_device *p_dev,
453 cistpl_cftable_entry_t *cf, 448 cistpl_cftable_entry_t *cf,
454 cistpl_cftable_entry_t *dflt, 449 cistpl_cftable_entry_t *dflt,
455 unsigned int vcc,
456 void *priv_data) 450 void *priv_data)
457{ 451{
458 static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 452 static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
@@ -479,6 +473,7 @@ static int simple_config(struct pcmcia_device *link)
479 473
480 /* First pass: look for a config entry that looks normal. 474 /* First pass: look for a config entry that looks normal.
481 * Two tries: without IO aliases, then with aliases */ 475 * Two tries: without IO aliases, then with aliases */
476 link->config_flags |= CONF_AUTO_SET_VPP;
482 for (try = 0; try < 4; try++) 477 for (try = 0; try < 4; try++)
483 if (!pcmcia_loop_config(link, simple_config_check, &try)) 478 if (!pcmcia_loop_config(link, simple_config_check, &try))
484 goto found_port; 479 goto found_port;
@@ -511,7 +506,6 @@ found_port:
511static int multi_config_check(struct pcmcia_device *p_dev, 506static int multi_config_check(struct pcmcia_device *p_dev,
512 cistpl_cftable_entry_t *cf, 507 cistpl_cftable_entry_t *cf,
513 cistpl_cftable_entry_t *dflt, 508 cistpl_cftable_entry_t *dflt,
514 unsigned int vcc,
515 void *priv_data) 509 void *priv_data)
516{ 510{
517 int *base2 = priv_data; 511 int *base2 = priv_data;
@@ -532,7 +526,6 @@ static int multi_config_check(struct pcmcia_device *p_dev,
532static int multi_config_check_notpicky(struct pcmcia_device *p_dev, 526static int multi_config_check_notpicky(struct pcmcia_device *p_dev,
533 cistpl_cftable_entry_t *cf, 527 cistpl_cftable_entry_t *cf,
534 cistpl_cftable_entry_t *dflt, 528 cistpl_cftable_entry_t *dflt,
535 unsigned int vcc,
536 void *priv_data) 529 void *priv_data)
537{ 530{
538 int *base2 = priv_data; 531 int *base2 = priv_data;
@@ -621,7 +614,6 @@ static int multi_config(struct pcmcia_device *link)
621static int serial_check_for_multi(struct pcmcia_device *p_dev, 614static int serial_check_for_multi(struct pcmcia_device *p_dev,
622 cistpl_cftable_entry_t *cf, 615 cistpl_cftable_entry_t *cf,
623 cistpl_cftable_entry_t *dflt, 616 cistpl_cftable_entry_t *dflt,
624 unsigned int vcc,
625 void *priv_data) 617 void *priv_data)
626{ 618{
627 struct serial_info *info = p_dev->priv; 619 struct serial_info *info = p_dev->priv;
diff --git a/drivers/staging/comedi/drivers/cb_das16_cs.c b/drivers/staging/comedi/drivers/cb_das16_cs.c
index ee91c89511ed..678fbf67d7a8 100644
--- a/drivers/staging/comedi/drivers/cb_das16_cs.c
+++ b/drivers/staging/comedi/drivers/cb_das16_cs.c
@@ -712,7 +712,6 @@ static void das16cs_pcmcia_detach(struct pcmcia_device *link)
712static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, 712static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev,
713 cistpl_cftable_entry_t *cfg, 713 cistpl_cftable_entry_t *cfg,
714 cistpl_cftable_entry_t *dflt, 714 cistpl_cftable_entry_t *dflt,
715 unsigned int vcc,
716 void *priv_data) 715 void *priv_data)
717{ 716{
718 if (cfg->index == 0) 717 if (cfg->index == 0)
diff --git a/drivers/staging/comedi/drivers/das08_cs.c b/drivers/staging/comedi/drivers/das08_cs.c
index f8f3de57b413..12a96b7a43ad 100644
--- a/drivers/staging/comedi/drivers/das08_cs.c
+++ b/drivers/staging/comedi/drivers/das08_cs.c
@@ -194,7 +194,6 @@ static void das08_pcmcia_detach(struct pcmcia_device *link)
194static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, 194static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev,
195 cistpl_cftable_entry_t *cfg, 195 cistpl_cftable_entry_t *cfg,
196 cistpl_cftable_entry_t *dflt, 196 cistpl_cftable_entry_t *dflt,
197 unsigned int vcc,
198 void *priv_data) 197 void *priv_data)
199{ 198{
200 if (cfg->index == 0) 199 if (cfg->index == 0)
diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c
index 803683b83543..f22dc0f2a8d6 100644
--- a/drivers/staging/comedi/drivers/ni_daq_700.c
+++ b/drivers/staging/comedi/drivers/ni_daq_700.c
@@ -532,19 +532,11 @@ static void dio700_cs_detach(struct pcmcia_device *link)
532static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, 532static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev,
533 cistpl_cftable_entry_t *cfg, 533 cistpl_cftable_entry_t *cfg,
534 cistpl_cftable_entry_t *dflt, 534 cistpl_cftable_entry_t *dflt,
535 unsigned int vcc,
536 void *priv_data) 535 void *priv_data)
537{ 536{
538 if (cfg->index == 0) 537 if (cfg->index == 0)
539 return -ENODEV; 538 return -ENODEV;
540 539
541 /* Does this card need audio output? */
542 if (cfg->flags & CISTPL_CFTABLE_AUDIO)
543 p_dev->config_flags |= CONF_ENABLE_SPKR;
544
545 /* Do we need to allocate an interrupt? */
546 p_dev->config_flags |= CONF_ENABLE_IRQ;
547
548 /* IO window settings */ 540 /* IO window settings */
549 p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 541 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
550 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 542 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
@@ -578,6 +570,8 @@ static void dio700_config(struct pcmcia_device *link)
578 570
579 dev_dbg(&link->dev, "dio700_config\n"); 571 dev_dbg(&link->dev, "dio700_config\n");
580 572
573 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_AUDIO;
574
581 ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, NULL); 575 ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, NULL);
582 if (ret) { 576 if (ret) {
583 dev_warn(&link->dev, "no configuration found\n"); 577 dev_warn(&link->dev, "no configuration found\n");
diff --git a/drivers/staging/comedi/drivers/ni_daq_dio24.c b/drivers/staging/comedi/drivers/ni_daq_dio24.c
index 6512f7a283ce..6dc2b06064cd 100644
--- a/drivers/staging/comedi/drivers/ni_daq_dio24.c
+++ b/drivers/staging/comedi/drivers/ni_daq_dio24.c
@@ -284,19 +284,11 @@ static void dio24_cs_detach(struct pcmcia_device *link)
284static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, 284static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev,
285 cistpl_cftable_entry_t *cfg, 285 cistpl_cftable_entry_t *cfg,
286 cistpl_cftable_entry_t *dflt, 286 cistpl_cftable_entry_t *dflt,
287 unsigned int vcc,
288 void *priv_data) 287 void *priv_data)
289{ 288{
290 if (cfg->index == 0) 289 if (cfg->index == 0)
291 return -ENODEV; 290 return -ENODEV;
292 291
293 /* Does this card need audio output? */
294 if (cfg->flags & CISTPL_CFTABLE_AUDIO)
295 p_dev->config_flags |= CONF_ENABLE_SPKR;
296
297 /* Do we need to allocate an interrupt? */
298 p_dev->config_flags |= CONF_ENABLE_IRQ;
299
300 /* IO window settings */ 292 /* IO window settings */
301 p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 293 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
302 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 294 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
@@ -329,6 +321,8 @@ static void dio24_config(struct pcmcia_device *link)
329 321
330 dev_dbg(&link->dev, "dio24_config\n"); 322 dev_dbg(&link->dev, "dio24_config\n");
331 323
324 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_AUDIO;
325
332 ret = pcmcia_loop_config(link, dio24_pcmcia_config_loop, NULL); 326 ret = pcmcia_loop_config(link, dio24_pcmcia_config_loop, NULL);
333 if (ret) { 327 if (ret) {
334 dev_warn(&link->dev, "no configuration found\n"); 328 dev_warn(&link->dev, "no configuration found\n");
diff --git a/drivers/staging/comedi/drivers/ni_labpc_cs.c b/drivers/staging/comedi/drivers/ni_labpc_cs.c
index 255cf40c5fd1..6eacbd70e2e9 100644
--- a/drivers/staging/comedi/drivers/ni_labpc_cs.c
+++ b/drivers/staging/comedi/drivers/ni_labpc_cs.c
@@ -263,19 +263,11 @@ static void labpc_cs_detach(struct pcmcia_device *link)
263static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, 263static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev,
264 cistpl_cftable_entry_t *cfg, 264 cistpl_cftable_entry_t *cfg,
265 cistpl_cftable_entry_t *dflt, 265 cistpl_cftable_entry_t *dflt,
266 unsigned int vcc,
267 void *priv_data) 266 void *priv_data)
268{ 267{
269 if (cfg->index == 0) 268 if (cfg->index == 0)
270 return -ENODEV; 269 return -ENODEV;
271 270
272 /* Does this card need audio output? */
273 if (cfg->flags & CISTPL_CFTABLE_AUDIO)
274 p_dev->config_flags |= CONF_ENABLE_SPKR;
275
276 /* Do we need to allocate an interrupt? */
277 p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ;
278
279 /* IO window settings */ 271 /* IO window settings */
280 p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 272 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
281 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 273 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
@@ -307,6 +299,9 @@ static void labpc_config(struct pcmcia_device *link)
307 299
308 dev_dbg(&link->dev, "labpc_config\n"); 300 dev_dbg(&link->dev, "labpc_config\n");
309 301
302 link->config_flags |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ |
303 CONF_AUTO_AUDIO;
304
310 ret = pcmcia_loop_config(link, labpc_pcmcia_config_loop, NULL); 305 ret = pcmcia_loop_config(link, labpc_pcmcia_config_loop, NULL);
311 if (ret) { 306 if (ret) {
312 dev_warn(&link->dev, "no configuration found\n"); 307 dev_warn(&link->dev, "no configuration found\n");
diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c b/drivers/staging/comedi/drivers/ni_mio_cs.c
index b88f52dd08d0..da4e2a21b19a 100644
--- a/drivers/staging/comedi/drivers/ni_mio_cs.c
+++ b/drivers/staging/comedi/drivers/ni_mio_cs.c
@@ -302,7 +302,6 @@ static int mio_cs_resume(struct pcmcia_device *link)
302static int mio_pcmcia_config_loop(struct pcmcia_device *p_dev, 302static int mio_pcmcia_config_loop(struct pcmcia_device *p_dev,
303 cistpl_cftable_entry_t *cfg, 303 cistpl_cftable_entry_t *cfg,
304 cistpl_cftable_entry_t *dflt, 304 cistpl_cftable_entry_t *dflt,
305 unsigned int vcc,
306 void *priv_data) 305 void *priv_data)
307{ 306{
308 int base, ret; 307 int base, ret;
diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
index b8940d7f4155..03a72d7ac676 100644
--- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c
+++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c
@@ -1071,7 +1071,6 @@ static void daqp_cs_detach(struct pcmcia_device *link)
1071static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev, 1071static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev,
1072 cistpl_cftable_entry_t *cfg, 1072 cistpl_cftable_entry_t *cfg,
1073 cistpl_cftable_entry_t *dflt, 1073 cistpl_cftable_entry_t *dflt,
1074 unsigned int vcc,
1075 void *priv_data) 1074 void *priv_data)
1076{ 1075{
1077 if (cfg->index == 0) 1076 if (cfg->index == 0)
diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c
index e23270d1b4d1..670a76bf5164 100644
--- a/drivers/telephony/ixj_pcmcia.c
+++ b/drivers/telephony/ixj_pcmcia.c
@@ -112,7 +112,6 @@ failed:
112static int ixj_config_check(struct pcmcia_device *p_dev, 112static int ixj_config_check(struct pcmcia_device *p_dev,
113 cistpl_cftable_entry_t *cfg, 113 cistpl_cftable_entry_t *cfg,
114 cistpl_cftable_entry_t *dflt, 114 cistpl_cftable_entry_t *dflt,
115 unsigned int vcc,
116 void *priv_data) 115 void *priv_data)
117{ 116{
118 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 117 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c
index 744c2cd809f1..d9606293c1af 100644
--- a/drivers/usb/host/sl811_cs.c
+++ b/drivers/usb/host/sl811_cs.c
@@ -134,32 +134,11 @@ static void sl811_cs_release(struct pcmcia_device * link)
134static int sl811_cs_config_check(struct pcmcia_device *p_dev, 134static int sl811_cs_config_check(struct pcmcia_device *p_dev,
135 cistpl_cftable_entry_t *cfg, 135 cistpl_cftable_entry_t *cfg,
136 cistpl_cftable_entry_t *dflt, 136 cistpl_cftable_entry_t *dflt,
137 unsigned int vcc,
138 void *priv_data) 137 void *priv_data)
139{ 138{
140 if (cfg->index == 0) 139 if (cfg->index == 0)
141 return -ENODEV; 140 return -ENODEV;
142 141
143 /* Use power settings for Vcc and Vpp if present */
144 /* Note that the CIS values need to be rescaled */
145 if (cfg->vcc.present & (1<<CISTPL_POWER_VNOM)) {
146 if (cfg->vcc.param[CISTPL_POWER_VNOM]/10000 != vcc)
147 return -ENODEV;
148 } else if (dflt->vcc.present & (1<<CISTPL_POWER_VNOM)) {
149 if (dflt->vcc.param[CISTPL_POWER_VNOM]/10000 != vcc)
150 return -ENODEV;
151 }
152
153 if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM))
154 p_dev->vpp =
155 cfg->vpp1.param[CISTPL_POWER_VNOM]/10000;
156 else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM))
157 p_dev->vpp =
158 dflt->vpp1.param[CISTPL_POWER_VNOM]/10000;
159
160 /* we need an interrupt */
161 p_dev->config_flags |= CONF_ENABLE_IRQ;
162
163 /* IO window settings */ 142 /* IO window settings */
164 p_dev->resource[0]->end = p_dev->resource[1]->end = 0; 143 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
165 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 144 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
@@ -184,6 +163,9 @@ static int sl811_cs_config(struct pcmcia_device *link)
184 163
185 dev_dbg(&link->dev, "sl811_cs_config\n"); 164 dev_dbg(&link->dev, "sl811_cs_config\n");
186 165
166 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP |
167 CONF_AUTO_CHECK_VCC;
168
187 if (pcmcia_loop_config(link, sl811_cs_config_check, NULL)) 169 if (pcmcia_loop_config(link, sl811_cs_config_check, NULL))
188 goto failed; 170 goto failed;
189 171
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index 50b03fd67fd6..0577e5f10304 100644
--- a/include/pcmcia/ds.h
+++ b/include/pcmcia/ds.h
@@ -177,7 +177,6 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev,
177 int (*conf_check) (struct pcmcia_device *p_dev, 177 int (*conf_check) (struct pcmcia_device *p_dev,
178 cistpl_cftable_entry_t *cf, 178 cistpl_cftable_entry_t *cf,
179 cistpl_cftable_entry_t *dflt, 179 cistpl_cftable_entry_t *dflt,
180 unsigned int vcc,
181 void *priv_data), 180 void *priv_data),
182 void *priv_data); 181 void *priv_data);
183 182
@@ -270,6 +269,12 @@ static inline int pcmcia_io_cfg_data_width(unsigned int flags)
270#define CONF_ENABLE_PULSE_IRQ 0x04 269#define CONF_ENABLE_PULSE_IRQ 0x04
271#define CONF_ENABLE_ESR 0x08 270#define CONF_ENABLE_ESR 0x08
272 271
272/* flags used by pcmcia_loop_config() autoconfiguration */
273#define CONF_AUTO_CHECK_VCC 0x10 /* check for matching Vcc? */
274#define CONF_AUTO_SET_VPP 0x20 /* set Vpp? */
275#define CONF_AUTO_AUDIO 0x40 /* enable audio line? */
276
277
273#endif /* __KERNEL__ */ 278#endif /* __KERNEL__ */
274 279
275#endif /* _LINUX_DS_H */ 280#endif /* _LINUX_DS_H */