aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/pcnet_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-07-24 11:23:51 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2010-08-03 03:04:11 -0400
commit90abdc3b973229bae98dd96649d9f7106cc177a4 (patch)
tree5c1a7a131b65560dd73b5103118d8c7631bd76a4 /drivers/net/pcmcia/pcnet_cs.c
parent9a017a910346afd88ec2e065989903bf211a7d37 (diff)
pcmcia: do not use io_req_t when calling pcmcia_request_io()
Instead of io_req_t, drivers are now requested to fill out struct pcmcia_device *p_dev->resource[0,1] for up to two ioport ranges. After a call to pcmcia_request_io(), the ports found there are reserved, after calling pcmcia_request_configuration(), they may be used. 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: Michael Buesch <mb@bu3sch.de> Acked-by: Marcel Holtmann <marcel@holtmann.org> (for drivers/bluetooth/) 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.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index c9cd2377ef91..9c5fc9dfc55d 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -477,29 +477,31 @@ static hw_info_t *get_hwired(struct pcmcia_device *link)
477static int try_io_port(struct pcmcia_device *link) 477static int try_io_port(struct pcmcia_device *link)
478{ 478{
479 int j, ret; 479 int j, ret;
480 if (link->io.NumPorts1 == 32) { 480 link->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
481 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 481 link->resource[1]->flags &= ~IO_DATA_PATH_WIDTH;
482 if (link->io.NumPorts2 > 0) { 482 if (link->resource[0]->end == 32) {
483 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
484 if (link->resource[1]->end > 0) {
483 /* for master/slave multifunction cards */ 485 /* for master/slave multifunction cards */
484 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 486 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
485 } 487 }
486 } else { 488 } else {
487 /* This should be two 16-port windows */ 489 /* This should be two 16-port windows */
488 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 490 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
489 link->io.Attributes2 = IO_DATA_PATH_WIDTH_16; 491 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_16;
490 } 492 }
491 if (link->io.BasePort1 == 0) { 493 if (link->resource[0]->start == 0) {
492 link->io.IOAddrLines = 16;
493 for (j = 0; j < 0x400; j += 0x20) { 494 for (j = 0; j < 0x400; j += 0x20) {
494 link->io.BasePort1 = j ^ 0x300; 495 link->resource[0]->start = j ^ 0x300;
495 link->io.BasePort2 = (j ^ 0x300) + 0x10; 496 link->resource[1]->start = (j ^ 0x300) + 0x10;
496 ret = pcmcia_request_io(link, &link->io); 497 link->io_lines = 16;
498 ret = pcmcia_request_io(link);
497 if (ret == 0) 499 if (ret == 0)
498 return ret; 500 return ret;
499 } 501 }
500 return ret; 502 return ret;
501 } else { 503 } else {
502 return pcmcia_request_io(link, &link->io); 504 return pcmcia_request_io(link);
503 } 505 }
504} 506}
505 507
@@ -520,18 +522,18 @@ static int pcnet_confcheck(struct pcmcia_device *p_dev,
520 network function with window 0, and serial with window 1 */ 522 network function with window 0, and serial with window 1 */
521 if (io->nwin > 1) { 523 if (io->nwin > 1) {
522 i = (io->win[1].len > io->win[0].len); 524 i = (io->win[1].len > io->win[0].len);
523 p_dev->io.BasePort2 = io->win[1-i].base; 525 p_dev->resource[1]->start = io->win[1-i].base;
524 p_dev->io.NumPorts2 = io->win[1-i].len; 526 p_dev->resource[1]->end = io->win[1-i].len;
525 } else { 527 } else {
526 i = p_dev->io.NumPorts2 = 0; 528 i = p_dev->resource[1]->end = 0;
527 } 529 }
528 530
529 *has_shmem = ((cfg->mem.nwin == 1) && 531 *has_shmem = ((cfg->mem.nwin == 1) &&
530 (cfg->mem.win[0].len >= 0x4000)); 532 (cfg->mem.win[0].len >= 0x4000));
531 p_dev->io.BasePort1 = io->win[i].base; 533 p_dev->resource[0]->start = io->win[i].base;
532 p_dev->io.NumPorts1 = io->win[i].len; 534 p_dev->resource[0]->end = io->win[i].len;
533 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 535 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
534 if (p_dev->io.NumPorts1 + p_dev->io.NumPorts2 >= 32) 536 if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32)
535 return try_io_port(p_dev); 537 return try_io_port(p_dev);
536 538
537 return 0; 539 return 0;