aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/cyclades.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/cyclades.c')
-rw-r--r--drivers/tty/cyclades.c102
1 files changed, 52 insertions, 50 deletions
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index e61cabdd69df..0a6a0bc1b598 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -727,7 +727,7 @@ static void cyy_chip_modem(struct cyclades_card *cinfo, int chip,
727 else 727 else
728 tty_hangup(tty); 728 tty_hangup(tty);
729 } 729 }
730 if ((mdm_change & CyCTS) && (info->port.flags & ASYNC_CTS_FLOW)) { 730 if ((mdm_change & CyCTS) && tty_port_cts_enabled(&info->port)) {
731 if (tty->hw_stopped) { 731 if (tty->hw_stopped) {
732 if (mdm_status & CyCTS) { 732 if (mdm_status & CyCTS) {
733 /* cy_start isn't used 733 /* cy_start isn't used
@@ -1459,7 +1459,7 @@ static void cy_shutdown(struct cyclades_port *info, struct tty_struct *tty)
1459 info->port.xmit_buf = NULL; 1459 info->port.xmit_buf = NULL;
1460 free_page((unsigned long)temp); 1460 free_page((unsigned long)temp);
1461 } 1461 }
1462 if (tty->termios->c_cflag & HUPCL) 1462 if (tty->termios.c_cflag & HUPCL)
1463 cyy_change_rts_dtr(info, 0, TIOCM_RTS | TIOCM_DTR); 1463 cyy_change_rts_dtr(info, 0, TIOCM_RTS | TIOCM_DTR);
1464 1464
1465 cyy_issue_cmd(info, CyCHAN_CTL | CyDIS_RCVR); 1465 cyy_issue_cmd(info, CyCHAN_CTL | CyDIS_RCVR);
@@ -1488,7 +1488,7 @@ static void cy_shutdown(struct cyclades_port *info, struct tty_struct *tty)
1488 free_page((unsigned long)temp); 1488 free_page((unsigned long)temp);
1489 } 1489 }
1490 1490
1491 if (tty->termios->c_cflag & HUPCL) 1491 if (tty->termios.c_cflag & HUPCL)
1492 tty_port_lower_dtr_rts(&info->port); 1492 tty_port_lower_dtr_rts(&info->port);
1493 1493
1494 set_bit(TTY_IO_ERROR, &tty->flags); 1494 set_bit(TTY_IO_ERROR, &tty->flags);
@@ -1599,7 +1599,7 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
1599 * If the port is the middle of closing, bail out now 1599 * If the port is the middle of closing, bail out now
1600 */ 1600 */
1601 if (tty_hung_up_p(filp) || (info->port.flags & ASYNC_CLOSING)) { 1601 if (tty_hung_up_p(filp) || (info->port.flags & ASYNC_CLOSING)) {
1602 wait_event_interruptible_tty(info->port.close_wait, 1602 wait_event_interruptible_tty(tty, info->port.close_wait,
1603 !(info->port.flags & ASYNC_CLOSING)); 1603 !(info->port.flags & ASYNC_CLOSING));
1604 return (info->port.flags & ASYNC_HUP_NOTIFY) ? -EAGAIN: -ERESTARTSYS; 1604 return (info->port.flags & ASYNC_HUP_NOTIFY) ? -EAGAIN: -ERESTARTSYS;
1605 } 1605 }
@@ -1999,14 +1999,11 @@ static void cy_set_line_char(struct cyclades_port *info, struct tty_struct *tty)
1999 int baud, baud_rate = 0; 1999 int baud, baud_rate = 0;
2000 int i; 2000 int i;
2001 2001
2002 if (!tty->termios) /* XXX can this happen at all? */
2003 return;
2004
2005 if (info->line == -1) 2002 if (info->line == -1)
2006 return; 2003 return;
2007 2004
2008 cflag = tty->termios->c_cflag; 2005 cflag = tty->termios.c_cflag;
2009 iflag = tty->termios->c_iflag; 2006 iflag = tty->termios.c_iflag;
2010 2007
2011 /* 2008 /*
2012 * Set up the tty->alt_speed kludge 2009 * Set up the tty->alt_speed kludge
@@ -2825,7 +2822,7 @@ static void cy_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
2825 cy_set_line_char(info, tty); 2822 cy_set_line_char(info, tty);
2826 2823
2827 if ((old_termios->c_cflag & CRTSCTS) && 2824 if ((old_termios->c_cflag & CRTSCTS) &&
2828 !(tty->termios->c_cflag & CRTSCTS)) { 2825 !(tty->termios.c_cflag & CRTSCTS)) {
2829 tty->hw_stopped = 0; 2826 tty->hw_stopped = 0;
2830 cy_start(tty); 2827 cy_start(tty);
2831 } 2828 }
@@ -2837,7 +2834,7 @@ static void cy_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
2837 * or not. Hence, this may change..... 2834 * or not. Hence, this may change.....
2838 */ 2835 */
2839 if (!(old_termios->c_cflag & CLOCAL) && 2836 if (!(old_termios->c_cflag & CLOCAL) &&
2840 (tty->termios->c_cflag & CLOCAL)) 2837 (tty->termios.c_cflag & CLOCAL))
2841 wake_up_interruptible(&info->port.open_wait); 2838 wake_up_interruptible(&info->port.open_wait);
2842#endif 2839#endif
2843} /* cy_set_termios */ 2840} /* cy_set_termios */
@@ -2899,7 +2896,7 @@ static void cy_throttle(struct tty_struct *tty)
2899 info->throttle = 1; 2896 info->throttle = 1;
2900 } 2897 }
2901 2898
2902 if (tty->termios->c_cflag & CRTSCTS) { 2899 if (tty->termios.c_cflag & CRTSCTS) {
2903 if (!cy_is_Z(card)) { 2900 if (!cy_is_Z(card)) {
2904 spin_lock_irqsave(&card->card_lock, flags); 2901 spin_lock_irqsave(&card->card_lock, flags);
2905 cyy_change_rts_dtr(info, 0, TIOCM_RTS); 2902 cyy_change_rts_dtr(info, 0, TIOCM_RTS);
@@ -2938,7 +2935,7 @@ static void cy_unthrottle(struct tty_struct *tty)
2938 cy_send_xchar(tty, START_CHAR(tty)); 2935 cy_send_xchar(tty, START_CHAR(tty));
2939 } 2936 }
2940 2937
2941 if (tty->termios->c_cflag & CRTSCTS) { 2938 if (tty->termios.c_cflag & CRTSCTS) {
2942 card = info->card; 2939 card = info->card;
2943 if (!cy_is_Z(card)) { 2940 if (!cy_is_Z(card)) {
2944 spin_lock_irqsave(&card->card_lock, flags); 2941 spin_lock_irqsave(&card->card_lock, flags);
@@ -3289,9 +3286,10 @@ static unsigned short __devinit cyy_init_card(void __iomem *true_base_addr,
3289static int __init cy_detect_isa(void) 3286static int __init cy_detect_isa(void)
3290{ 3287{
3291#ifdef CONFIG_ISA 3288#ifdef CONFIG_ISA
3289 struct cyclades_card *card;
3292 unsigned short cy_isa_irq, nboard; 3290 unsigned short cy_isa_irq, nboard;
3293 void __iomem *cy_isa_address; 3291 void __iomem *cy_isa_address;
3294 unsigned short i, j, cy_isa_nchan; 3292 unsigned short i, j, k, cy_isa_nchan;
3295 int isparam = 0; 3293 int isparam = 0;
3296 3294
3297 nboard = 0; 3295 nboard = 0;
@@ -3349,7 +3347,8 @@ static int __init cy_detect_isa(void)
3349 } 3347 }
3350 /* fill the next cy_card structure available */ 3348 /* fill the next cy_card structure available */
3351 for (j = 0; j < NR_CARDS; j++) { 3349 for (j = 0; j < NR_CARDS; j++) {
3352 if (cy_card[j].base_addr == NULL) 3350 card = &cy_card[j];
3351 if (card->base_addr == NULL)
3353 break; 3352 break;
3354 } 3353 }
3355 if (j == NR_CARDS) { /* no more cy_cards available */ 3354 if (j == NR_CARDS) { /* no more cy_cards available */
@@ -3363,7 +3362,7 @@ static int __init cy_detect_isa(void)
3363 3362
3364 /* allocate IRQ */ 3363 /* allocate IRQ */
3365 if (request_irq(cy_isa_irq, cyy_interrupt, 3364 if (request_irq(cy_isa_irq, cyy_interrupt,
3366 0, "Cyclom-Y", &cy_card[j])) { 3365 0, "Cyclom-Y", card)) {
3367 printk(KERN_ERR "Cyclom-Y/ISA found at 0x%lx, but " 3366 printk(KERN_ERR "Cyclom-Y/ISA found at 0x%lx, but "
3368 "could not allocate IRQ#%d.\n", 3367 "could not allocate IRQ#%d.\n",
3369 (unsigned long)cy_isa_address, cy_isa_irq); 3368 (unsigned long)cy_isa_address, cy_isa_irq);
@@ -3372,16 +3371,16 @@ static int __init cy_detect_isa(void)
3372 } 3371 }
3373 3372
3374 /* set cy_card */ 3373 /* set cy_card */
3375 cy_card[j].base_addr = cy_isa_address; 3374 card->base_addr = cy_isa_address;
3376 cy_card[j].ctl_addr.p9050 = NULL; 3375 card->ctl_addr.p9050 = NULL;
3377 cy_card[j].irq = (int)cy_isa_irq; 3376 card->irq = (int)cy_isa_irq;
3378 cy_card[j].bus_index = 0; 3377 card->bus_index = 0;
3379 cy_card[j].first_line = cy_next_channel; 3378 card->first_line = cy_next_channel;
3380 cy_card[j].num_chips = cy_isa_nchan / CyPORTS_PER_CHIP; 3379 card->num_chips = cy_isa_nchan / CyPORTS_PER_CHIP;
3381 cy_card[j].nports = cy_isa_nchan; 3380 card->nports = cy_isa_nchan;
3382 if (cy_init_card(&cy_card[j])) { 3381 if (cy_init_card(card)) {
3383 cy_card[j].base_addr = NULL; 3382 card->base_addr = NULL;
3384 free_irq(cy_isa_irq, &cy_card[j]); 3383 free_irq(cy_isa_irq, card);
3385 iounmap(cy_isa_address); 3384 iounmap(cy_isa_address);
3386 continue; 3385 continue;
3387 } 3386 }
@@ -3393,9 +3392,10 @@ static int __init cy_detect_isa(void)
3393 (unsigned long)(cy_isa_address + (CyISA_Ywin - 1)), 3392 (unsigned long)(cy_isa_address + (CyISA_Ywin - 1)),
3394 cy_isa_irq, cy_isa_nchan, cy_next_channel); 3393 cy_isa_irq, cy_isa_nchan, cy_next_channel);
3395 3394
3396 for (j = cy_next_channel; 3395 for (k = 0, j = cy_next_channel;
3397 j < cy_next_channel + cy_isa_nchan; j++) 3396 j < cy_next_channel + cy_isa_nchan; j++, k++)
3398 tty_register_device(cy_serial_driver, j, NULL); 3397 tty_port_register_device(&card->ports[k].port,
3398 cy_serial_driver, j, NULL);
3399 cy_next_channel += cy_isa_nchan; 3399 cy_next_channel += cy_isa_nchan;
3400 } 3400 }
3401 return nboard; 3401 return nboard;
@@ -3695,10 +3695,11 @@ err:
3695static int __devinit cy_pci_probe(struct pci_dev *pdev, 3695static int __devinit cy_pci_probe(struct pci_dev *pdev,
3696 const struct pci_device_id *ent) 3696 const struct pci_device_id *ent)
3697{ 3697{
3698 struct cyclades_card *card;
3698 void __iomem *addr0 = NULL, *addr2 = NULL; 3699 void __iomem *addr0 = NULL, *addr2 = NULL;
3699 char *card_name = NULL; 3700 char *card_name = NULL;
3700 u32 uninitialized_var(mailbox); 3701 u32 uninitialized_var(mailbox);
3701 unsigned int device_id, nchan = 0, card_no, i; 3702 unsigned int device_id, nchan = 0, card_no, i, j;
3702 unsigned char plx_ver; 3703 unsigned char plx_ver;
3703 int retval, irq; 3704 int retval, irq;
3704 3705
@@ -3829,7 +3830,8 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
3829 } 3830 }
3830 /* fill the next cy_card structure available */ 3831 /* fill the next cy_card structure available */
3831 for (card_no = 0; card_no < NR_CARDS; card_no++) { 3832 for (card_no = 0; card_no < NR_CARDS; card_no++) {
3832 if (cy_card[card_no].base_addr == NULL) 3833 card = &cy_card[card_no];
3834 if (card->base_addr == NULL)
3833 break; 3835 break;
3834 } 3836 }
3835 if (card_no == NR_CARDS) { /* no more cy_cards available */ 3837 if (card_no == NR_CARDS) { /* no more cy_cards available */
@@ -3843,27 +3845,26 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
3843 device_id == PCI_DEVICE_ID_CYCLOM_Y_Hi) { 3845 device_id == PCI_DEVICE_ID_CYCLOM_Y_Hi) {
3844 /* allocate IRQ */ 3846 /* allocate IRQ */
3845 retval = request_irq(irq, cyy_interrupt, 3847 retval = request_irq(irq, cyy_interrupt,
3846 IRQF_SHARED, "Cyclom-Y", &cy_card[card_no]); 3848 IRQF_SHARED, "Cyclom-Y", card);
3847 if (retval) { 3849 if (retval) {
3848 dev_err(&pdev->dev, "could not allocate IRQ\n"); 3850 dev_err(&pdev->dev, "could not allocate IRQ\n");
3849 goto err_unmap; 3851 goto err_unmap;
3850 } 3852 }
3851 cy_card[card_no].num_chips = nchan / CyPORTS_PER_CHIP; 3853 card->num_chips = nchan / CyPORTS_PER_CHIP;
3852 } else { 3854 } else {
3853 struct FIRM_ID __iomem *firm_id = addr2 + ID_ADDRESS; 3855 struct FIRM_ID __iomem *firm_id = addr2 + ID_ADDRESS;
3854 struct ZFW_CTRL __iomem *zfw_ctrl; 3856 struct ZFW_CTRL __iomem *zfw_ctrl;
3855 3857
3856 zfw_ctrl = addr2 + (readl(&firm_id->zfwctrl_addr) & 0xfffff); 3858 zfw_ctrl = addr2 + (readl(&firm_id->zfwctrl_addr) & 0xfffff);
3857 3859
3858 cy_card[card_no].hw_ver = mailbox; 3860 card->hw_ver = mailbox;
3859 cy_card[card_no].num_chips = (unsigned int)-1; 3861 card->num_chips = (unsigned int)-1;
3860 cy_card[card_no].board_ctrl = &zfw_ctrl->board_ctrl; 3862 card->board_ctrl = &zfw_ctrl->board_ctrl;
3861#ifdef CONFIG_CYZ_INTR 3863#ifdef CONFIG_CYZ_INTR
3862 /* allocate IRQ only if board has an IRQ */ 3864 /* allocate IRQ only if board has an IRQ */
3863 if (irq != 0 && irq != 255) { 3865 if (irq != 0 && irq != 255) {
3864 retval = request_irq(irq, cyz_interrupt, 3866 retval = request_irq(irq, cyz_interrupt,
3865 IRQF_SHARED, "Cyclades-Z", 3867 IRQF_SHARED, "Cyclades-Z", card);
3866 &cy_card[card_no]);
3867 if (retval) { 3868 if (retval) {
3868 dev_err(&pdev->dev, "could not allocate IRQ\n"); 3869 dev_err(&pdev->dev, "could not allocate IRQ\n");
3869 goto err_unmap; 3870 goto err_unmap;
@@ -3873,17 +3874,17 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
3873 } 3874 }
3874 3875
3875 /* set cy_card */ 3876 /* set cy_card */
3876 cy_card[card_no].base_addr = addr2; 3877 card->base_addr = addr2;
3877 cy_card[card_no].ctl_addr.p9050 = addr0; 3878 card->ctl_addr.p9050 = addr0;
3878 cy_card[card_no].irq = irq; 3879 card->irq = irq;
3879 cy_card[card_no].bus_index = 1; 3880 card->bus_index = 1;
3880 cy_card[card_no].first_line = cy_next_channel; 3881 card->first_line = cy_next_channel;
3881 cy_card[card_no].nports = nchan; 3882 card->nports = nchan;
3882 retval = cy_init_card(&cy_card[card_no]); 3883 retval = cy_init_card(card);
3883 if (retval) 3884 if (retval)
3884 goto err_null; 3885 goto err_null;
3885 3886
3886 pci_set_drvdata(pdev, &cy_card[card_no]); 3887 pci_set_drvdata(pdev, card);
3887 3888
3888 if (device_id == PCI_DEVICE_ID_CYCLOM_Y_Lo || 3889 if (device_id == PCI_DEVICE_ID_CYCLOM_Y_Lo ||
3889 device_id == PCI_DEVICE_ID_CYCLOM_Y_Hi) { 3890 device_id == PCI_DEVICE_ID_CYCLOM_Y_Hi) {
@@ -3909,14 +3910,15 @@ static int __devinit cy_pci_probe(struct pci_dev *pdev,
3909 3910
3910 dev_info(&pdev->dev, "%s/PCI #%d found: %d channels starting from " 3911 dev_info(&pdev->dev, "%s/PCI #%d found: %d channels starting from "
3911 "port %d.\n", card_name, card_no + 1, nchan, cy_next_channel); 3912 "port %d.\n", card_name, card_no + 1, nchan, cy_next_channel);
3912 for (i = cy_next_channel; i < cy_next_channel + nchan; i++) 3913 for (j = 0, i = cy_next_channel; i < cy_next_channel + nchan; i++, j++)
3913 tty_register_device(cy_serial_driver, i, &pdev->dev); 3914 tty_port_register_device(&card->ports[j].port,
3915 cy_serial_driver, i, &pdev->dev);
3914 cy_next_channel += nchan; 3916 cy_next_channel += nchan;
3915 3917
3916 return 0; 3918 return 0;
3917err_null: 3919err_null:
3918 cy_card[card_no].base_addr = NULL; 3920 card->base_addr = NULL;
3919 free_irq(irq, &cy_card[card_no]); 3921 free_irq(irq, card);
3920err_unmap: 3922err_unmap:
3921 iounmap(addr0); 3923 iounmap(addr0);
3922 if (addr2) 3924 if (addr2)