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/pcmcia/smc91c92_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/pcmcia/smc91c92_cs.c')
-rw-r--r-- | drivers/net/pcmcia/smc91c92_cs.c | 39 |
1 files changed, 19 insertions, 20 deletions
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index e127d2b546dd..a8cef28507de 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
@@ -323,9 +323,6 @@ static int smc91c92_probe(struct pcmcia_device *link) | |||
323 | link->priv = dev; | 323 | link->priv = dev; |
324 | 324 | ||
325 | spin_lock_init(&smc->lock); | 325 | spin_lock_init(&smc->lock); |
326 | link->resource[0]->end = 16; | ||
327 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; | ||
328 | link->config_flags |= CONF_ENABLE_IRQ; | ||
329 | 326 | ||
330 | /* The SMC91c92-specific entries in the device structure. */ | 327 | /* The SMC91c92-specific entries in the device structure. */ |
331 | dev->netdev_ops = &smc_netdev_ops; | 328 | dev->netdev_ops = &smc_netdev_ops; |
@@ -417,18 +414,21 @@ static int mhz_3288_power(struct pcmcia_device *link) | |||
417 | return 0; | 414 | return 0; |
418 | } | 415 | } |
419 | 416 | ||
420 | static int mhz_mfc_config_check(struct pcmcia_device *p_dev, | 417 | static int mhz_mfc_config_check(struct pcmcia_device *p_dev, void *priv_data) |
421 | cistpl_cftable_entry_t *cf, | ||
422 | cistpl_cftable_entry_t *dflt, | ||
423 | void *priv_data) | ||
424 | { | 418 | { |
425 | int k; | 419 | int k; |
426 | p_dev->resource[1]->start = cf->io.win[0].base; | 420 | p_dev->io_lines = 16; |
421 | p_dev->resource[1]->start = p_dev->resource[0]->start; | ||
422 | p_dev->resource[1]->end = 8; | ||
423 | p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; | ||
424 | p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; | ||
425 | p_dev->resource[0]->end = 16; | ||
426 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; | ||
427 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; | ||
427 | for (k = 0; k < 0x400; k += 0x10) { | 428 | for (k = 0; k < 0x400; k += 0x10) { |
428 | if (k & 0x80) | 429 | if (k & 0x80) |
429 | continue; | 430 | continue; |
430 | p_dev->resource[0]->start = k ^ 0x300; | 431 | p_dev->resource[0]->start = k ^ 0x300; |
431 | p_dev->io_lines = 16; | ||
432 | if (!pcmcia_request_io(p_dev)) | 432 | if (!pcmcia_request_io(p_dev)) |
433 | return 0; | 433 | return 0; |
434 | } | 434 | } |
@@ -442,9 +442,8 @@ static int mhz_mfc_config(struct pcmcia_device *link) | |||
442 | unsigned int offset; | 442 | unsigned int offset; |
443 | int i; | 443 | int i; |
444 | 444 | ||
445 | link->config_flags |= CONF_ENABLE_SPKR; | 445 | link->config_flags |= CONF_ENABLE_SPKR | CONF_ENABLE_IRQ | |
446 | link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; | 446 | CONF_AUTO_SET_IO; |
447 | link->resource[1]->end = 8; | ||
448 | 447 | ||
449 | /* The Megahertz combo cards have modem-like CIS entries, so | 448 | /* The Megahertz combo cards have modem-like CIS entries, so |
450 | we have to explicitly try a bunch of port combinations. */ | 449 | we have to explicitly try a bunch of port combinations. */ |
@@ -586,13 +585,12 @@ static int mot_setup(struct pcmcia_device *link) | |||
586 | 585 | ||
587 | /*====================================================================*/ | 586 | /*====================================================================*/ |
588 | 587 | ||
589 | static int smc_configcheck(struct pcmcia_device *p_dev, | 588 | static int smc_configcheck(struct pcmcia_device *p_dev, void *priv_data) |
590 | cistpl_cftable_entry_t *cf, | ||
591 | cistpl_cftable_entry_t *dflt, | ||
592 | void *priv_data) | ||
593 | { | 589 | { |
594 | p_dev->resource[0]->start = cf->io.win[0].base; | 590 | p_dev->resource[0]->end = 16; |
595 | p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; | 591 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
592 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; | ||
593 | |||
596 | return pcmcia_request_io(p_dev); | 594 | return pcmcia_request_io(p_dev); |
597 | } | 595 | } |
598 | 596 | ||
@@ -601,7 +599,8 @@ static int smc_config(struct pcmcia_device *link) | |||
601 | struct net_device *dev = link->priv; | 599 | struct net_device *dev = link->priv; |
602 | int i; | 600 | int i; |
603 | 601 | ||
604 | link->resource[0]->end = 16; | 602 | link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; |
603 | |||
605 | i = pcmcia_loop_config(link, smc_configcheck, NULL); | 604 | i = pcmcia_loop_config(link, smc_configcheck, NULL); |
606 | if (!i) | 605 | if (!i) |
607 | dev->base_addr = link->resource[0]->start; | 606 | dev->base_addr = link->resource[0]->start; |
@@ -634,7 +633,7 @@ static int osi_config(struct pcmcia_device *link) | |||
634 | static const unsigned int com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }; | 633 | static const unsigned int com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }; |
635 | int i, j; | 634 | int i, j; |
636 | 635 | ||
637 | link->config_flags |= CONF_ENABLE_SPKR; | 636 | link->config_flags |= CONF_ENABLE_SPKR | CONF_ENABLE_IRQ; |
638 | link->resource[0]->end = 64; | 637 | link->resource[0]->end = 64; |
639 | link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; | 638 | link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; |
640 | link->resource[1]->end = 8; | 639 | link->resource[1]->end = 8; |