aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/rocket.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/rocket.c')
-rw-r--r--drivers/tty/rocket.c60
1 files changed, 40 insertions, 20 deletions
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
index e42009a00529..1d270034bfc3 100644
--- a/drivers/tty/rocket.c
+++ b/drivers/tty/rocket.c
@@ -55,7 +55,7 @@
55#undef REV_PCI_ORDER 55#undef REV_PCI_ORDER
56#undef ROCKET_DEBUG_IO 56#undef ROCKET_DEBUG_IO
57 57
58#define POLL_PERIOD HZ/100 /* Polling period .01 seconds (10ms) */ 58#define POLL_PERIOD (HZ/100) /* Polling period .01 seconds (10ms) */
59 59
60/****** Kernel includes ******/ 60/****** Kernel includes ******/
61 61
@@ -315,9 +315,8 @@ static inline int rocket_paranoia_check(struct r_port *info,
315 * that receive data is present on a serial port. Pulls data from FIFO, moves it into the 315 * that receive data is present on a serial port. Pulls data from FIFO, moves it into the
316 * tty layer. 316 * tty layer.
317 */ 317 */
318static void rp_do_receive(struct r_port *info, 318static void rp_do_receive(struct r_port *info, CHANNEL_t *cp,
319 struct tty_struct *tty, 319 unsigned int ChanStatus)
320 CHANNEL_t * cp, unsigned int ChanStatus)
321{ 320{
322 unsigned int CharNStat; 321 unsigned int CharNStat;
323 int ToRecv, wRecv, space; 322 int ToRecv, wRecv, space;
@@ -379,7 +378,8 @@ static void rp_do_receive(struct r_port *info,
379 flag = TTY_OVERRUN; 378 flag = TTY_OVERRUN;
380 else 379 else
381 flag = TTY_NORMAL; 380 flag = TTY_NORMAL;
382 tty_insert_flip_char(tty, CharNStat & 0xff, flag); 381 tty_insert_flip_char(&info->port, CharNStat & 0xff,
382 flag);
383 ToRecv--; 383 ToRecv--;
384 } 384 }
385 385
@@ -399,7 +399,7 @@ static void rp_do_receive(struct r_port *info,
399 * characters at time by doing repeated word IO 399 * characters at time by doing repeated word IO
400 * transfer. 400 * transfer.
401 */ 401 */
402 space = tty_prepare_flip_string(tty, &cbuf, ToRecv); 402 space = tty_prepare_flip_string(&info->port, &cbuf, ToRecv);
403 if (space < ToRecv) { 403 if (space < ToRecv) {
404#ifdef ROCKET_DEBUG_RECEIVE 404#ifdef ROCKET_DEBUG_RECEIVE
405 printk(KERN_INFO "rp_do_receive:insufficient space ToRecv=%d space=%d\n", ToRecv, space); 405 printk(KERN_INFO "rp_do_receive:insufficient space ToRecv=%d space=%d\n", ToRecv, space);
@@ -415,7 +415,7 @@ static void rp_do_receive(struct r_port *info,
415 cbuf[ToRecv - 1] = sInB(sGetTxRxDataIO(cp)); 415 cbuf[ToRecv - 1] = sInB(sGetTxRxDataIO(cp));
416 } 416 }
417 /* Push the data up to the tty layer */ 417 /* Push the data up to the tty layer */
418 tty_flip_buffer_push(tty); 418 tty_flip_buffer_push(&info->port);
419} 419}
420 420
421/* 421/*
@@ -494,7 +494,6 @@ static void rp_do_transmit(struct r_port *info)
494static void rp_handle_port(struct r_port *info) 494static void rp_handle_port(struct r_port *info)
495{ 495{
496 CHANNEL_t *cp; 496 CHANNEL_t *cp;
497 struct tty_struct *tty;
498 unsigned int IntMask, ChanStatus; 497 unsigned int IntMask, ChanStatus;
499 498
500 if (!info) 499 if (!info)
@@ -505,12 +504,7 @@ static void rp_handle_port(struct r_port *info)
505 "info->flags & NOT_INIT\n"); 504 "info->flags & NOT_INIT\n");
506 return; 505 return;
507 } 506 }
508 tty = tty_port_tty_get(&info->port); 507
509 if (!tty) {
510 printk(KERN_WARNING "rp: WARNING: rp_handle_port called with "
511 "tty==NULL\n");
512 return;
513 }
514 cp = &info->channel; 508 cp = &info->channel;
515 509
516 IntMask = sGetChanIntID(cp) & info->intmask; 510 IntMask = sGetChanIntID(cp) & info->intmask;
@@ -519,7 +513,7 @@ static void rp_handle_port(struct r_port *info)
519#endif 513#endif
520 ChanStatus = sGetChanStatus(cp); 514 ChanStatus = sGetChanStatus(cp);
521 if (IntMask & RXF_TRIG) { /* Rx FIFO trigger level */ 515 if (IntMask & RXF_TRIG) { /* Rx FIFO trigger level */
522 rp_do_receive(info, tty, cp, ChanStatus); 516 rp_do_receive(info, cp, ChanStatus);
523 } 517 }
524 if (IntMask & DELTA_CD) { /* CD change */ 518 if (IntMask & DELTA_CD) { /* CD change */
525#if (defined(ROCKET_DEBUG_OPEN) || defined(ROCKET_DEBUG_INTR) || defined(ROCKET_DEBUG_HANGUP)) 519#if (defined(ROCKET_DEBUG_OPEN) || defined(ROCKET_DEBUG_INTR) || defined(ROCKET_DEBUG_HANGUP))
@@ -527,10 +521,15 @@ static void rp_handle_port(struct r_port *info)
527 (ChanStatus & CD_ACT) ? "on" : "off"); 521 (ChanStatus & CD_ACT) ? "on" : "off");
528#endif 522#endif
529 if (!(ChanStatus & CD_ACT) && info->cd_status) { 523 if (!(ChanStatus & CD_ACT) && info->cd_status) {
524 struct tty_struct *tty;
530#ifdef ROCKET_DEBUG_HANGUP 525#ifdef ROCKET_DEBUG_HANGUP
531 printk(KERN_INFO "CD drop, calling hangup.\n"); 526 printk(KERN_INFO "CD drop, calling hangup.\n");
532#endif 527#endif
533 tty_hangup(tty); 528 tty = tty_port_tty_get(&info->port);
529 if (tty) {
530 tty_hangup(tty);
531 tty_kref_put(tty);
532 }
534 } 533 }
535 info->cd_status = (ChanStatus & CD_ACT) ? 1 : 0; 534 info->cd_status = (ChanStatus & CD_ACT) ? 1 : 0;
536 wake_up_interruptible(&info->port.open_wait); 535 wake_up_interruptible(&info->port.open_wait);
@@ -543,7 +542,6 @@ static void rp_handle_port(struct r_port *info)
543 printk(KERN_INFO "DSR change...\n"); 542 printk(KERN_INFO "DSR change...\n");
544 } 543 }
545#endif 544#endif
546 tty_kref_put(tty);
547} 545}
548 546
549/* 547/*
@@ -1758,8 +1756,29 @@ static void rp_flush_buffer(struct tty_struct *tty)
1758 1756
1759#ifdef CONFIG_PCI 1757#ifdef CONFIG_PCI
1760 1758
1761static struct pci_device_id __used rocket_pci_ids[] = { 1759static DEFINE_PCI_DEVICE_TABLE(rocket_pci_ids) = {
1762 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_ANY_ID) }, 1760 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_RP4QUAD) },
1761 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_RP8OCTA) },
1762 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_URP8OCTA) },
1763 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_RP8INTF) },
1764 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_URP8INTF) },
1765 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_RP8J) },
1766 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_RP4J) },
1767 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_RP8SNI) },
1768 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_RP16SNI) },
1769 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_RP16INTF) },
1770 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_URP16INTF) },
1771 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_CRP16INTF) },
1772 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_RP32INTF) },
1773 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_URP32INTF) },
1774 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_RPP4) },
1775 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_RPP8) },
1776 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_RP2_232) },
1777 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_RP2_422) },
1778 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_RP6M) },
1779 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_RP4M) },
1780 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_UPCI_RM3_8PORT) },
1781 { PCI_DEVICE(PCI_VENDOR_ID_RP, PCI_DEVICE_ID_UPCI_RM3_4PORT) },
1763 { } 1782 { }
1764}; 1783};
1765MODULE_DEVICE_TABLE(pci, rocket_pci_ids); 1784MODULE_DEVICE_TABLE(pci, rocket_pci_ids);
@@ -1781,7 +1800,8 @@ static __init int register_PCI(int i, struct pci_dev *dev)
1781 WordIO_t ConfigIO = 0; 1800 WordIO_t ConfigIO = 0;
1782 ByteIO_t UPCIRingInd = 0; 1801 ByteIO_t UPCIRingInd = 0;
1783 1802
1784 if (!dev || pci_enable_device(dev)) 1803 if (!dev || !pci_match_id(rocket_pci_ids, dev) ||
1804 pci_enable_device(dev))
1785 return 0; 1805 return 0;
1786 1806
1787 rcktpt_io_addr[i] = pci_resource_start(dev, 0); 1807 rcktpt_io_addr[i] = pci_resource_start(dev, 0);