aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/serial_cs.c
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 /drivers/serial/serial_cs.c
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>
Diffstat (limited to 'drivers/serial/serial_cs.c')
-rw-r--r--drivers/serial/serial_cs.c10
1 files changed, 1 insertions, 9 deletions
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;