diff options
-rw-r--r-- | drivers/char/cyclades.c | 156 |
1 files changed, 44 insertions, 112 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index 738903d707f7..9088c93895fd 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -718,8 +718,8 @@ static unsigned int cy_isa_addresses[] = { | |||
718 | #define NR_ISA_ADDRS ARRAY_SIZE(cy_isa_addresses) | 718 | #define NR_ISA_ADDRS ARRAY_SIZE(cy_isa_addresses) |
719 | 719 | ||
720 | #ifdef MODULE | 720 | #ifdef MODULE |
721 | static long maddr[NR_CARDS] = { 0, }; | 721 | static long maddr[NR_CARDS]; |
722 | static int irq[NR_CARDS] = { 0, }; | 722 | static int irq[NR_CARDS]; |
723 | 723 | ||
724 | module_param_array(maddr, long, NULL, 0); | 724 | module_param_array(maddr, long, NULL, 0); |
725 | module_param_array(irq, int, NULL, 0); | 725 | module_param_array(irq, int, NULL, 0); |
@@ -4505,6 +4505,8 @@ static void __devinit cy_init_card(struct cyclades_card *cinfo, | |||
4505 | unsigned short chip_number; | 4505 | unsigned short chip_number; |
4506 | int index, port; | 4506 | int index, port; |
4507 | 4507 | ||
4508 | spin_lock_init(&cinfo->card_lock); | ||
4509 | |||
4508 | if (IS_CYC_Z(*cinfo)) { /* Cyclades-Z */ | 4510 | if (IS_CYC_Z(*cinfo)) { /* Cyclades-Z */ |
4509 | mailbox = readl(&((struct RUNTIME_9060 __iomem *) | 4511 | mailbox = readl(&((struct RUNTIME_9060 __iomem *) |
4510 | cinfo->ctl_addr)->mail_box_0); | 4512 | cinfo->ctl_addr)->mail_box_0); |
@@ -4512,104 +4514,47 @@ static void __devinit cy_init_card(struct cyclades_card *cinfo, | |||
4512 | cinfo->intr_enabled = 0; | 4514 | cinfo->intr_enabled = 0; |
4513 | cinfo->nports = 0; /* Will be correctly set later, after | 4515 | cinfo->nports = 0; /* Will be correctly set later, after |
4514 | Z FW is loaded */ | 4516 | Z FW is loaded */ |
4515 | spin_lock_init(&cinfo->card_lock); | 4517 | } else { |
4516 | for (port = cinfo->first_line; | 4518 | index = cinfo->bus_index; |
4517 | port < cinfo->first_line + nports; port++) { | 4519 | nports = cinfo->nports = CyPORTS_PER_CHIP * cinfo->num_chips; |
4518 | info = &cy_port[port]; | 4520 | } |
4519 | info->magic = CYCLADES_MAGIC; | 4521 | |
4522 | for (port = cinfo->first_line; port < cinfo->first_line + nports; | ||
4523 | port++) { | ||
4524 | info = &cy_port[port]; | ||
4525 | memset(info, 0, sizeof(*info)); | ||
4526 | info->magic = CYCLADES_MAGIC; | ||
4527 | info->card = board; | ||
4528 | info->line = port; | ||
4529 | info->flags = STD_COM_FLAGS; | ||
4530 | info->closing_wait = CLOSING_WAIT_DELAY; | ||
4531 | info->close_delay = 5 * HZ / 10; | ||
4532 | |||
4533 | INIT_WORK(&info->tqueue, do_softint); | ||
4534 | init_waitqueue_head(&info->open_wait); | ||
4535 | init_waitqueue_head(&info->close_wait); | ||
4536 | init_waitqueue_head(&info->shutdown_wait); | ||
4537 | init_waitqueue_head(&info->delta_msr_wait); | ||
4538 | |||
4539 | if (IS_CYC_Z(*cinfo)) { | ||
4520 | info->type = PORT_STARTECH; | 4540 | info->type = PORT_STARTECH; |
4521 | info->card = board; | ||
4522 | info->line = port; | ||
4523 | info->chip_rev = 0; | ||
4524 | info->flags = STD_COM_FLAGS; | ||
4525 | info->tty = NULL; | ||
4526 | if (mailbox == ZO_V1) | 4541 | if (mailbox == ZO_V1) |
4527 | info->xmit_fifo_size = CYZ_FIFO_SIZE; | 4542 | info->xmit_fifo_size = CYZ_FIFO_SIZE; |
4528 | else | 4543 | else |
4529 | info->xmit_fifo_size = | 4544 | info->xmit_fifo_size = 4 * CYZ_FIFO_SIZE; |
4530 | 4 * CYZ_FIFO_SIZE; | ||
4531 | info->cor1 = 0; | ||
4532 | info->cor2 = 0; | ||
4533 | info->cor3 = 0; | ||
4534 | info->cor4 = 0; | ||
4535 | info->cor5 = 0; | ||
4536 | info->tbpr = 0; | ||
4537 | info->tco = 0; | ||
4538 | info->rbpr = 0; | ||
4539 | info->rco = 0; | ||
4540 | info->custom_divisor = 0; | ||
4541 | info->close_delay = 5 * HZ / 10; | ||
4542 | info->closing_wait = CLOSING_WAIT_DELAY; | ||
4543 | info->icount.cts = info->icount.dsr = | ||
4544 | info->icount.rng = info->icount.dcd = 0; | ||
4545 | info->icount.rx = info->icount.tx = 0; | ||
4546 | info->icount.frame = info->icount.parity = 0; | ||
4547 | info->icount.overrun = info->icount.brk = 0; | ||
4548 | info->x_char = 0; | ||
4549 | info->event = 0; | ||
4550 | info->count = 0; | ||
4551 | info->blocked_open = 0; | ||
4552 | info->default_threshold = 0; | ||
4553 | info->default_timeout = 0; | ||
4554 | INIT_WORK(&info->tqueue, do_softint); | ||
4555 | init_waitqueue_head(&info->open_wait); | ||
4556 | init_waitqueue_head(&info->close_wait); | ||
4557 | init_waitqueue_head(&info->shutdown_wait); | ||
4558 | init_waitqueue_head(&info->delta_msr_wait); | ||
4559 | /* info->session */ | ||
4560 | /* info->pgrp */ | ||
4561 | info->read_status_mask = 0; | ||
4562 | /* info->timeout */ | ||
4563 | /* Bentson's vars */ | ||
4564 | info->jiffies[0] = 0; | ||
4565 | info->jiffies[1] = 0; | ||
4566 | info->jiffies[2] = 0; | ||
4567 | info->rflush_count = 0; | ||
4568 | #ifdef CONFIG_CYZ_INTR | 4545 | #ifdef CONFIG_CYZ_INTR |
4569 | init_timer(&cyz_rx_full_timer[port]); | 4546 | init_timer(&cyz_rx_full_timer[port]); |
4570 | cyz_rx_full_timer[port].function = NULL; | 4547 | cyz_rx_full_timer[port].function = NULL; |
4571 | #endif | 4548 | #endif |
4572 | } | 4549 | } else { |
4573 | #ifndef CONFIG_CYZ_INTR | ||
4574 | if (!timer_pending(&cyz_timerlist)) { | ||
4575 | mod_timer(&cyz_timerlist, jiffies + 1); | ||
4576 | #ifdef CY_PCI_DEBUG | ||
4577 | printk(KERN_DEBUG "Cyclades-Z polling initialized\n"); | ||
4578 | #endif | ||
4579 | } | ||
4580 | #endif /* CONFIG_CYZ_INTR */ | ||
4581 | |||
4582 | } else { /* Cyclom-Y of some kind */ | ||
4583 | index = cinfo->bus_index; | ||
4584 | spin_lock_init(&cinfo->card_lock); | ||
4585 | cinfo->nports = CyPORTS_PER_CHIP * cinfo->num_chips; | ||
4586 | for (port = cinfo->first_line; | ||
4587 | port < cinfo->first_line + cinfo->nports; port++) { | ||
4588 | info = &cy_port[port]; | ||
4589 | info->magic = CYCLADES_MAGIC; | ||
4590 | info->type = PORT_CIRRUS; | 4550 | info->type = PORT_CIRRUS; |
4591 | info->card = board; | ||
4592 | info->line = port; | ||
4593 | info->flags = STD_COM_FLAGS; | ||
4594 | info->tty = NULL; | ||
4595 | info->xmit_fifo_size = CyMAX_CHAR_FIFO; | 4551 | info->xmit_fifo_size = CyMAX_CHAR_FIFO; |
4596 | info->cor1 = | 4552 | info->cor1 = CyPARITY_NONE | Cy_1_STOP | Cy_8_BITS; |
4597 | CyPARITY_NONE | Cy_1_STOP | Cy_8_BITS; | ||
4598 | info->cor2 = CyETC; | 4553 | info->cor2 = CyETC; |
4599 | info->cor3 = 0x08; /* _very_ small rcv threshold */ | 4554 | info->cor3 = 0x08; /* _very_ small rcv threshold */ |
4600 | info->cor4 = 0; | 4555 | |
4601 | info->cor5 = 0; | ||
4602 | info->custom_divisor = 0; | ||
4603 | info->close_delay = 5 * HZ / 10; | ||
4604 | info->closing_wait = CLOSING_WAIT_DELAY; | ||
4605 | info->icount.cts = info->icount.dsr = | ||
4606 | info->icount.rng = info->icount.dcd = 0; | ||
4607 | info->icount.rx = info->icount.tx = 0; | ||
4608 | info->icount.frame = info->icount.parity = 0; | ||
4609 | info->icount.overrun = info->icount.brk = 0; | ||
4610 | chip_number = (port - cinfo->first_line) / 4; | 4556 | chip_number = (port - cinfo->first_line) / 4; |
4611 | if ((info->chip_rev = | 4557 | if ((info->chip_rev = readb(cinfo->base_addr + |
4612 | readb(cinfo->base_addr + | ||
4613 | (cy_chip_offset[chip_number] << | 4558 | (cy_chip_offset[chip_number] << |
4614 | index) + (CyGFRCR << index))) >= | 4559 | index) + (CyGFRCR << index))) >= |
4615 | CD1400_REV_J) { | 4560 | CD1400_REV_J) { |
@@ -4618,35 +4563,28 @@ static void __devinit cy_init_card(struct cyclades_card *cinfo, | |||
4618 | info->tco = baud_co_60[13]; /* Tx CO */ | 4563 | info->tco = baud_co_60[13]; /* Tx CO */ |
4619 | info->rbpr = baud_bpr_60[13]; /* Rx BPR */ | 4564 | info->rbpr = baud_bpr_60[13]; /* Rx BPR */ |
4620 | info->rco = baud_co_60[13]; /* Rx CO */ | 4565 | info->rco = baud_co_60[13]; /* Rx CO */ |
4621 | info->rflow = 0; | ||
4622 | info->rtsdtr_inv = 1; | 4566 | info->rtsdtr_inv = 1; |
4623 | } else { | 4567 | } else { |
4624 | info->tbpr = baud_bpr_25[13]; /* Tx BPR */ | 4568 | info->tbpr = baud_bpr_25[13]; /* Tx BPR */ |
4625 | info->tco = baud_co_25[13]; /* Tx CO */ | 4569 | info->tco = baud_co_25[13]; /* Tx CO */ |
4626 | info->rbpr = baud_bpr_25[13]; /* Rx BPR */ | 4570 | info->rbpr = baud_bpr_25[13]; /* Rx BPR */ |
4627 | info->rco = baud_co_25[13]; /* Rx CO */ | 4571 | info->rco = baud_co_25[13]; /* Rx CO */ |
4628 | info->rflow = 0; | ||
4629 | info->rtsdtr_inv = 0; | 4572 | info->rtsdtr_inv = 0; |
4630 | } | 4573 | } |
4631 | info->x_char = 0; | 4574 | info->read_status_mask = CyTIMEOUT | CySPECHAR | |
4632 | info->event = 0; | 4575 | CyBREAK | CyPARITY | CyFRAME | CyOVERRUN; |
4633 | info->count = 0; | ||
4634 | info->blocked_open = 0; | ||
4635 | info->default_threshold = 0; | ||
4636 | info->default_timeout = 0; | ||
4637 | INIT_WORK(&info->tqueue, do_softint); | ||
4638 | init_waitqueue_head(&info->open_wait); | ||
4639 | init_waitqueue_head(&info->close_wait); | ||
4640 | init_waitqueue_head(&info->shutdown_wait); | ||
4641 | init_waitqueue_head(&info->delta_msr_wait); | ||
4642 | /* info->session */ | ||
4643 | /* info->pgrp */ | ||
4644 | info->read_status_mask = | ||
4645 | CyTIMEOUT | CySPECHAR | CyBREAK | ||
4646 | | CyPARITY | CyFRAME | CyOVERRUN; | ||
4647 | /* info->timeout */ | ||
4648 | } | 4576 | } |
4577 | |||
4649 | } | 4578 | } |
4579 | |||
4580 | #ifndef CONFIG_CYZ_INTR | ||
4581 | if (IS_CYC_Z(*cinfo) && !timer_pending(&cyz_timerlist)) { | ||
4582 | mod_timer(&cyz_timerlist, jiffies + 1); | ||
4583 | #ifdef CY_PCI_DEBUG | ||
4584 | printk(KERN_DEBUG "Cyclades-Z polling initialized\n"); | ||
4585 | #endif | ||
4586 | } | ||
4587 | #endif | ||
4650 | } | 4588 | } |
4651 | 4589 | ||
4652 | /* initialize chips on Cyclom-Y card -- return number of valid | 4590 | /* initialize chips on Cyclom-Y card -- return number of valid |
@@ -5369,12 +5307,6 @@ static int __init cy_init(void) | |||
5369 | goto err_frtty; | 5307 | goto err_frtty; |
5370 | } | 5308 | } |
5371 | 5309 | ||
5372 | for (i = 0; i < NR_CARDS; i++) { | ||
5373 | /* base_addr=0 indicates board not found */ | ||
5374 | cy_card[i].base_addr = NULL; | ||
5375 | } | ||
5376 | |||
5377 | /* invalidate remaining cy_port structures */ | ||
5378 | for (i = 0; i < NR_PORTS; i++) { | 5310 | for (i = 0; i < NR_PORTS; i++) { |
5379 | cy_port[i].line = -1; | 5311 | cy_port[i].line = -1; |
5380 | cy_port[i].magic = -1; | 5312 | cy_port[i].magic = -1; |