aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/pcnet_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-07-30 07:13:46 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2010-09-29 11:20:24 -0400
commit00990e7ce0b0e596fe41d9c64d6933ea70084003 (patch)
tree189e0dd92860feba84231c66955749574cac5d6d /drivers/net/pcmcia/pcnet_cs.c
parent440eed43e2a95bb842488755683716814da10f2b (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/pcnet_cs.c')
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c38
1 files changed, 9 insertions, 29 deletions
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 12b028c6abc..ffe2587b914 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -259,7 +259,7 @@ static int pcnet_probe(struct pcmcia_device *link)
259 info->p_dev = link; 259 info->p_dev = link;
260 link->priv = dev; 260 link->priv = dev;
261 261
262 link->config_flags |= CONF_ENABLE_IRQ; 262 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
263 263
264 dev->netdev_ops = &pcnet_netdev_ops; 264 dev->netdev_ops = &pcnet_netdev_ops;
265 265
@@ -500,42 +500,22 @@ static int try_io_port(struct pcmcia_device *link)
500 } 500 }
501} 501}
502 502
503static int pcnet_confcheck(struct pcmcia_device *p_dev, 503static int pcnet_confcheck(struct pcmcia_device *p_dev, void *priv_data)
504 cistpl_cftable_entry_t *cfg,
505 cistpl_cftable_entry_t *dflt,
506 void *priv_data)
507{ 504{
508 int *priv = priv_data; 505 int *priv = priv_data;
509 int try = (*priv & 0x1); 506 int try = (*priv & 0x1);
510 int i;
511 cistpl_io_t *io = &cfg->io;
512 507
513 if (cfg->index == 0 || cfg->io.nwin == 0) 508 *priv &= (p_dev->resource[2]->end >= 0x4000) ? 0x10 : ~0x10;
514 return -EINVAL;
515 509
516 /* For multifunction cards, by convention, we configure the 510 if (p_dev->config_index == 0)
517 network function with window 0, and serial with window 1 */ 511 return -EINVAL;
518 if (io->nwin > 1) {
519 i = (io->win[1].len > io->win[0].len);
520 p_dev->resource[1]->start = io->win[1-i].base;
521 p_dev->resource[1]->end = io->win[1-i].len;
522 } else {
523 i = p_dev->resource[1]->end = 0;
524 }
525 512
526 *priv &= ((cfg->mem.nwin == 1) && 513 if (p_dev->resource[0]->end + p_dev->resource[1]->end < 32)
527 (cfg->mem.win[0].len >= 0x4000)) ? 0x10 : ~0x10; 514 return -EINVAL;
528 515
529 p_dev->resource[0]->start = io->win[i].base; 516 if (try)
530 p_dev->resource[0]->end = io->win[i].len;
531 if (!try)
532 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
533 else
534 p_dev->io_lines = 16; 517 p_dev->io_lines = 16;
535 if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32) 518 return try_io_port(p_dev);
536 return try_io_port(p_dev);
537
538 return -EINVAL;
539} 519}
540 520
541static hw_info_t *pcnet_try_config(struct pcmcia_device *link, 521static hw_info_t *pcnet_try_config(struct pcmcia_device *link,