diff options
Diffstat (limited to 'drivers/serial/serial_cs.c')
-rw-r--r-- | drivers/serial/serial_cs.c | 68 |
1 files changed, 33 insertions, 35 deletions
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index ab17c08ddc03..141c69554bd4 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #include <asm/io.h> | 45 | #include <asm/io.h> |
46 | #include <asm/system.h> | 46 | #include <asm/system.h> |
47 | 47 | ||
48 | #include <pcmcia/cs_types.h> | ||
49 | #include <pcmcia/cs.h> | 48 | #include <pcmcia/cs.h> |
50 | #include <pcmcia/cistpl.h> | 49 | #include <pcmcia/cistpl.h> |
51 | #include <pcmcia/ciscode.h> | 50 | #include <pcmcia/ciscode.h> |
@@ -115,16 +114,14 @@ static void quirk_setup_brainboxes_0104(struct pcmcia_device *link, struct uart_ | |||
115 | 114 | ||
116 | static int quirk_post_ibm(struct pcmcia_device *link) | 115 | static int quirk_post_ibm(struct pcmcia_device *link) |
117 | { | 116 | { |
118 | conf_reg_t reg = { 0, CS_READ, 0x800, 0 }; | 117 | u8 val; |
119 | int ret; | 118 | int ret; |
120 | 119 | ||
121 | ret = pcmcia_access_configuration_register(link, ®); | 120 | ret = pcmcia_read_config_byte(link, 0x800, &val); |
122 | if (ret) | 121 | if (ret) |
123 | goto failed; | 122 | goto failed; |
124 | 123 | ||
125 | reg.Action = CS_WRITE; | 124 | ret = pcmcia_write_config_byte(link, 0x800, val | 1); |
126 | reg.Value = reg.Value | 1; | ||
127 | ret = pcmcia_access_configuration_register(link, ®); | ||
128 | if (ret) | 125 | if (ret) |
129 | goto failed; | 126 | goto failed; |
130 | return 0; | 127 | return 0; |
@@ -338,8 +335,8 @@ static int serial_probe(struct pcmcia_device *link) | |||
338 | info->p_dev = link; | 335 | info->p_dev = link; |
339 | link->priv = info; | 336 | link->priv = info; |
340 | 337 | ||
341 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 338 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
342 | link->io.NumPorts1 = 8; | 339 | link->resource[0]->end = 8; |
343 | link->conf.Attributes = CONF_ENABLE_IRQ; | 340 | link->conf.Attributes = CONF_ENABLE_IRQ; |
344 | if (do_sound) { | 341 | if (do_sound) { |
345 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 342 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
@@ -427,12 +424,13 @@ static int simple_config_check(struct pcmcia_device *p_dev, | |||
427 | p_dev->conf.Vpp = | 424 | p_dev->conf.Vpp = |
428 | cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; | 425 | cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; |
429 | 426 | ||
427 | p_dev->io_lines = ((*try & 0x1) == 0) ? | ||
428 | 16 : cf->io.flags & CISTPL_IO_LINES_MASK; | ||
429 | |||
430 | if ((cf->io.nwin > 0) && (cf->io.win[0].len == size_table[(*try >> 1)]) | 430 | if ((cf->io.nwin > 0) && (cf->io.win[0].len == size_table[(*try >> 1)]) |
431 | && (cf->io.win[0].base != 0)) { | 431 | && (cf->io.win[0].base != 0)) { |
432 | p_dev->io.BasePort1 = cf->io.win[0].base; | 432 | p_dev->resource[0]->start = cf->io.win[0].base; |
433 | p_dev->io.IOAddrLines = ((*try & 0x1) == 0) ? | 433 | if (!pcmcia_request_io(p_dev)) |
434 | 16 : cf->io.flags & CISTPL_IO_LINES_MASK; | ||
435 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | ||
436 | return 0; | 434 | return 0; |
437 | } | 435 | } |
438 | return -EINVAL; | 436 | return -EINVAL; |
@@ -449,9 +447,9 @@ static int simple_config_check_notpicky(struct pcmcia_device *p_dev, | |||
449 | 447 | ||
450 | if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { | 448 | if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { |
451 | for (j = 0; j < 5; j++) { | 449 | for (j = 0; j < 5; j++) { |
452 | p_dev->io.BasePort1 = base[j]; | 450 | p_dev->resource[0]->start = base[j]; |
453 | p_dev->io.IOAddrLines = base[j] ? 16 : 3; | 451 | p_dev->io_lines = base[j] ? 16 : 3; |
454 | if (!pcmcia_request_io(p_dev, &p_dev->io)) | 452 | if (!pcmcia_request_io(p_dev)) |
455 | return 0; | 453 | return 0; |
456 | } | 454 | } |
457 | } | 455 | } |
@@ -466,13 +464,13 @@ static int simple_config(struct pcmcia_device *link) | |||
466 | /* If the card is already configured, look up the port and irq */ | 464 | /* If the card is already configured, look up the port and irq */ |
467 | if (link->function_config) { | 465 | if (link->function_config) { |
468 | unsigned int port = 0; | 466 | unsigned int port = 0; |
469 | if ((link->io.BasePort2 != 0) && | 467 | if ((link->resource[1]->end != 0) && |
470 | (link->io.NumPorts2 == 8)) { | 468 | (resource_size(link->resource[1]) == 8)) { |
471 | port = link->io.BasePort2; | 469 | port = link->resource[1]->end; |
472 | info->slave = 1; | 470 | info->slave = 1; |
473 | } else if ((info->manfid == MANFID_OSITECH) && | 471 | } else if ((info->manfid == MANFID_OSITECH) && |
474 | (link->io.NumPorts1 == 0x40)) { | 472 | (resource_size(link->resource[0]) == 0x40)) { |
475 | port = link->io.BasePort1 + 0x28; | 473 | port = link->resource[0]->start + 0x28; |
476 | info->slave = 1; | 474 | info->slave = 1; |
477 | } | 475 | } |
478 | if (info->slave) { | 476 | if (info->slave) { |
@@ -510,7 +508,7 @@ found_port: | |||
510 | i = pcmcia_request_configuration(link, &link->conf); | 508 | i = pcmcia_request_configuration(link, &link->conf); |
511 | if (i != 0) | 509 | if (i != 0) |
512 | return -1; | 510 | return -1; |
513 | return setup_serial(link, info, link->io.BasePort1, link->irq); | 511 | return setup_serial(link, info, link->resource[0]->start, link->irq); |
514 | } | 512 | } |
515 | 513 | ||
516 | static int multi_config_check(struct pcmcia_device *p_dev, | 514 | static int multi_config_check(struct pcmcia_device *p_dev, |
@@ -524,10 +522,10 @@ static int multi_config_check(struct pcmcia_device *p_dev, | |||
524 | /* The quad port cards have bad CIS's, so just look for a | 522 | /* The quad port cards have bad CIS's, so just look for a |
525 | window larger than 8 ports and assume it will be right */ | 523 | window larger than 8 ports and assume it will be right */ |
526 | if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { | 524 | if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { |
527 | p_dev->io.BasePort1 = cf->io.win[0].base; | 525 | p_dev->resource[0]->start = cf->io.win[0].base; |
528 | p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; | 526 | p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; |
529 | if (!pcmcia_request_io(p_dev, &p_dev->io)) { | 527 | if (!pcmcia_request_io(p_dev)) { |
530 | *base2 = p_dev->io.BasePort1 + 8; | 528 | *base2 = p_dev->resource[0]->start + 8; |
531 | return 0; | 529 | return 0; |
532 | } | 530 | } |
533 | } | 531 | } |
@@ -543,11 +541,11 @@ static int multi_config_check_notpicky(struct pcmcia_device *p_dev, | |||
543 | int *base2 = priv_data; | 541 | int *base2 = priv_data; |
544 | 542 | ||
545 | if (cf->io.nwin == 2) { | 543 | if (cf->io.nwin == 2) { |
546 | p_dev->io.BasePort1 = cf->io.win[0].base; | 544 | p_dev->resource[0]->start = cf->io.win[0].base; |
547 | p_dev->io.BasePort2 = cf->io.win[1].base; | 545 | p_dev->resource[1]->start = cf->io.win[1].base; |
548 | p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; | 546 | p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; |
549 | if (!pcmcia_request_io(p_dev, &p_dev->io)) { | 547 | if (!pcmcia_request_io(p_dev)) { |
550 | *base2 = p_dev->io.BasePort2; | 548 | *base2 = p_dev->resource[1]->start; |
551 | return 0; | 549 | return 0; |
552 | } | 550 | } |
553 | } | 551 | } |
@@ -560,10 +558,10 @@ static int multi_config(struct pcmcia_device *link) | |||
560 | int i, base2 = 0; | 558 | int i, base2 = 0; |
561 | 559 | ||
562 | /* First, look for a generic full-sized window */ | 560 | /* First, look for a generic full-sized window */ |
563 | link->io.NumPorts1 = info->multi * 8; | 561 | link->resource[0]->end = info->multi * 8; |
564 | if (pcmcia_loop_config(link, multi_config_check, &base2)) { | 562 | if (pcmcia_loop_config(link, multi_config_check, &base2)) { |
565 | /* If that didn't work, look for two windows */ | 563 | /* If that didn't work, look for two windows */ |
566 | link->io.NumPorts1 = link->io.NumPorts2 = 8; | 564 | link->resource[0]->end = link->resource[1]->end = 8; |
567 | info->multi = 2; | 565 | info->multi = 2; |
568 | if (pcmcia_loop_config(link, multi_config_check_notpicky, | 566 | if (pcmcia_loop_config(link, multi_config_check_notpicky, |
569 | &base2)) { | 567 | &base2)) { |
@@ -599,9 +597,9 @@ static int multi_config(struct pcmcia_device *link) | |||
599 | link->conf.ConfigIndex == 3) { | 597 | link->conf.ConfigIndex == 3) { |
600 | err = setup_serial(link, info, base2, | 598 | err = setup_serial(link, info, base2, |
601 | link->irq); | 599 | link->irq); |
602 | base2 = link->io.BasePort1; | 600 | base2 = link->resource[0]->start;; |
603 | } else { | 601 | } else { |
604 | err = setup_serial(link, info, link->io.BasePort1, | 602 | err = setup_serial(link, info, link->resource[0]->start, |
605 | link->irq); | 603 | link->irq); |
606 | } | 604 | } |
607 | info->c950ctrl = base2; | 605 | info->c950ctrl = base2; |
@@ -616,7 +614,7 @@ static int multi_config(struct pcmcia_device *link) | |||
616 | return 0; | 614 | return 0; |
617 | } | 615 | } |
618 | 616 | ||
619 | setup_serial(link, info, link->io.BasePort1, link->irq); | 617 | setup_serial(link, info, link->resource[0]->start, link->irq); |
620 | for (i = 0; i < info->multi - 1; i++) | 618 | for (i = 0; i < info->multi - 1; i++) |
621 | setup_serial(link, info, base2 + (8 * i), | 619 | setup_serial(link, info, base2 + (8 * i), |
622 | link->irq); | 620 | link->irq); |