Lines Matching refs:port

257 	struct tty_port port;
461 static bool mxser_carrier_raised(struct tty_port *port)
463 struct mxser_port *mp = container_of(port, struct mxser_port, port);
468 static void mxser_dtr_rts(struct tty_port *port, bool active)
470 struct mxser_port *mp = container_of(port, struct mxser_port, port);
573 * the specified baud rate for a serial port.
629 tty_port_set_cts_flow(&info->port, cflag & CRTSCTS);
640 tty_port_set_check_carrier(&info->port, ~cflag & CLOCAL);
687 struct mxser_port *port)
689 u8 msr = inb(port->ioaddr + UART_MSR);
696 port->icount.rng++;
698 port->icount.dsr++;
700 port->icount.dcd++;
702 port->icount.cts++;
703 wake_up_interruptible(&port->port.delta_msr_wait);
705 if (tty_port_check_carrier(&port->port) && (msr & UART_MSR_DDCD)) {
707 wake_up_interruptible(&port->port.open_wait);
710 if (tty_port_cts_enabled(&port->port))
711 mxser_handle_cts(tty, port, msr);
726 static int mxser_activate(struct tty_port *port, struct tty_struct *tty)
728 struct mxser_port *info = container_of(port, struct mxser_port, port);
732 ret = tty_port_alloc_xmit_buf(port);
800 kfifo_reset(&port->xmit_fifo);
803 * and set the speed of the serial port
810 tty_port_free_xmit_buf(port);
829 * This routine will shutdown a serial port
831 static void mxser_shutdown_port(struct tty_port *port)
833 struct mxser_port *info = container_of(port, struct mxser_port, port);
844 wake_up_interruptible(&info->port.delta_msr_wait);
852 /* read data port to reset things */
864 tty_port_free_xmit_buf(port);
868 * This routine is called whenever a serial port is opened. It
869 * enables interrupts for a serial port, linking in its async structure into
875 struct tty_port *tport = tty->port;
876 struct mxser_port *port = container_of(tport, struct mxser_port, port);
878 tty->driver_data = port;
889 kfifo_reset(&info->port.xmit_fifo);
901 tty_port_close(tty->port, tty, filp);
912 written = kfifo_in(&info->port.xmit_fifo, buf, count);
913 is_empty = kfifo_is_empty(&info->port.xmit_fifo);
930 ret = kfifo_put(&info->port.xmit_fifo, ch);
941 if (kfifo_is_empty(&info->port.xmit_fifo) || tty->flow.stopped ||
952 return kfifo_avail(&info->port.xmit_fifo);
959 return kfifo_len(&info->port.xmit_fifo);
971 struct tty_port *port = &info->port;
974 mutex_lock(&port->mutex);
976 close_delay = jiffies_to_msecs(info->port.close_delay) / 10;
977 closing_wait = info->port.closing_wait;
983 ss->port = info->ioaddr;
985 ss->flags = info->port.flags;
990 mutex_unlock(&port->mutex);
998 struct tty_port *port = &info->port;
1007 mutex_lock(&port->mutex);
1010 ss->port != info->ioaddr) {
1011 mutex_unlock(&port->mutex);
1015 old_speed = port->flags & ASYNC_SPD_MASK;
1024 (close_delay != port->close_delay) ||
1025 (closing_wait != port->closing_wait) ||
1026 ((ss->flags & ~ASYNC_USR_MASK) != (port->flags & ~ASYNC_USR_MASK))) {
1027 mutex_unlock(&port->mutex);
1030 port->flags = (port->flags & ~ASYNC_USR_MASK) |
1037 port->flags = ((port->flags & ~ASYNC_FLAGS) |
1039 port->close_delay = close_delay;
1040 port->closing_wait = closing_wait;
1041 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST &&
1046 mutex_unlock(&port->mutex);
1058 if (tty_port_initialized(port)) {
1059 if (old_speed != (port->flags & ASYNC_SPD_MASK)) {
1065 retval = mxser_activate(port, tty);
1067 tty_port_set_initialized(port, true);
1069 mutex_unlock(&port->mutex);
1168 static int mxser_ioctl_op_mode(struct mxser_port *port, int index, bool set,
1175 if (port->board->must_hwid != MOXA_MUST_MU860_HWID)
1185 spin_lock_irq(&port->slock);
1186 val = inb(port->opmode_ioaddr);
1189 outb(val, port->opmode_ioaddr);
1190 spin_unlock_irq(&port->slock);
1195 spin_lock_irq(&port->slock);
1196 opmode = inb(port->opmode_ioaddr) >> shiftbit;
1197 spin_unlock_irq(&port->slock);
1231 return wait_event_interruptible(info->port.delta_msr_wait,
1348 if (!kfifo_is_empty(&info->port.xmit_fifo))
1456 tty_port_hangup(&info->port);
1480 static bool mxser_receive_chars_new(struct mxser_port *port, u8 status)
1482 enum mxser_must_hwid hwid = port->board->must_hwid;
1490 gdl = inb(port->ioaddr + MOXA_MUST_GDL_REGISTER);
1495 u8 ch = inb(port->ioaddr + UART_RX);
1496 if (!tty_insert_flip_char(&port->port, ch, 0))
1497 port->icount.buf_overrun++;
1504 struct mxser_port *port, u8 status)
1506 enum mxser_must_hwid hwid = port->board->must_hwid;
1515 ch = inb(port->ioaddr + UART_RX);
1517 outb(port->FCR | UART_FCR_CLEAR_RCVR,
1518 port->ioaddr + UART_FCR);
1519 status &= port->read_status_mask;
1520 if (status & port->ignore_status_mask) {
1528 port->icount.brk++;
1530 if (port->port.flags & ASYNC_SAK)
1534 port->icount.parity++;
1537 port->icount.frame++;
1540 port->icount.overrun++;
1543 if (!tty_insert_flip_char(&port->port, ch, flag)) {
1544 port->icount.buf_overrun++;
1552 status = inb(port->ioaddr + UART_LSR);
1559 struct mxser_port *port, u8 status)
1561 if (!mxser_receive_chars_new(port, status))
1562 status = mxser_receive_chars_old(tty, port, status);
1564 tty_flip_buffer_push(&port->port);
1569 static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port)
1573 if (port->x_char) {
1574 outb(port->x_char, port->ioaddr + UART_TX);
1575 port->x_char = 0;
1576 port->icount.tx++;
1580 if (kfifo_is_empty(&port->port.xmit_fifo) || tty->flow.stopped ||
1581 (tty->hw_stopped && !mxser_16550A_or_MUST(port))) {
1582 __mxser_stop_tx(port);
1586 count = port->xmit_fifo_size;
1590 if (!kfifo_get(&port->port.xmit_fifo, &c))
1593 outb(c, port->ioaddr + UART_TX);
1594 port->icount.tx++;
1597 if (kfifo_len(&port->port.xmit_fifo) < WAKEUP_CHARS)
1600 if (kfifo_is_empty(&port->port.xmit_fifo))
1601 __mxser_stop_tx(port);
1604 static bool mxser_port_isr(struct mxser_port *port)
1610 iir = inb(port->ioaddr + UART_IIR);
1615 tty = tty_port_tty_get(&port->port);
1617 status = inb(port->ioaddr + UART_LSR);
1618 outb(port->FCR | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT,
1619 port->ioaddr + UART_FCR);
1620 inb(port->ioaddr + UART_MSR);
1626 status = inb(port->ioaddr + UART_LSR);
1628 if (port->board->must_hwid) {
1633 status = mxser_receive_chars(tty, port, status);
1635 status &= port->read_status_mask;
1637 status = mxser_receive_chars(tty, port, status);
1640 mxser_check_modem_status(tty, port);
1642 if (port->board->must_hwid) {
1644 mxser_transmit_chars(tty, port);
1647 mxser_transmit_chars(tty, port);
1662 struct mxser_port *port;
1679 port = &brd->ports[i];
1682 spin_lock(&port->slock);
1684 if (mxser_port_isr(port))
1687 spin_unlock(&port->slock);
1764 tty_port_init(&info->port);
1765 info->port.ops = &mxser_port_ops;
1776 info->port.close_delay = 5 * HZ / 10;
1777 info->port.closing_wait = 30 * HZ;
1848 tty_dev = tty_port_register_device(&brd->ports[i].port,
1864 tty_port_destroy(&brd->ports[i].port);
1878 tty_port_destroy(&brd->ports[i].port);