Lines Matching refs:portp
510 static int stl_portinfo(stlport_t *portp, int portnr, char *pos);
515 static void stl_getserial(stlport_t *portp, struct serial_struct *sp);
516 static int stl_setserial(stlport_t *portp, struct serial_struct *sp);
518 static int stl_getportstats(stlport_t *portp, comstats_t *cp);
519 static int stl_clrportstats(stlport_t *portp, comstats_t *cp);
522 static int stl_waitcarrier(stlport_t *portp, struct file *filp);
548 static void stl_cd1400setreg(stlport_t *portp, int regnr, int value);
549 static int stl_cd1400getreg(stlport_t *portp, int regnr);
550 static int stl_cd1400updatereg(stlport_t *portp, int regnr, int value);
552 static void stl_cd1400portinit(stlbrd_t *brdp, stlpanel_t *panelp, stlport_t *portp);
553 static void stl_cd1400setport(stlport_t *portp, struct termios *tiosp);
554 static int stl_cd1400getsignals(stlport_t *portp);
555 static void stl_cd1400setsignals(stlport_t *portp, int dtr, int rts);
556 static void stl_cd1400ccrwait(stlport_t *portp);
557 static void stl_cd1400enablerxtx(stlport_t *portp, int rx, int tx);
558 static void stl_cd1400startrxtx(stlport_t *portp, int rx, int tx);
559 static void stl_cd1400disableintrs(stlport_t *portp);
560 static void stl_cd1400sendbreak(stlport_t *portp, int len);
561 static void stl_cd1400flowctrl(stlport_t *portp, int state);
562 static void stl_cd1400sendflow(stlport_t *portp, int state);
563 static void stl_cd1400flush(stlport_t *portp);
564 static int stl_cd1400datastate(stlport_t *portp);
571 static inline int stl_cd1400breakisr(stlport_t *portp, int ioaddr);
576 static void stl_sc26198setreg(stlport_t *portp, int regnr, int value);
577 static int stl_sc26198getreg(stlport_t *portp, int regnr);
578 static int stl_sc26198updatereg(stlport_t *portp, int regnr, int value);
579 static int stl_sc26198getglobreg(stlport_t *portp, int regnr);
581 static void stl_sc26198portinit(stlbrd_t *brdp, stlpanel_t *panelp, stlport_t *portp);
582 static void stl_sc26198setport(stlport_t *portp, struct termios *tiosp);
583 static int stl_sc26198getsignals(stlport_t *portp);
584 static void stl_sc26198setsignals(stlport_t *portp, int dtr, int rts);
585 static void stl_sc26198enablerxtx(stlport_t *portp, int rx, int tx);
586 static void stl_sc26198startrxtx(stlport_t *portp, int rx, int tx);
587 static void stl_sc26198disableintrs(stlport_t *portp);
588 static void stl_sc26198sendbreak(stlport_t *portp, int len);
589 static void stl_sc26198flowctrl(stlport_t *portp, int state);
590 static void stl_sc26198sendflow(stlport_t *portp, int state);
591 static void stl_sc26198flush(stlport_t *portp);
592 static int stl_sc26198datastate(stlport_t *portp);
593 static void stl_sc26198wait(stlport_t *portp);
594 static void stl_sc26198txunflow(stlport_t *portp, struct tty_struct *tty);
598 static void stl_sc26198rxbadch(stlport_t *portp, unsigned char status, char ch);
599 static void stl_sc26198rxbadchars(stlport_t *portp);
609 void (*portinit)(stlbrd_t *brdp, stlpanel_t *panelp, stlport_t *portp);
610 void (*setport)(stlport_t *portp, struct termios *tiosp);
611 int (*getsignals)(stlport_t *portp);
612 void (*setsignals)(stlport_t *portp, int dtr, int rts);
613 void (*enablerxtx)(stlport_t *portp, int rx, int tx);
614 void (*startrxtx)(stlport_t *portp, int rx, int tx);
615 void (*disableintrs)(stlport_t *portp);
616 void (*sendbreak)(stlport_t *portp, int len);
617 void (*flowctrl)(stlport_t *portp, int state);
618 void (*sendflow)(stlport_t *portp, int state);
619 void (*flush)(stlport_t *portp);
620 int (*datastate)(stlport_t *portp);
628 #define stl_portinit (* ((uart_t *) portp->uartp)->portinit)
629 #define stl_setport (* ((uart_t *) portp->uartp)->setport)
630 #define stl_getsignals (* ((uart_t *) portp->uartp)->getsignals)
631 #define stl_setsignals (* ((uart_t *) portp->uartp)->setsignals)
632 #define stl_enablerxtx (* ((uart_t *) portp->uartp)->enablerxtx)
633 #define stl_startrxtx (* ((uart_t *) portp->uartp)->startrxtx)
634 #define stl_disableintrs (* ((uart_t *) portp->uartp)->disableintrs)
635 #define stl_sendbreak (* ((uart_t *) portp->uartp)->sendbreak)
636 #define stl_flowctrl (* ((uart_t *) portp->uartp)->flowctrl)
637 #define stl_sendflow (* ((uart_t *) portp->uartp)->sendflow)
638 #define stl_flush (* ((uart_t *) portp->uartp)->flush)
639 #define stl_datastate (* ((uart_t *) portp->uartp)->datastate)
775 stlport_t *portp; in cleanup_module() local
819 portp = panelp->ports[k]; in cleanup_module()
820 if (portp == (stlport_t *) NULL) in cleanup_module()
822 if (portp->tty != (struct tty_struct *) NULL) in cleanup_module()
823 stl_hangup(portp->tty); in cleanup_module()
824 if (portp->tx.buf != (char *) NULL) in cleanup_module()
825 kfree(portp->tx.buf); in cleanup_module()
826 kfree(portp); in cleanup_module()
999 stlport_t *portp; in stl_open() local
1029 portp = brdp->panels[panelnr]->ports[portnr]; in stl_open()
1030 if (portp == (stlport_t *) NULL) in stl_open()
1039 portp->tty = tty; in stl_open()
1040 tty->driver_data = portp; in stl_open()
1041 portp->refcount++; in stl_open()
1043 if ((portp->flags & ASYNC_INITIALIZED) == 0) { in stl_open()
1044 if (portp->tx.buf == (char *) NULL) { in stl_open()
1045 portp->tx.buf = (char *) stl_memalloc(STL_TXBUFSIZE); in stl_open()
1046 if (portp->tx.buf == (char *) NULL) in stl_open()
1048 portp->tx.head = portp->tx.buf; in stl_open()
1049 portp->tx.tail = portp->tx.buf; in stl_open()
1051 stl_setport(portp, tty->termios); in stl_open()
1052 portp->sigs = stl_getsignals(portp); in stl_open()
1053 stl_setsignals(portp, 1, 1); in stl_open()
1054 stl_enablerxtx(portp, 1, 1); in stl_open()
1055 stl_startrxtx(portp, 1, 0); in stl_open()
1057 portp->flags |= ASYNC_INITIALIZED; in stl_open()
1066 if (portp->flags & ASYNC_CLOSING) { in stl_open()
1067 interruptible_sleep_on(&portp->close_wait); in stl_open()
1068 if (portp->flags & ASYNC_HUP_NOTIFY) in stl_open()
1079 if (portp->flags & ASYNC_NORMAL_ACTIVE) in stl_open()
1081 if (portp->flags & ASYNC_CALLOUT_ACTIVE) { in stl_open()
1082 if ((portp->flags & ASYNC_SESSION_LOCKOUT) && in stl_open()
1083 (portp->session != current->session)) in stl_open()
1085 if ((portp->flags & ASYNC_PGRP_LOCKOUT) && in stl_open()
1086 (portp->pgrp != current->pgrp)) in stl_open()
1089 portp->flags |= ASYNC_CALLOUT_ACTIVE; in stl_open()
1092 if (portp->flags & ASYNC_CALLOUT_ACTIVE) in stl_open()
1095 if ((rc = stl_waitcarrier(portp, filp)) != 0) in stl_open()
1098 portp->flags |= ASYNC_NORMAL_ACTIVE; in stl_open()
1101 if ((portp->refcount == 1) && (portp->flags & ASYNC_SPLIT_TERMIOS)) { in stl_open()
1103 *tty->termios = portp->normaltermios; in stl_open()
1105 *tty->termios = portp->callouttermios; in stl_open()
1106 stl_setport(portp, tty->termios); in stl_open()
1109 portp->session = current->session; in stl_open()
1110 portp->pgrp = current->pgrp; in stl_open()
1121 static int stl_waitcarrier(stlport_t *portp, struct file *filp) in stl_waitcarrier() argument
1127 printk("stl_waitcarrier(portp=%x,filp=%x)\n", (int) portp, (int) filp); in stl_waitcarrier()
1133 if (portp->flags & ASYNC_CALLOUT_ACTIVE) { in stl_waitcarrier()
1134 if (portp->normaltermios.c_cflag & CLOCAL) in stl_waitcarrier()
1137 if (portp->tty->termios->c_cflag & CLOCAL) in stl_waitcarrier()
1143 portp->openwaitcnt++; in stl_waitcarrier()
1145 portp->refcount--; in stl_waitcarrier()
1148 if ((portp->flags & ASYNC_CALLOUT_ACTIVE) == 0) in stl_waitcarrier()
1149 stl_setsignals(portp, 1, 1); in stl_waitcarrier()
1151 ((portp->flags & ASYNC_INITIALIZED) == 0)) { in stl_waitcarrier()
1152 if (portp->flags & ASYNC_HUP_NOTIFY) in stl_waitcarrier()
1158 if (((portp->flags & ASYNC_CALLOUT_ACTIVE) == 0) && in stl_waitcarrier()
1159 ((portp->flags & ASYNC_CLOSING) == 0) && in stl_waitcarrier()
1160 (doclocal || (portp->sigs & TIOCM_CD))) { in stl_waitcarrier()
1167 interruptible_sleep_on(&portp->open_wait); in stl_waitcarrier()
1171 portp->refcount++; in stl_waitcarrier()
1172 portp->openwaitcnt--; in stl_waitcarrier()
1182 stlport_t *portp; in stl_close() local
1189 portp = tty->driver_data; in stl_close()
1190 if (portp == (stlport_t *) NULL) in stl_close()
1200 if ((tty->count == 1) && (portp->refcount != 1)) in stl_close()
1201 portp->refcount = 1; in stl_close()
1202 if (portp->refcount-- > 1) { in stl_close()
1208 portp->refcount = 0; in stl_close()
1209 portp->flags |= ASYNC_CLOSING; in stl_close()
1211 if (portp->flags & ASYNC_NORMAL_ACTIVE) in stl_close()
1212 portp->normaltermios = *tty->termios; in stl_close()
1213 if (portp->flags & ASYNC_CALLOUT_ACTIVE) in stl_close()
1214 portp->callouttermios = *tty->termios; in stl_close()
1223 if (portp->closing_wait != ASYNC_CLOSING_WAIT_NONE) in stl_close()
1224 tty_wait_until_sent(tty, portp->closing_wait); in stl_close()
1227 portp->flags &= ~ASYNC_INITIALIZED; in stl_close()
1228 stl_disableintrs(portp); in stl_close()
1230 stl_setsignals(portp, 0, 0); in stl_close()
1231 stl_enablerxtx(portp, 0, 0); in stl_close()
1233 portp->istate = 0; in stl_close()
1234 if (portp->tx.buf != (char *) NULL) { in stl_close()
1235 kfree(portp->tx.buf); in stl_close()
1236 portp->tx.buf = (char *) NULL; in stl_close()
1237 portp->tx.head = (char *) NULL; in stl_close()
1238 portp->tx.tail = (char *) NULL; in stl_close()
1244 portp->tty = (struct tty_struct *) NULL; in stl_close()
1246 if (portp->openwaitcnt) { in stl_close()
1247 if (portp->close_delay) in stl_close()
1248 stl_delay(portp->close_delay); in stl_close()
1249 wake_up_interruptible(&portp->open_wait); in stl_close()
1252 portp->flags &= ~(ASYNC_CALLOUT_ACTIVE | ASYNC_NORMAL_ACTIVE | in stl_close()
1254 wake_up_interruptible(&portp->close_wait); in stl_close()
1288 stlport_t *portp; in stl_write() local
1301 portp = tty->driver_data; in stl_write()
1302 if (portp == (stlport_t *) NULL) in stl_write()
1304 if (portp->tx.buf == (char *) NULL) in stl_write()
1315 head = portp->tx.head; in stl_write()
1316 tail = portp->tx.tail; in stl_write()
1326 head = portp->tx.head; in stl_write()
1327 tail = portp->tx.tail; in stl_write()
1330 stlen = STL_TXBUFSIZE - (head - portp->tx.buf); in stl_write()
1345 if (head >= (portp->tx.buf + STL_TXBUFSIZE)) { in stl_write()
1346 head = portp->tx.buf; in stl_write()
1350 portp->tx.head = head; in stl_write()
1352 clear_bit(ASYI_TXLOW, &portp->istate); in stl_write()
1353 stl_startrxtx(portp, -1, 1); in stl_write()
1365 stlport_t *portp; in stl_putchar() local
1375 portp = tty->driver_data; in stl_putchar()
1376 if (portp == (stlport_t *) NULL) in stl_putchar()
1378 if (portp->tx.buf == (char *) NULL) in stl_putchar()
1381 head = portp->tx.head; in stl_putchar()
1382 tail = portp->tx.tail; in stl_putchar()
1389 if (head >= (portp->tx.buf + STL_TXBUFSIZE)) in stl_putchar()
1390 head = portp->tx.buf; in stl_putchar()
1392 portp->tx.head = head; in stl_putchar()
1405 stlport_t *portp; in stl_flushchars() local
1413 portp = tty->driver_data; in stl_flushchars()
1414 if (portp == (stlport_t *) NULL) in stl_flushchars()
1416 if (portp->tx.buf == (char *) NULL) in stl_flushchars()
1421 (portp->tx.head == portp->tx.tail)) in stl_flushchars()
1424 stl_startrxtx(portp, -1, 1); in stl_flushchars()
1431 stlport_t *portp; in stl_writeroom() local
1440 portp = tty->driver_data; in stl_writeroom()
1441 if (portp == (stlport_t *) NULL) in stl_writeroom()
1443 if (portp->tx.buf == (char *) NULL) in stl_writeroom()
1446 head = portp->tx.head; in stl_writeroom()
1447 tail = portp->tx.tail; in stl_writeroom()
1464 stlport_t *portp; in stl_charsinbuffer() local
1474 portp = tty->driver_data; in stl_charsinbuffer()
1475 if (portp == (stlport_t *) NULL) in stl_charsinbuffer()
1477 if (portp->tx.buf == (char *) NULL) in stl_charsinbuffer()
1480 head = portp->tx.head; in stl_charsinbuffer()
1481 tail = portp->tx.tail; in stl_charsinbuffer()
1483 if ((size == 0) && test_bit(ASYI_TXBUSY, &portp->istate)) in stl_charsinbuffer()
1494 static void stl_getserial(stlport_t *portp, struct serial_struct *sp) in stl_getserial() argument
1500 printk("stl_getserial(portp=%x,sp=%x)\n", (int) portp, (int) sp); in stl_getserial()
1504 sio.line = portp->portnr; in stl_getserial()
1505 sio.port = portp->ioaddr; in stl_getserial()
1506 sio.flags = portp->flags; in stl_getserial()
1507 sio.baud_base = portp->baud_base; in stl_getserial()
1508 sio.close_delay = portp->close_delay; in stl_getserial()
1509 sio.closing_wait = portp->closing_wait; in stl_getserial()
1510 sio.custom_divisor = portp->custom_divisor; in stl_getserial()
1512 if (portp->uartp == &stl_cd1400uart) { in stl_getserial()
1520 brdp = stl_brds[portp->brdnr]; in stl_getserial()
1535 static int stl_setserial(stlport_t *portp, struct serial_struct *sp) in stl_setserial() argument
1540 printk("stl_setserial(portp=%x,sp=%x)\n", (int) portp, (int) sp); in stl_setserial()
1546 if ((sio.baud_base != portp->baud_base) || in stl_setserial()
1547 (sio.close_delay != portp->close_delay) || in stl_setserial()
1549 (portp->flags & ~ASYNC_USR_MASK))) in stl_setserial()
1553 portp->flags = (portp->flags & ~ASYNC_USR_MASK) | in stl_setserial()
1555 portp->baud_base = sio.baud_base; in stl_setserial()
1556 portp->close_delay = sio.close_delay; in stl_setserial()
1557 portp->closing_wait = sio.closing_wait; in stl_setserial()
1558 portp->custom_divisor = sio.custom_divisor; in stl_setserial()
1559 stl_setport(portp, portp->tty->termios); in stl_setserial()
1567 stlport_t *portp; in stl_ioctl() local
1578 portp = tty->driver_data; in stl_ioctl()
1579 if (portp == (stlport_t *) NULL) in stl_ioctl()
1607 ival = stl_getsignals(portp); in stl_ioctl()
1615 stl_setsignals(portp, ((ival & TIOCM_DTR) ? 1 : -1), in stl_ioctl()
1623 stl_setsignals(portp, ((ival & TIOCM_DTR) ? 0 : -1), in stl_ioctl()
1631 stl_setsignals(portp, ((ival & TIOCM_DTR) ? 1 : 0), in stl_ioctl()
1638 stl_getserial(portp, (struct serial_struct *) arg); in stl_ioctl()
1643 rc = stl_setserial(portp, (struct serial_struct *) arg); in stl_ioctl()
1648 rc = stl_getportstats(portp, (comstats_t *) arg); in stl_ioctl()
1653 rc = stl_clrportstats(portp, (comstats_t *) arg); in stl_ioctl()
1674 stlport_t *portp; in stl_settermios() local
1683 portp = tty->driver_data; in stl_settermios()
1684 if (portp == (stlport_t *) NULL) in stl_settermios()
1692 stl_setport(portp, tiosp); in stl_settermios()
1693 stl_setsignals(portp, ((tiosp->c_cflag & (CBAUD & ~CBAUDEX)) ? 1 : 0), in stl_settermios()
1700 wake_up_interruptible(&portp->open_wait); in stl_settermios()
1712 stlport_t *portp; in stl_throttle() local
1720 portp = tty->driver_data; in stl_throttle()
1721 if (portp == (stlport_t *) NULL) in stl_throttle()
1723 stl_flowctrl(portp, 0); in stl_throttle()
1734 stlport_t *portp; in stl_unthrottle() local
1742 portp = tty->driver_data; in stl_unthrottle()
1743 if (portp == (stlport_t *) NULL) in stl_unthrottle()
1745 stl_flowctrl(portp, 1); in stl_unthrottle()
1757 stlport_t *portp; in stl_stop() local
1765 portp = tty->driver_data; in stl_stop()
1766 if (portp == (stlport_t *) NULL) in stl_stop()
1768 stl_startrxtx(portp, -1, 0); in stl_stop()
1779 stlport_t *portp; in stl_start() local
1787 portp = tty->driver_data; in stl_start()
1788 if (portp == (stlport_t *) NULL) in stl_start()
1790 stl_startrxtx(portp, -1, 1); in stl_start()
1803 stlport_t *portp; in stl_hangup() local
1811 portp = tty->driver_data; in stl_hangup()
1812 if (portp == (stlport_t *) NULL) in stl_hangup()
1815 portp->flags &= ~ASYNC_INITIALIZED; in stl_hangup()
1816 stl_disableintrs(portp); in stl_hangup()
1818 stl_setsignals(portp, 0, 0); in stl_hangup()
1819 stl_enablerxtx(portp, 0, 0); in stl_hangup()
1821 portp->istate = 0; in stl_hangup()
1823 if (portp->tx.buf != (char *) NULL) { in stl_hangup()
1824 kfree(portp->tx.buf); in stl_hangup()
1825 portp->tx.buf = (char *) NULL; in stl_hangup()
1826 portp->tx.head = (char *) NULL; in stl_hangup()
1827 portp->tx.tail = (char *) NULL; in stl_hangup()
1829 portp->tty = (struct tty_struct *) NULL; in stl_hangup()
1830 portp->flags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_CALLOUT_ACTIVE); in stl_hangup()
1831 portp->refcount = 0; in stl_hangup()
1832 wake_up_interruptible(&portp->open_wait); in stl_hangup()
1839 stlport_t *portp; in stl_flushbuffer() local
1847 portp = tty->driver_data; in stl_flushbuffer()
1848 if (portp == (stlport_t *) NULL) in stl_flushbuffer()
1851 stl_flush(portp); in stl_flushbuffer()
1859 stlport_t *portp; in stl_breakctl() local
1867 portp = tty->driver_data; in stl_breakctl()
1868 if (portp == (stlport_t *) NULL) in stl_breakctl()
1871 stl_sendbreak(portp, ((state == -1) ? 1 : 2)); in stl_breakctl()
1878 stlport_t *portp; in stl_waituntilsent() local
1887 portp = tty->driver_data; in stl_waituntilsent()
1888 if (portp == (stlport_t *) NULL) in stl_waituntilsent()
1895 while (stl_datastate(portp)) { in stl_waituntilsent()
1908 stlport_t *portp; in stl_sendxchar() local
1916 portp = tty->driver_data; in stl_sendxchar()
1917 if (portp == (stlport_t *) NULL) in stl_sendxchar()
1921 stl_sendflow(portp, 0); in stl_sendxchar()
1923 stl_sendflow(portp, 1); in stl_sendxchar()
1938 static int stl_portinfo(stlport_t *portp, int portnr, char *pos) in stl_portinfo() argument
1945 portnr, (portp->hwid == 1) ? "SC26198" : "CD1400", in stl_portinfo()
1946 (int) portp->stats.txtotal, (int) portp->stats.rxtotal); in stl_portinfo()
1948 if (portp->stats.rxframing) in stl_portinfo()
1949 sp += sprintf(sp, " fe:%d", (int) portp->stats.rxframing); in stl_portinfo()
1950 if (portp->stats.rxparity) in stl_portinfo()
1951 sp += sprintf(sp, " pe:%d", (int) portp->stats.rxparity); in stl_portinfo()
1952 if (portp->stats.rxbreaks) in stl_portinfo()
1953 sp += sprintf(sp, " brk:%d", (int) portp->stats.rxbreaks); in stl_portinfo()
1954 if (portp->stats.rxoverrun) in stl_portinfo()
1955 sp += sprintf(sp, " oe:%d", (int) portp->stats.rxoverrun); in stl_portinfo()
1957 sigs = stl_getsignals(portp); in stl_portinfo()
1986 stlport_t *portp; in stl_readproc() local
2042 portp = panelp->ports[portnr]; in stl_readproc()
2043 if (portp == (stlport_t *) NULL) in stl_readproc()
2049 pos += stl_portinfo(portp, totalport, pos); in stl_readproc()
2204 stlport_t *portp; in stl_offintr() local
2208 portp = private; in stl_offintr()
2211 printk("stl_offintr(portp=%x)\n", (int) portp); in stl_offintr()
2214 if (portp == (stlport_t *) NULL) in stl_offintr()
2217 tty = portp->tty; in stl_offintr()
2222 if (test_bit(ASYI_TXLOW, &portp->istate)) { in stl_offintr()
2225 if (test_bit(ASYI_DCDCHANGE, &portp->istate)) { in stl_offintr()
2226 clear_bit(ASYI_DCDCHANGE, &portp->istate); in stl_offintr()
2227 oldsigs = portp->sigs; in stl_offintr()
2228 portp->sigs = stl_getsignals(portp); in stl_offintr()
2229 if ((portp->sigs & TIOCM_CD) && ((oldsigs & TIOCM_CD) == 0)) in stl_offintr()
2230 wake_up_interruptible(&portp->open_wait); in stl_offintr()
2231 if ((oldsigs & TIOCM_CD) && ((portp->sigs & TIOCM_CD) == 0)) { in stl_offintr()
2232 if (portp->flags & ASYNC_CHECK_CD) { in stl_offintr()
2233 if (! ((portp->flags & ASYNC_CALLOUT_ACTIVE) && in stl_offintr()
2234 (portp->flags & ASYNC_CALLOUT_NOHUP))) { in stl_offintr()
2253 stlport_t *portp; in stl_initports() local
2267 portp = (stlport_t *) stl_memalloc(sizeof(stlport_t)); in stl_initports()
2268 if (portp == (stlport_t *) NULL) { in stl_initports()
2273 memset(portp, 0, sizeof(stlport_t)); in stl_initports()
2275 portp->magic = STL_PORTMAGIC; in stl_initports()
2276 portp->portnr = i; in stl_initports()
2277 portp->brdnr = panelp->brdnr; in stl_initports()
2278 portp->panelnr = panelp->panelnr; in stl_initports()
2279 portp->uartp = panelp->uartp; in stl_initports()
2280 portp->clk = brdp->clk; in stl_initports()
2281 portp->baud_base = STL_BAUDBASE; in stl_initports()
2282 portp->close_delay = STL_CLOSEDELAY; in stl_initports()
2283 portp->closing_wait = 30 * HZ; in stl_initports()
2284 portp->normaltermios = stl_deftermios; in stl_initports()
2285 portp->callouttermios = stl_deftermios; in stl_initports()
2286 portp->tqueue.routine = stl_offintr; in stl_initports()
2287 portp->tqueue.data = portp; in stl_initports()
2288 init_waitqueue_head(&portp->open_wait); in stl_initports()
2289 init_waitqueue_head(&portp->close_wait); in stl_initports()
2290 portp->stats.brd = portp->brdnr; in stl_initports()
2291 portp->stats.panel = portp->panelnr; in stl_initports()
2292 portp->stats.port = portp->portnr; in stl_initports()
2293 panelp->ports[i] = portp; in stl_initports()
2294 stl_portinit(brdp, panelp, portp); in stl_initports()
2956 static int stl_getportstats(stlport_t *portp, comstats_t *cp) in stl_getportstats() argument
2961 if (portp == (stlport_t *) NULL) { in stl_getportstats()
2964 portp = stl_getport(stl_comstats.brd, stl_comstats.panel, in stl_getportstats()
2966 if (portp == (stlport_t *) NULL) in stl_getportstats()
2970 portp->stats.state = portp->istate; in stl_getportstats()
2971 portp->stats.flags = portp->flags; in stl_getportstats()
2972 portp->stats.hwid = portp->hwid; in stl_getportstats()
2974 portp->stats.ttystate = 0; in stl_getportstats()
2975 portp->stats.cflags = 0; in stl_getportstats()
2976 portp->stats.iflags = 0; in stl_getportstats()
2977 portp->stats.oflags = 0; in stl_getportstats()
2978 portp->stats.lflags = 0; in stl_getportstats()
2979 portp->stats.rxbuffered = 0; in stl_getportstats()
2983 if (portp->tty != (struct tty_struct *) NULL) { in stl_getportstats()
2984 if (portp->tty->driver_data == portp) { in stl_getportstats()
2985 portp->stats.ttystate = portp->tty->flags; in stl_getportstats()
2986 portp->stats.rxbuffered = portp->tty->flip.count; in stl_getportstats()
2987 if (portp->tty->termios != (struct termios *) NULL) { in stl_getportstats()
2988 portp->stats.cflags = portp->tty->termios->c_cflag; in stl_getportstats()
2989 portp->stats.iflags = portp->tty->termios->c_iflag; in stl_getportstats()
2990 portp->stats.oflags = portp->tty->termios->c_oflag; in stl_getportstats()
2991 portp->stats.lflags = portp->tty->termios->c_lflag; in stl_getportstats()
2997 head = portp->tx.head; in stl_getportstats()
2998 tail = portp->tx.tail; in stl_getportstats()
2999 portp->stats.txbuffered = ((head >= tail) ? (head - tail) : in stl_getportstats()
3002 portp->stats.signals = (unsigned long) stl_getsignals(portp); in stl_getportstats()
3004 return copy_to_user(cp, &portp->stats, in stl_getportstats()
3014 static int stl_clrportstats(stlport_t *portp, comstats_t *cp) in stl_clrportstats() argument
3016 if (portp == (stlport_t *) NULL) { in stl_clrportstats()
3019 portp = stl_getport(stl_comstats.brd, stl_comstats.panel, in stl_clrportstats()
3021 if (portp == (stlport_t *) NULL) in stl_clrportstats()
3025 memset(&portp->stats, 0, sizeof(comstats_t)); in stl_clrportstats()
3026 portp->stats.brd = portp->brdnr; in stl_clrportstats()
3027 portp->stats.panel = portp->panelnr; in stl_clrportstats()
3028 portp->stats.port = portp->portnr; in stl_clrportstats()
3029 return copy_to_user(cp, &portp->stats, in stl_clrportstats()
3041 stlport_t *portp; in stl_getportstruct() local
3045 portp = stl_getport(stl_dummyport.brdnr, stl_dummyport.panelnr, in stl_getportstruct()
3047 if (portp == (stlport_t *) NULL) in stl_getportstruct()
3049 return copy_to_user((void *)arg, portp, in stl_getportstruct()
3223 static int stl_cd1400getreg(stlport_t *portp, int regnr) in stl_cd1400getreg() argument
3225 outb((regnr + portp->uartaddr), portp->ioaddr); in stl_cd1400getreg()
3226 return(inb(portp->ioaddr + EREG_DATA)); in stl_cd1400getreg()
3229 static void stl_cd1400setreg(stlport_t *portp, int regnr, int value) in stl_cd1400setreg() argument
3231 outb((regnr + portp->uartaddr), portp->ioaddr); in stl_cd1400setreg()
3232 outb(value, portp->ioaddr + EREG_DATA); in stl_cd1400setreg()
3235 static int stl_cd1400updatereg(stlport_t *portp, int regnr, int value) in stl_cd1400updatereg() argument
3237 outb((regnr + portp->uartaddr), portp->ioaddr); in stl_cd1400updatereg()
3238 if (inb(portp->ioaddr + EREG_DATA) != value) { in stl_cd1400updatereg()
3239 outb(value, portp->ioaddr + EREG_DATA); in stl_cd1400updatereg()
3309 static void stl_cd1400portinit(stlbrd_t *brdp, stlpanel_t *panelp, stlport_t *portp) in stl_cd1400portinit() argument
3313 (int) brdp, (int) panelp, (int) portp); in stl_cd1400portinit()
3317 (portp == (stlport_t *) NULL)) in stl_cd1400portinit()
3320 portp->ioaddr = panelp->iobase + (((brdp->brdtype == BRD_ECHPCI) || in stl_cd1400portinit()
3321 (portp->portnr < 8)) ? 0 : EREG_BANKSIZE); in stl_cd1400portinit()
3322 portp->uartaddr = (portp->portnr & 0x04) << 5; in stl_cd1400portinit()
3323 portp->pagenr = panelp->pagenr + (portp->portnr >> 3); in stl_cd1400portinit()
3325 BRDENABLE(portp->brdnr, portp->pagenr); in stl_cd1400portinit()
3326 stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); in stl_cd1400portinit()
3327 stl_cd1400setreg(portp, LIVR, (portp->portnr << 3)); in stl_cd1400portinit()
3328 portp->hwid = stl_cd1400getreg(portp, GFRCR); in stl_cd1400portinit()
3329 BRDDISABLE(portp->brdnr); in stl_cd1400portinit()
3339 static void stl_cd1400ccrwait(stlport_t *portp) in stl_cd1400ccrwait() argument
3344 if (stl_cd1400getreg(portp, CCR) == 0) { in stl_cd1400ccrwait()
3350 portp->portnr, portp->panelnr, portp->brdnr); in stl_cd1400ccrwait()
3360 static void stl_cd1400setport(stlport_t *portp, struct termios *tiosp) in stl_cd1400setport() argument
3385 brdp = stl_brds[portp->brdnr]; in stl_cd1400setport()
3394 portp->rxignoremsk = 0; in stl_cd1400setport()
3396 portp->rxignoremsk |= (ST_PARITY | ST_FRAMING | ST_OVERRUN); in stl_cd1400setport()
3400 portp->rxignoremsk |= ST_BREAK; in stl_cd1400setport()
3404 portp->rxmarkmsk = ST_OVERRUN; in stl_cd1400setport()
3406 portp->rxmarkmsk |= (ST_PARITY | ST_FRAMING); in stl_cd1400setport()
3408 portp->rxmarkmsk |= ST_BREAK; in stl_cd1400setport()
3468 if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) in stl_cd1400setport()
3470 else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) in stl_cd1400setport()
3472 else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) in stl_cd1400setport()
3474 else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) in stl_cd1400setport()
3476 else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) in stl_cd1400setport()
3477 baudrate = (portp->baud_base / portp->custom_divisor); in stl_cd1400setport()
3484 clkdiv = ((portp->clk / stl_cd1400clkdivs[clk]) / baudrate); in stl_cd1400setport()
3498 portp->flags |= ASYNC_CHECK_CD; in stl_cd1400setport()
3500 portp->flags &= ~ASYNC_CHECK_CD; in stl_cd1400setport()
3528 portp->portnr, portp->panelnr, portp->brdnr); in stl_cd1400setport()
3541 BRDENABLE(portp->brdnr, portp->pagenr); in stl_cd1400setport()
3542 stl_cd1400setreg(portp, CAR, (portp->portnr & 0x3)); in stl_cd1400setport()
3543 srer = stl_cd1400getreg(portp, SRER); in stl_cd1400setport()
3544 stl_cd1400setreg(portp, SRER, 0); in stl_cd1400setport()
3545 if (stl_cd1400updatereg(portp, COR1, cor1)) in stl_cd1400setport()
3547 if (stl_cd1400updatereg(portp, COR2, cor2)) in stl_cd1400setport()
3549 if (stl_cd1400updatereg(portp, COR3, cor3)) in stl_cd1400setport()
3552 stl_cd1400ccrwait(portp); in stl_cd1400setport()
3553 stl_cd1400setreg(portp, CCR, CCR_CORCHANGE); in stl_cd1400setport()
3555 stl_cd1400setreg(portp, COR4, cor4); in stl_cd1400setport()
3556 stl_cd1400setreg(portp, COR5, cor5); in stl_cd1400setport()
3557 stl_cd1400setreg(portp, MCOR1, mcor1); in stl_cd1400setport()
3558 stl_cd1400setreg(portp, MCOR2, mcor2); in stl_cd1400setport()
3560 stl_cd1400setreg(portp, TCOR, clk); in stl_cd1400setport()
3561 stl_cd1400setreg(portp, TBPR, div); in stl_cd1400setport()
3562 stl_cd1400setreg(portp, RCOR, clk); in stl_cd1400setport()
3563 stl_cd1400setreg(portp, RBPR, div); in stl_cd1400setport()
3565 stl_cd1400setreg(portp, SCHR1, tiosp->c_cc[VSTART]); in stl_cd1400setport()
3566 stl_cd1400setreg(portp, SCHR2, tiosp->c_cc[VSTOP]); in stl_cd1400setport()
3567 stl_cd1400setreg(portp, SCHR3, tiosp->c_cc[VSTART]); in stl_cd1400setport()
3568 stl_cd1400setreg(portp, SCHR4, tiosp->c_cc[VSTOP]); in stl_cd1400setport()
3569 stl_cd1400setreg(portp, RTPR, rtpr); in stl_cd1400setport()
3570 mcor1 = stl_cd1400getreg(portp, MSVR1); in stl_cd1400setport()
3572 portp->sigs |= TIOCM_CD; in stl_cd1400setport()
3574 portp->sigs &= ~TIOCM_CD; in stl_cd1400setport()
3575 stl_cd1400setreg(portp, SRER, ((srer & ~sreroff) | sreron)); in stl_cd1400setport()
3576 BRDDISABLE(portp->brdnr); in stl_cd1400setport()
3586 static void stl_cd1400setsignals(stlport_t *portp, int dtr, int rts) in stl_cd1400setsignals() argument
3593 (int) portp, dtr, rts); in stl_cd1400setsignals()
3605 BRDENABLE(portp->brdnr, portp->pagenr); in stl_cd1400setsignals()
3606 stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); in stl_cd1400setsignals()
3608 stl_cd1400setreg(portp, MSVR2, msvr2); in stl_cd1400setsignals()
3610 stl_cd1400setreg(portp, MSVR1, msvr1); in stl_cd1400setsignals()
3611 BRDDISABLE(portp->brdnr); in stl_cd1400setsignals()
3621 static int stl_cd1400getsignals(stlport_t *portp) in stl_cd1400getsignals() argument
3628 printk("stl_cd1400getsignals(portp=%x)\n", (int) portp); in stl_cd1400getsignals()
3633 BRDENABLE(portp->brdnr, portp->pagenr); in stl_cd1400getsignals()
3634 stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); in stl_cd1400getsignals()
3635 msvr1 = stl_cd1400getreg(portp, MSVR1); in stl_cd1400getsignals()
3636 msvr2 = stl_cd1400getreg(portp, MSVR2); in stl_cd1400getsignals()
3637 BRDDISABLE(portp->brdnr); in stl_cd1400getsignals()
3660 static void stl_cd1400enablerxtx(stlport_t *portp, int rx, int tx) in stl_cd1400enablerxtx() argument
3667 (int) portp, rx, tx); in stl_cd1400enablerxtx()
3682 BRDENABLE(portp->brdnr, portp->pagenr); in stl_cd1400enablerxtx()
3683 stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); in stl_cd1400enablerxtx()
3684 stl_cd1400ccrwait(portp); in stl_cd1400enablerxtx()
3685 stl_cd1400setreg(portp, CCR, ccr); in stl_cd1400enablerxtx()
3686 stl_cd1400ccrwait(portp); in stl_cd1400enablerxtx()
3687 BRDDISABLE(portp->brdnr); in stl_cd1400enablerxtx()
3697 static void stl_cd1400startrxtx(stlport_t *portp, int rx, int tx) in stl_cd1400startrxtx() argument
3704 (int) portp, rx, tx); in stl_cd1400startrxtx()
3722 BRDENABLE(portp->brdnr, portp->pagenr); in stl_cd1400startrxtx()
3723 stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); in stl_cd1400startrxtx()
3724 stl_cd1400setreg(portp, SRER, in stl_cd1400startrxtx()
3725 ((stl_cd1400getreg(portp, SRER) & ~sreroff) | sreron)); in stl_cd1400startrxtx()
3726 BRDDISABLE(portp->brdnr); in stl_cd1400startrxtx()
3728 set_bit(ASYI_TXBUSY, &portp->istate); in stl_cd1400startrxtx()
3738 static void stl_cd1400disableintrs(stlport_t *portp) in stl_cd1400disableintrs() argument
3743 printk("stl_cd1400disableintrs(portp=%x)\n", (int) portp); in stl_cd1400disableintrs()
3747 BRDENABLE(portp->brdnr, portp->pagenr); in stl_cd1400disableintrs()
3748 stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); in stl_cd1400disableintrs()
3749 stl_cd1400setreg(portp, SRER, 0); in stl_cd1400disableintrs()
3750 BRDDISABLE(portp->brdnr); in stl_cd1400disableintrs()
3756 static void stl_cd1400sendbreak(stlport_t *portp, int len) in stl_cd1400sendbreak() argument
3761 printk("stl_cd1400sendbreak(portp=%x,len=%d)\n", (int) portp, len); in stl_cd1400sendbreak()
3766 BRDENABLE(portp->brdnr, portp->pagenr); in stl_cd1400sendbreak()
3767 stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); in stl_cd1400sendbreak()
3768 stl_cd1400setreg(portp, SRER, in stl_cd1400sendbreak()
3769 ((stl_cd1400getreg(portp, SRER) & ~SRER_TXDATA) | in stl_cd1400sendbreak()
3771 BRDDISABLE(portp->brdnr); in stl_cd1400sendbreak()
3772 portp->brklen = len; in stl_cd1400sendbreak()
3774 portp->stats.txbreaks++; in stl_cd1400sendbreak()
3784 static void stl_cd1400flowctrl(stlport_t *portp, int state) in stl_cd1400flowctrl() argument
3790 printk("stl_cd1400flowctrl(portp=%x,state=%x)\n", (int) portp, state); in stl_cd1400flowctrl()
3793 if (portp == (stlport_t *) NULL) in stl_cd1400flowctrl()
3795 tty = portp->tty; in stl_cd1400flowctrl()
3801 BRDENABLE(portp->brdnr, portp->pagenr); in stl_cd1400flowctrl()
3802 stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); in stl_cd1400flowctrl()
3806 stl_cd1400ccrwait(portp); in stl_cd1400flowctrl()
3807 stl_cd1400setreg(portp, CCR, CCR_SENDSCHR1); in stl_cd1400flowctrl()
3808 portp->stats.rxxon++; in stl_cd1400flowctrl()
3809 stl_cd1400ccrwait(portp); in stl_cd1400flowctrl()
3818 stl_cd1400setreg(portp, MCOR1, in stl_cd1400flowctrl()
3819 (stl_cd1400getreg(portp, MCOR1) | in stl_cd1400flowctrl()
3821 stl_cd1400setreg(portp, MSVR2, MSVR2_RTS); in stl_cd1400flowctrl()
3822 portp->stats.rxrtson++; in stl_cd1400flowctrl()
3826 stl_cd1400ccrwait(portp); in stl_cd1400flowctrl()
3827 stl_cd1400setreg(portp, CCR, CCR_SENDSCHR2); in stl_cd1400flowctrl()
3828 portp->stats.rxxoff++; in stl_cd1400flowctrl()
3829 stl_cd1400ccrwait(portp); in stl_cd1400flowctrl()
3832 stl_cd1400setreg(portp, MCOR1, in stl_cd1400flowctrl()
3833 (stl_cd1400getreg(portp, MCOR1) & 0xf0)); in stl_cd1400flowctrl()
3834 stl_cd1400setreg(portp, MSVR2, 0); in stl_cd1400flowctrl()
3835 portp->stats.rxrtsoff++; in stl_cd1400flowctrl()
3839 BRDDISABLE(portp->brdnr); in stl_cd1400flowctrl()
3849 static void stl_cd1400sendflow(stlport_t *portp, int state) in stl_cd1400sendflow() argument
3855 printk("stl_cd1400sendflow(portp=%x,state=%x)\n", (int) portp, state); in stl_cd1400sendflow()
3858 if (portp == (stlport_t *) NULL) in stl_cd1400sendflow()
3860 tty = portp->tty; in stl_cd1400sendflow()
3866 BRDENABLE(portp->brdnr, portp->pagenr); in stl_cd1400sendflow()
3867 stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); in stl_cd1400sendflow()
3869 stl_cd1400ccrwait(portp); in stl_cd1400sendflow()
3870 stl_cd1400setreg(portp, CCR, CCR_SENDSCHR1); in stl_cd1400sendflow()
3871 portp->stats.rxxon++; in stl_cd1400sendflow()
3872 stl_cd1400ccrwait(portp); in stl_cd1400sendflow()
3874 stl_cd1400ccrwait(portp); in stl_cd1400sendflow()
3875 stl_cd1400setreg(portp, CCR, CCR_SENDSCHR2); in stl_cd1400sendflow()
3876 portp->stats.rxxoff++; in stl_cd1400sendflow()
3877 stl_cd1400ccrwait(portp); in stl_cd1400sendflow()
3879 BRDDISABLE(portp->brdnr); in stl_cd1400sendflow()
3885 static void stl_cd1400flush(stlport_t *portp) in stl_cd1400flush() argument
3890 printk("stl_cd1400flush(portp=%x)\n", (int) portp); in stl_cd1400flush()
3893 if (portp == (stlport_t *) NULL) in stl_cd1400flush()
3898 BRDENABLE(portp->brdnr, portp->pagenr); in stl_cd1400flush()
3899 stl_cd1400setreg(portp, CAR, (portp->portnr & 0x03)); in stl_cd1400flush()
3900 stl_cd1400ccrwait(portp); in stl_cd1400flush()
3901 stl_cd1400setreg(portp, CCR, CCR_TXFLUSHFIFO); in stl_cd1400flush()
3902 stl_cd1400ccrwait(portp); in stl_cd1400flush()
3903 portp->tx.tail = portp->tx.head; in stl_cd1400flush()
3904 BRDDISABLE(portp->brdnr); in stl_cd1400flush()
3917 static int stl_cd1400datastate(stlport_t *portp) in stl_cd1400datastate() argument
3920 printk("stl_cd1400datastate(portp=%x)\n", (int) portp); in stl_cd1400datastate()
3923 if (portp == (stlport_t *) NULL) in stl_cd1400datastate()
3926 return(test_bit(ASYI_TXBUSY, &portp->istate) ? 1 : 0); in stl_cd1400datastate()
3994 static inline int stl_cd1400breakisr(stlport_t *portp, int ioaddr) in stl_cd1400breakisr() argument
3996 if (portp->brklen == 1) { in stl_cd1400breakisr()
3997 outb((COR2 + portp->uartaddr), ioaddr); in stl_cd1400breakisr()
4000 outb((TDR + portp->uartaddr), ioaddr); in stl_cd1400breakisr()
4003 outb((SRER + portp->uartaddr), ioaddr); in stl_cd1400breakisr()
4007 } else if (portp->brklen > 1) { in stl_cd1400breakisr()
4008 outb((TDR + portp->uartaddr), ioaddr); in stl_cd1400breakisr()
4011 portp->brklen = -1; in stl_cd1400breakisr()
4014 outb((COR2 + portp->uartaddr), ioaddr); in stl_cd1400breakisr()
4017 portp->brklen = 0; in stl_cd1400breakisr()
4038 stlport_t *portp; in stl_cd1400txisr() local
4053 portp = panelp->ports[(ioack >> 3)]; in stl_cd1400txisr()
4060 if (portp->brklen != 0) in stl_cd1400txisr()
4061 if (stl_cd1400breakisr(portp, ioaddr)) in stl_cd1400txisr()
4064 head = portp->tx.head; in stl_cd1400txisr()
4065 tail = portp->tx.tail; in stl_cd1400txisr()
4068 (test_bit(ASYI_TXLOW, &portp->istate) == 0))) { in stl_cd1400txisr()
4069 set_bit(ASYI_TXLOW, &portp->istate); in stl_cd1400txisr()
4071 if (schedule_task(&portp->tqueue) == 0) in stl_cd1400txisr()
4076 outb((SRER + portp->uartaddr), ioaddr); in stl_cd1400txisr()
4082 clear_bit(ASYI_TXBUSY, &portp->istate); in stl_cd1400txisr()
4087 portp->stats.txtotal += len; in stl_cd1400txisr()
4088 stlen = MIN(len, ((portp->tx.buf + STL_TXBUFSIZE) - tail)); in stl_cd1400txisr()
4089 outb((TDR + portp->uartaddr), ioaddr); in stl_cd1400txisr()
4093 if (tail >= (portp->tx.buf + STL_TXBUFSIZE)) in stl_cd1400txisr()
4094 tail = portp->tx.buf; in stl_cd1400txisr()
4099 portp->tx.tail = tail; in stl_cd1400txisr()
4103 outb((EOSRR + portp->uartaddr), ioaddr); in stl_cd1400txisr()
4121 stlport_t *portp; in stl_cd1400rxisr() local
4136 portp = panelp->ports[(ioack >> 3)]; in stl_cd1400rxisr()
4137 tty = portp->tty; in stl_cd1400rxisr()
4140 outb((RDCR + portp->uartaddr), ioaddr); in stl_cd1400rxisr()
4146 outb((RDSR + portp->uartaddr), ioaddr); in stl_cd1400rxisr()
4148 portp->stats.rxlost += len; in stl_cd1400rxisr()
4149 portp->stats.rxtotal += len; in stl_cd1400rxisr()
4153 outb((RDSR + portp->uartaddr), ioaddr); in stl_cd1400rxisr()
4160 portp->stats.rxtotal += len; in stl_cd1400rxisr()
4164 outb((RDSR + portp->uartaddr), ioaddr); in stl_cd1400rxisr()
4168 portp->stats.rxparity++; in stl_cd1400rxisr()
4170 portp->stats.rxframing++; in stl_cd1400rxisr()
4172 portp->stats.rxoverrun++; in stl_cd1400rxisr()
4174 portp->stats.rxbreaks++; in stl_cd1400rxisr()
4177 portp->stats.txxon++; in stl_cd1400rxisr()
4179 portp->stats.txxoff++; in stl_cd1400rxisr()
4183 ((portp->rxignoremsk & status) == 0)) { in stl_cd1400rxisr()
4184 if (portp->rxmarkmsk & status) { in stl_cd1400rxisr()
4187 if (portp->flags & ASYNC_SAK) { in stl_cd1400rxisr()
4189 BRDENABLE(portp->brdnr, portp->pagenr); in stl_cd1400rxisr()
4218 outb((EOSRR + portp->uartaddr), ioaddr); in stl_cd1400rxisr()
4232 stlport_t *portp; in stl_cd1400mdmisr() local
4246 portp = panelp->ports[(ioack >> 3)]; in stl_cd1400mdmisr()
4248 outb((MISR + portp->uartaddr), ioaddr); in stl_cd1400mdmisr()
4251 set_bit(ASYI_DCDCHANGE, &portp->istate); in stl_cd1400mdmisr()
4253 if (schedule_task(&portp->tqueue) == 0) in stl_cd1400mdmisr()
4255 portp->stats.modem++; in stl_cd1400mdmisr()
4258 outb((EOSRR + portp->uartaddr), ioaddr); in stl_cd1400mdmisr()
4272 static int stl_sc26198getreg(stlport_t *portp, int regnr) in stl_sc26198getreg() argument
4274 outb((regnr | portp->uartaddr), (portp->ioaddr + XP_ADDR)); in stl_sc26198getreg()
4275 return(inb(portp->ioaddr + XP_DATA)); in stl_sc26198getreg()
4278 static void stl_sc26198setreg(stlport_t *portp, int regnr, int value) in stl_sc26198setreg() argument
4280 outb((regnr | portp->uartaddr), (portp->ioaddr + XP_ADDR)); in stl_sc26198setreg()
4281 outb(value, (portp->ioaddr + XP_DATA)); in stl_sc26198setreg()
4284 static int stl_sc26198updatereg(stlport_t *portp, int regnr, int value) in stl_sc26198updatereg() argument
4286 outb((regnr | portp->uartaddr), (portp->ioaddr + XP_ADDR)); in stl_sc26198updatereg()
4287 if (inb(portp->ioaddr + XP_DATA) != value) { in stl_sc26198updatereg()
4288 outb(value, (portp->ioaddr + XP_DATA)); in stl_sc26198updatereg()
4300 static int stl_sc26198getglobreg(stlport_t *portp, int regnr) in stl_sc26198getglobreg() argument
4302 outb(regnr, (portp->ioaddr + XP_ADDR)); in stl_sc26198getglobreg()
4303 return(inb(portp->ioaddr + XP_DATA)); in stl_sc26198getglobreg()
4307 static void stl_sc26198setglobreg(stlport_t *portp, int regnr, int value)
4309 outb(regnr, (portp->ioaddr + XP_ADDR));
4310 outb(value, (portp->ioaddr + XP_DATA));
4370 static void stl_sc26198portinit(stlbrd_t *brdp, stlpanel_t *panelp, stlport_t *portp) in stl_sc26198portinit() argument
4374 (int) brdp, (int) panelp, (int) portp); in stl_sc26198portinit()
4378 (portp == (stlport_t *) NULL)) in stl_sc26198portinit()
4381 portp->ioaddr = panelp->iobase + ((portp->portnr < 8) ? 0 : 4); in stl_sc26198portinit()
4382 portp->uartaddr = (portp->portnr & 0x07) << 4; in stl_sc26198portinit()
4383 portp->pagenr = panelp->pagenr; in stl_sc26198portinit()
4384 portp->hwid = 0x1; in stl_sc26198portinit()
4386 BRDENABLE(portp->brdnr, portp->pagenr); in stl_sc26198portinit()
4387 stl_sc26198setreg(portp, IOPCR, IOPCR_SETSIGS); in stl_sc26198portinit()
4388 BRDDISABLE(portp->brdnr); in stl_sc26198portinit()
4398 static void stl_sc26198setport(stlport_t *portp, struct termios *tiosp) in stl_sc26198setport() argument
4414 brdp = stl_brds[portp->brdnr]; in stl_sc26198setport()
4422 portp->rxignoremsk = 0; in stl_sc26198setport()
4424 portp->rxignoremsk |= (SR_RXPARITY | SR_RXFRAMING | in stl_sc26198setport()
4427 portp->rxignoremsk |= SR_RXBREAK; in stl_sc26198setport()
4429 portp->rxmarkmsk = SR_RXOVERRUN; in stl_sc26198setport()
4431 portp->rxmarkmsk |= (SR_RXPARITY | SR_RXFRAMING); in stl_sc26198setport()
4433 portp->rxmarkmsk |= SR_RXBREAK; in stl_sc26198setport()
4492 if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI) in stl_sc26198setport()
4494 else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI) in stl_sc26198setport()
4496 else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI) in stl_sc26198setport()
4498 else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) in stl_sc26198setport()
4500 else if ((portp->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) in stl_sc26198setport()
4501 baudrate = (portp->baud_base / portp->custom_divisor); in stl_sc26198setport()
4517 portp->flags &= ~ASYNC_CHECK_CD; in stl_sc26198setport()
4521 portp->flags |= ASYNC_CHECK_CD; in stl_sc26198setport()
4551 portp->portnr, portp->panelnr, portp->brdnr); in stl_sc26198setport()
4561 BRDENABLE(portp->brdnr, portp->pagenr); in stl_sc26198setport()
4562 stl_sc26198setreg(portp, IMR, 0); in stl_sc26198setport()
4563 stl_sc26198updatereg(portp, MR0, mr0); in stl_sc26198setport()
4564 stl_sc26198updatereg(portp, MR1, mr1); in stl_sc26198setport()
4565 stl_sc26198setreg(portp, SCCR, CR_RXERRBLOCK); in stl_sc26198setport()
4566 stl_sc26198updatereg(portp, MR2, mr2); in stl_sc26198setport()
4567 stl_sc26198updatereg(portp, IOPIOR, in stl_sc26198setport()
4568 ((stl_sc26198getreg(portp, IOPIOR) & ~IPR_CHANGEMASK) | iopr)); in stl_sc26198setport()
4571 stl_sc26198setreg(portp, TXCSR, clk); in stl_sc26198setport()
4572 stl_sc26198setreg(portp, RXCSR, clk); in stl_sc26198setport()
4575 stl_sc26198setreg(portp, XONCR, tiosp->c_cc[VSTART]); in stl_sc26198setport()
4576 stl_sc26198setreg(portp, XOFFCR, tiosp->c_cc[VSTOP]); in stl_sc26198setport()
4578 ipr = stl_sc26198getreg(portp, IPR); in stl_sc26198setport()
4580 portp->sigs &= ~TIOCM_CD; in stl_sc26198setport()
4582 portp->sigs |= TIOCM_CD; in stl_sc26198setport()
4584 portp->imr = (portp->imr & ~imroff) | imron; in stl_sc26198setport()
4585 stl_sc26198setreg(portp, IMR, portp->imr); in stl_sc26198setport()
4586 BRDDISABLE(portp->brdnr); in stl_sc26198setport()
4596 static void stl_sc26198setsignals(stlport_t *portp, int dtr, int rts) in stl_sc26198setsignals() argument
4603 (int) portp, dtr, rts); in stl_sc26198setsignals()
4619 BRDENABLE(portp->brdnr, portp->pagenr); in stl_sc26198setsignals()
4620 stl_sc26198setreg(portp, IOPIOR, in stl_sc26198setsignals()
4621 ((stl_sc26198getreg(portp, IOPIOR) & ~iopioroff) | iopioron)); in stl_sc26198setsignals()
4622 BRDDISABLE(portp->brdnr); in stl_sc26198setsignals()
4632 static int stl_sc26198getsignals(stlport_t *portp) in stl_sc26198getsignals() argument
4639 printk("stl_sc26198getsignals(portp=%x)\n", (int) portp); in stl_sc26198getsignals()
4644 BRDENABLE(portp->brdnr, portp->pagenr); in stl_sc26198getsignals()
4645 ipr = stl_sc26198getreg(portp, IPR); in stl_sc26198getsignals()
4646 BRDDISABLE(portp->brdnr); in stl_sc26198getsignals()
4664 static void stl_sc26198enablerxtx(stlport_t *portp, int rx, int tx) in stl_sc26198enablerxtx() argument
4671 (int) portp, rx, tx); in stl_sc26198enablerxtx()
4674 ccr = portp->crenable; in stl_sc26198enablerxtx()
4686 BRDENABLE(portp->brdnr, portp->pagenr); in stl_sc26198enablerxtx()
4687 stl_sc26198setreg(portp, SCCR, ccr); in stl_sc26198enablerxtx()
4688 BRDDISABLE(portp->brdnr); in stl_sc26198enablerxtx()
4689 portp->crenable = ccr; in stl_sc26198enablerxtx()
4699 static void stl_sc26198startrxtx(stlport_t *portp, int rx, int tx) in stl_sc26198startrxtx() argument
4706 (int) portp, rx, tx); in stl_sc26198startrxtx()
4709 imr = portp->imr; in stl_sc26198startrxtx()
4721 BRDENABLE(portp->brdnr, portp->pagenr); in stl_sc26198startrxtx()
4722 stl_sc26198setreg(portp, IMR, imr); in stl_sc26198startrxtx()
4723 BRDDISABLE(portp->brdnr); in stl_sc26198startrxtx()
4724 portp->imr = imr; in stl_sc26198startrxtx()
4726 set_bit(ASYI_TXBUSY, &portp->istate); in stl_sc26198startrxtx()
4736 static void stl_sc26198disableintrs(stlport_t *portp) in stl_sc26198disableintrs() argument
4741 printk("stl_sc26198disableintrs(portp=%x)\n", (int) portp); in stl_sc26198disableintrs()
4746 BRDENABLE(portp->brdnr, portp->pagenr); in stl_sc26198disableintrs()
4747 portp->imr = 0; in stl_sc26198disableintrs()
4748 stl_sc26198setreg(portp, IMR, 0); in stl_sc26198disableintrs()
4749 BRDDISABLE(portp->brdnr); in stl_sc26198disableintrs()
4755 static void stl_sc26198sendbreak(stlport_t *portp, int len) in stl_sc26198sendbreak() argument
4760 printk("stl_sc26198sendbreak(portp=%x,len=%d)\n", (int) portp, len); in stl_sc26198sendbreak()
4765 BRDENABLE(portp->brdnr, portp->pagenr); in stl_sc26198sendbreak()
4767 stl_sc26198setreg(portp, SCCR, CR_TXSTARTBREAK); in stl_sc26198sendbreak()
4768 portp->stats.txbreaks++; in stl_sc26198sendbreak()
4770 stl_sc26198setreg(portp, SCCR, CR_TXSTOPBREAK); in stl_sc26198sendbreak()
4772 BRDDISABLE(portp->brdnr); in stl_sc26198sendbreak()
4782 static void stl_sc26198flowctrl(stlport_t *portp, int state) in stl_sc26198flowctrl() argument
4789 printk("stl_sc26198flowctrl(portp=%x,state=%x)\n", (int) portp, state); in stl_sc26198flowctrl()
4792 if (portp == (stlport_t *) NULL) in stl_sc26198flowctrl()
4794 tty = portp->tty; in stl_sc26198flowctrl()
4800 BRDENABLE(portp->brdnr, portp->pagenr); in stl_sc26198flowctrl()
4804 mr0 = stl_sc26198getreg(portp, MR0); in stl_sc26198flowctrl()
4805 stl_sc26198setreg(portp, MR0, (mr0 & ~MR0_SWFRXTX)); in stl_sc26198flowctrl()
4806 stl_sc26198setreg(portp, SCCR, CR_TXSENDXON); in stl_sc26198flowctrl()
4808 portp->stats.rxxon++; in stl_sc26198flowctrl()
4809 stl_sc26198wait(portp); in stl_sc26198flowctrl()
4810 stl_sc26198setreg(portp, MR0, mr0); in stl_sc26198flowctrl()
4819 stl_sc26198setreg(portp, MR1, in stl_sc26198flowctrl()
4820 (stl_sc26198getreg(portp, MR1) | MR1_AUTORTS)); in stl_sc26198flowctrl()
4821 stl_sc26198setreg(portp, IOPIOR, in stl_sc26198flowctrl()
4822 (stl_sc26198getreg(portp, IOPIOR) | IOPR_RTS)); in stl_sc26198flowctrl()
4823 portp->stats.rxrtson++; in stl_sc26198flowctrl()
4827 mr0 = stl_sc26198getreg(portp, MR0); in stl_sc26198flowctrl()
4828 stl_sc26198setreg(portp, MR0, (mr0 & ~MR0_SWFRXTX)); in stl_sc26198flowctrl()
4829 stl_sc26198setreg(portp, SCCR, CR_TXSENDXOFF); in stl_sc26198flowctrl()
4831 portp->stats.rxxoff++; in stl_sc26198flowctrl()
4832 stl_sc26198wait(portp); in stl_sc26198flowctrl()
4833 stl_sc26198setreg(portp, MR0, mr0); in stl_sc26198flowctrl()
4836 stl_sc26198setreg(portp, MR1, in stl_sc26198flowctrl()
4837 (stl_sc26198getreg(portp, MR1) & ~MR1_AUTORTS)); in stl_sc26198flowctrl()
4838 stl_sc26198setreg(portp, IOPIOR, in stl_sc26198flowctrl()
4839 (stl_sc26198getreg(portp, IOPIOR) & ~IOPR_RTS)); in stl_sc26198flowctrl()
4840 portp->stats.rxrtsoff++; in stl_sc26198flowctrl()
4844 BRDDISABLE(portp->brdnr); in stl_sc26198flowctrl()
4854 static void stl_sc26198sendflow(stlport_t *portp, int state) in stl_sc26198sendflow() argument
4861 printk("stl_sc26198sendflow(portp=%x,state=%x)\n", (int) portp, state); in stl_sc26198sendflow()
4864 if (portp == (stlport_t *) NULL) in stl_sc26198sendflow()
4866 tty = portp->tty; in stl_sc26198sendflow()
4872 BRDENABLE(portp->brdnr, portp->pagenr); in stl_sc26198sendflow()
4874 mr0 = stl_sc26198getreg(portp, MR0); in stl_sc26198sendflow()
4875 stl_sc26198setreg(portp, MR0, (mr0 & ~MR0_SWFRXTX)); in stl_sc26198sendflow()
4876 stl_sc26198setreg(portp, SCCR, CR_TXSENDXON); in stl_sc26198sendflow()
4878 portp->stats.rxxon++; in stl_sc26198sendflow()
4879 stl_sc26198wait(portp); in stl_sc26198sendflow()
4880 stl_sc26198setreg(portp, MR0, mr0); in stl_sc26198sendflow()
4882 mr0 = stl_sc26198getreg(portp, MR0); in stl_sc26198sendflow()
4883 stl_sc26198setreg(portp, MR0, (mr0 & ~MR0_SWFRXTX)); in stl_sc26198sendflow()
4884 stl_sc26198setreg(portp, SCCR, CR_TXSENDXOFF); in stl_sc26198sendflow()
4886 portp->stats.rxxoff++; in stl_sc26198sendflow()
4887 stl_sc26198wait(portp); in stl_sc26198sendflow()
4888 stl_sc26198setreg(portp, MR0, mr0); in stl_sc26198sendflow()
4890 BRDDISABLE(portp->brdnr); in stl_sc26198sendflow()
4896 static void stl_sc26198flush(stlport_t *portp) in stl_sc26198flush() argument
4901 printk("stl_sc26198flush(portp=%x)\n", (int) portp); in stl_sc26198flush()
4904 if (portp == (stlport_t *) NULL) in stl_sc26198flush()
4909 BRDENABLE(portp->brdnr, portp->pagenr); in stl_sc26198flush()
4910 stl_sc26198setreg(portp, SCCR, CR_TXRESET); in stl_sc26198flush()
4911 stl_sc26198setreg(portp, SCCR, portp->crenable); in stl_sc26198flush()
4912 BRDDISABLE(portp->brdnr); in stl_sc26198flush()
4913 portp->tx.tail = portp->tx.head; in stl_sc26198flush()
4927 static int stl_sc26198datastate(stlport_t *portp) in stl_sc26198datastate() argument
4933 printk("stl_sc26198datastate(portp=%x)\n", (int) portp); in stl_sc26198datastate()
4936 if (portp == (stlport_t *) NULL) in stl_sc26198datastate()
4938 if (test_bit(ASYI_TXBUSY, &portp->istate)) in stl_sc26198datastate()
4943 BRDENABLE(portp->brdnr, portp->pagenr); in stl_sc26198datastate()
4944 sr = stl_sc26198getreg(portp, SR); in stl_sc26198datastate()
4945 BRDDISABLE(portp->brdnr); in stl_sc26198datastate()
4958 static void stl_sc26198wait(stlport_t *portp) in stl_sc26198wait() argument
4963 printk("stl_sc26198wait(portp=%x)\n", (int) portp); in stl_sc26198wait()
4966 if (portp == (stlport_t *) NULL) in stl_sc26198wait()
4970 stl_sc26198getglobreg(portp, TSTR); in stl_sc26198wait()
4981 static inline void stl_sc26198txunflow(stlport_t *portp, struct tty_struct *tty) in stl_sc26198txunflow() argument
4985 mr0 = stl_sc26198getreg(portp, MR0); in stl_sc26198txunflow()
4986 stl_sc26198setreg(portp, MR0, (mr0 & ~MR0_SWFRXTX)); in stl_sc26198txunflow()
4987 stl_sc26198setreg(portp, SCCR, CR_HOSTXON); in stl_sc26198txunflow()
4988 stl_sc26198wait(portp); in stl_sc26198txunflow()
4989 stl_sc26198setreg(portp, MR0, mr0); in stl_sc26198txunflow()
4990 clear_bit(ASYI_TXFLOWED, &portp->istate); in stl_sc26198txunflow()
5001 stlport_t *portp; in stl_sc26198intr() local
5011 portp = panelp->ports[(iack & IVR_CHANMASK) + ((iobase & 0x4) << 1)]; in stl_sc26198intr()
5014 stl_sc26198rxisr(portp, iack); in stl_sc26198intr()
5016 stl_sc26198txisr(portp); in stl_sc26198intr()
5018 stl_sc26198otherisr(portp, iack); in stl_sc26198intr()
5033 static void stl_sc26198txisr(stlport_t *portp) in stl_sc26198txisr() argument
5041 printk("stl_sc26198txisr(portp=%x)\n", (int) portp); in stl_sc26198txisr()
5044 ioaddr = portp->ioaddr; in stl_sc26198txisr()
5045 head = portp->tx.head; in stl_sc26198txisr()
5046 tail = portp->tx.tail; in stl_sc26198txisr()
5049 (test_bit(ASYI_TXLOW, &portp->istate) == 0))) { in stl_sc26198txisr()
5050 set_bit(ASYI_TXLOW, &portp->istate); in stl_sc26198txisr()
5052 if (schedule_task(&portp->tqueue) == 0) in stl_sc26198txisr()
5057 outb((MR0 | portp->uartaddr), (ioaddr + XP_ADDR)); in stl_sc26198txisr()
5060 portp->imr &= ~IR_TXRDY; in stl_sc26198txisr()
5061 outb((IMR | portp->uartaddr), (ioaddr + XP_ADDR)); in stl_sc26198txisr()
5062 outb(portp->imr, (ioaddr + XP_DATA)); in stl_sc26198txisr()
5063 clear_bit(ASYI_TXBUSY, &portp->istate); in stl_sc26198txisr()
5070 portp->stats.txtotal += len; in stl_sc26198txisr()
5071 stlen = MIN(len, ((portp->tx.buf + STL_TXBUFSIZE) - tail)); in stl_sc26198txisr()
5076 if (tail >= (portp->tx.buf + STL_TXBUFSIZE)) in stl_sc26198txisr()
5077 tail = portp->tx.buf; in stl_sc26198txisr()
5082 portp->tx.tail = tail; in stl_sc26198txisr()
5098 static void stl_sc26198rxisr(stlport_t *portp, unsigned int iack) in stl_sc26198rxisr() argument
5104 printk("stl_sc26198rxisr(portp=%x,iack=%x)\n", (int) portp, iack); in stl_sc26198rxisr()
5107 tty = portp->tty; in stl_sc26198rxisr()
5108 ioaddr = portp->ioaddr; in stl_sc26198rxisr()
5119 portp->stats.rxlost += len; in stl_sc26198rxisr()
5120 portp->stats.rxtotal += len; in stl_sc26198rxisr()
5131 portp->stats.rxtotal += len; in stl_sc26198rxisr()
5135 stl_sc26198rxbadchars(portp); in stl_sc26198rxisr()
5143 if (test_bit(ASYI_TXFLOWED, &portp->istate)) { in stl_sc26198rxisr()
5147 stl_sc26198txunflow(portp, tty); in stl_sc26198rxisr()
5158 static void inline stl_sc26198rxbadch(stlport_t *portp, unsigned char status, char ch) in stl_sc26198rxbadch() argument
5163 tty = portp->tty; in stl_sc26198rxbadch()
5164 ioaddr = portp->ioaddr; in stl_sc26198rxbadch()
5167 portp->stats.rxparity++; in stl_sc26198rxbadch()
5169 portp->stats.rxframing++; in stl_sc26198rxbadch()
5171 portp->stats.rxoverrun++; in stl_sc26198rxbadch()
5173 portp->stats.rxbreaks++; in stl_sc26198rxbadch()
5176 ((portp->rxignoremsk & status) == 0)) { in stl_sc26198rxbadch()
5177 if (portp->rxmarkmsk & status) { in stl_sc26198rxbadch()
5180 if (portp->flags & ASYNC_SAK) { in stl_sc26198rxbadch()
5182 BRDENABLE(portp->brdnr, portp->pagenr); in stl_sc26198rxbadch()
5207 portp->stats.rxtotal++; in stl_sc26198rxbadch()
5222 static void stl_sc26198rxbadchars(stlport_t *portp) in stl_sc26198rxbadchars() argument
5231 mr1 = stl_sc26198getreg(portp, MR1); in stl_sc26198rxbadchars()
5232 stl_sc26198setreg(portp, MR1, (mr1 & ~MR1_ERRBLOCK)); in stl_sc26198rxbadchars()
5234 while ((status = stl_sc26198getreg(portp, SR)) & SR_RXRDY) { in stl_sc26198rxbadchars()
5235 stl_sc26198setreg(portp, SCCR, CR_CLEARRXERR); in stl_sc26198rxbadchars()
5236 ch = stl_sc26198getreg(portp, RXFIFO); in stl_sc26198rxbadchars()
5237 stl_sc26198rxbadch(portp, status, ch); in stl_sc26198rxbadchars()
5244 stl_sc26198setreg(portp, MR1, mr1); in stl_sc26198rxbadchars()
5255 static void stl_sc26198otherisr(stlport_t *portp, unsigned int iack) in stl_sc26198otherisr() argument
5260 printk("stl_sc26198otherisr(portp=%x,iack=%x)\n", (int) portp, iack); in stl_sc26198otherisr()
5263 cir = stl_sc26198getglobreg(portp, CIR); in stl_sc26198otherisr()
5267 ipr = stl_sc26198getreg(portp, IPR); in stl_sc26198otherisr()
5269 set_bit(ASYI_DCDCHANGE, &portp->istate); in stl_sc26198otherisr()
5271 if (schedule_task(&portp->tqueue) == 0) in stl_sc26198otherisr()
5273 portp->stats.modem++; in stl_sc26198otherisr()
5277 xisr = stl_sc26198getreg(portp, XISR); in stl_sc26198otherisr()
5279 set_bit(ASYI_TXFLOWED, &portp->istate); in stl_sc26198otherisr()
5280 portp->stats.txxoff++; in stl_sc26198otherisr()
5283 clear_bit(ASYI_TXFLOWED, &portp->istate); in stl_sc26198otherisr()
5284 portp->stats.txxon++; in stl_sc26198otherisr()
5288 stl_sc26198setreg(portp, SCCR, CR_BREAKRESET); in stl_sc26198otherisr()
5289 stl_sc26198rxbadchars(portp); in stl_sc26198otherisr()