Lines Matching refs:port
85 struct uart_port port;
106 offset <<= up->port.regshift;
108 switch (up->port.iotype) {
110 outb(up->port.hub6 - 1 + offset, up->port.iobase);
111 return inb(up->port.iobase + 1);
114 return readb(up->port.membase + offset);
117 return inb(up->port.iobase + offset);
135 offset <<= up->port.regshift;
137 switch (up->port.iotype) {
139 outb(up->port.hub6 - 1 + offset, up->port.iobase);
140 outb(value, up->port.iobase + 1);
144 writeb(value, up->port.membase + offset);
148 outb(value, up->port.iobase + offset);
188 * We set the port uart clock rate if we succeed.
205 up->port.uartclk = SERIAL_RSA_BAUD_BASE * 16;
212 if (up->port.type == PORT_RSA) {
213 if (up->port.uartclk != SERIAL_RSA_BAUD_BASE * 16) {
214 spin_lock_irq(&up->port.lock);
216 spin_unlock_irq(&up->port.lock);
218 if (up->port.uartclk == SERIAL_RSA_BAUD_BASE * 16)
234 if (up->port.type == PORT_RSA &&
235 up->port.uartclk == SERIAL_RSA_BAUD_BASE * 16) {
236 spin_lock_irq(&up->port.lock);
248 up->port.uartclk = SERIAL_RSA_BAUD_BASE_LO * 16;
249 spin_unlock_irq(&up->port.lock);
262 static void sunsu_stop_tx(struct uart_port *port)
265 container_of(port, struct uart_sunsu_port, port);
272 if (up->port.type == PORT_16C950) {
278 static void sunsu_start_tx(struct uart_port *port)
281 container_of(port, struct uart_sunsu_port, port);
291 if (up->port.type == PORT_16C950 && up->acr & UART_ACR_TXDIS) {
297 static void sunsu_stop_rx(struct uart_port *port)
300 container_of(port, struct uart_sunsu_port, port);
303 up->port.read_status_mask &= ~UART_LSR_DR;
307 static void sunsu_enable_ms(struct uart_port *port)
310 container_of(port, struct uart_sunsu_port, port);
313 spin_lock_irqsave(&up->port.lock, flags);
316 spin_unlock_irqrestore(&up->port.lock, flags);
322 struct tty_port *port = &up->port.state->port;
330 up->port.icount.rx++;
339 up->port.icount.brk++;
340 if (up->port.cons != NULL &&
341 up->port.line == up->port.cons->index)
349 if (uart_handle_break(&up->port))
352 up->port.icount.parity++;
354 up->port.icount.frame++;
356 up->port.icount.overrun++;
361 *status &= up->port.read_status_mask;
363 if (up->port.cons != NULL &&
364 up->port.line == up->port.cons->index) {
377 if (uart_handle_sysrq_char(&up->port, ch))
379 if ((*status & up->port.ignore_status_mask) == 0)
380 tty_insert_flip_char(port, ch, flag);
387 tty_insert_flip_char(port, 0, TTY_OVERRUN);
398 struct circ_buf *xmit = &up->port.state->xmit;
401 if (up->port.x_char) {
402 serial_outp(up, UART_TX, up->port.x_char);
403 up->port.icount.tx++;
404 up->port.x_char = 0;
407 if (uart_tx_stopped(&up->port)) {
408 sunsu_stop_tx(&up->port);
416 count = up->port.fifosize;
420 up->port.icount.tx++;
426 uart_write_wakeup(&up->port);
442 up->port.icount.rng++;
444 up->port.icount.dsr++;
446 uart_handle_dcd_change(&up->port, status & UART_MSR_DCD);
448 uart_handle_cts_change(&up->port, status & UART_MSR_CTS);
450 wake_up_interruptible(&up->port.state->port.delta_msr_wait);
459 spin_lock_irqsave(&up->port.lock, flags);
469 spin_unlock_irqrestore(&up->port.lock, flags);
471 tty_flip_buffer_push(&up->port.state->port);
473 spin_lock_irqsave(&up->port.lock, flags);
477 spin_unlock_irqrestore(&up->port.lock, flags);
485 sunsu_change_speed(struct uart_port *port, unsigned int cflag,
496 quot = up->port.uartclk / (16 * new_baud);
498 sunsu_change_speed(&up->port, up->cflag, 0, quot);
545 static unsigned int sunsu_tx_empty(struct uart_port *port)
548 container_of(port, struct uart_sunsu_port, port);
552 spin_lock_irqsave(&up->port.lock, flags);
554 spin_unlock_irqrestore(&up->port.lock, flags);
559 static unsigned int sunsu_get_mctrl(struct uart_port *port)
562 container_of(port, struct uart_sunsu_port, port);
580 static void sunsu_set_mctrl(struct uart_port *port, unsigned int mctrl)
583 container_of(port, struct uart_sunsu_port, port);
600 static void sunsu_break_ctl(struct uart_port *port, int break_state)
603 container_of(port, struct uart_sunsu_port, port);
606 spin_lock_irqsave(&up->port.lock, flags);
612 spin_unlock_irqrestore(&up->port.lock, flags);
615 static int sunsu_startup(struct uart_port *port)
618 container_of(port, struct uart_sunsu_port, port);
622 if (up->port.type == PORT_16C950) {
637 * If this is an RSA port, see if we can kick it up to the
647 if (uart_config[up->port.type].flags & UART_CLEAR_FIFO) {
667 if (!(up->port.flags & UPF_BUGGY_UART) &&
669 printk("ttyS%d: LSR safety check engaged!\n", up->port.line);
674 retval = request_irq(up->port.irq, sunsu_kbd_ms_interrupt,
677 retval = request_irq(up->port.irq, sunsu_serial_interrupt,
681 printk("su: Cannot register IRQ %d\n", up->port.irq);
690 spin_lock_irqsave(&up->port.lock, flags);
692 up->port.mctrl |= TIOCM_OUT2;
694 sunsu_set_mctrl(&up->port, up->port.mctrl);
695 spin_unlock_irqrestore(&up->port.lock, flags);
705 if (up->port.flags & UPF_FOURPORT) {
710 icp = (up->port.iobase & 0xfe0) | 0x01f;
726 static void sunsu_shutdown(struct uart_port *port)
729 container_of(port, struct uart_sunsu_port, port);
733 * Disable interrupts from this port
738 spin_lock_irqsave(&up->port.lock, flags);
739 if (up->port.flags & UPF_FOURPORT) {
741 inb((up->port.iobase & 0xfe0) | 0x1f);
742 up->port.mctrl |= TIOCM_OUT1;
744 up->port.mctrl &= ~TIOCM_OUT2;
746 sunsu_set_mctrl(&up->port, up->port.mctrl);
747 spin_unlock_irqrestore(&up->port.lock, flags);
766 * Read data port to reset things.
770 free_irq(up->port.irq, up);
774 sunsu_change_speed(struct uart_port *port, unsigned int cflag,
778 container_of(port, struct uart_sunsu_port, port);
814 if ((quot & 0xff) == 0 && up->port.type == PORT_16C950 &&
818 if (uart_config[up->port.type].flags & UART_USE_FIFO) {
819 if ((up->port.uartclk / quot) < (2400 * 16))
822 else if (up->port.type == PORT_RSA)
828 if (up->port.type == PORT_16750)
832 * Ok, we're now changing the port state. Do it with
835 spin_lock_irqsave(&up->port.lock, flags);
838 * Update the per-port timeout.
840 uart_update_timeout(port, cflag, (port->uartclk / (16 * quot)));
842 up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR;
844 up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE;
846 up->port.read_status_mask |= UART_LSR_BI;
851 up->port.ignore_status_mask = 0;
853 up->port.ignore_status_mask |= UART_LSR_PE | UART_LSR_FE;
855 up->port.ignore_status_mask |= UART_LSR_BI;
861 up->port.ignore_status_mask |= UART_LSR_OE;
868 up->port.ignore_status_mask |= UART_LSR_DR;
874 if (UART_ENABLE_MS(&up->port, cflag))
879 if (uart_config[up->port.type].flags & UART_STARTECH) {
886 if (up->port.type == PORT_16750)
890 if (up->port.type != PORT_16750) {
900 spin_unlock_irqrestore(&up->port.lock, flags);
904 sunsu_set_termios(struct uart_port *port, struct ktermios *termios,
912 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
913 quot = uart_get_divisor(port, baud);
915 sunsu_change_speed(port, termios->c_cflag, termios->c_iflag, quot);
918 static void sunsu_release_port(struct uart_port *port)
922 static int sunsu_request_port(struct uart_port *port)
927 static void sunsu_config_port(struct uart_port *port, int flags)
930 container_of(port, struct uart_sunsu_port, port);
938 port->type = up->type_probed; /* XXX */
943 sunsu_verify_port(struct uart_port *port, struct serial_struct *ser)
949 sunsu_type(struct uart_port *port)
951 int type = port->type;
1045 up->port.iotype = UPIO_MEM;
1047 spin_lock_irqsave(&up->port.lock, flags);
1049 if (!(up->port.flags & UPF_BUGGY_UART)) {
1054 * 0x80 is used as a nonsense port to prevent against false
1056 * 0x80 is a non-existent port; which should be safe since
1087 if (!(up->port.flags & UPF_SKIP_TEST)) {
1101 up->port.type = PORT_16450;
1104 up->port.type = PORT_UNKNOWN;
1107 up->port.type = PORT_16550;
1110 up->port.type = PORT_16550A;
1113 if (up->port.type == PORT_16550A) {
1117 up->port.type = PORT_16650;
1121 up->port.type = PORT_16650V2;
1124 if (up->port.type == PORT_16550A) {
1143 up->port.type = PORT_16750;
1148 if (up->port.type == PORT_16450) {
1157 up->port.type = PORT_8250;
1160 up->port.fifosize = uart_config[up->port.type].dfl_xmit_fifo_size;
1162 if (up->port.type == PORT_UNKNOWN)
1164 up->type_probed = up->port.type; /* XXX */
1170 if (up->port.type == PORT_RSA)
1182 spin_unlock_irqrestore(&up->port.lock, flags);
1206 quot = up->port.uartclk / (16 * baud);
1209 if (up->port.type == PORT_UNKNOWN)
1212 printk("%pOF: %s port at %llx, irq %u\n",
1213 up->port.dev->of_node,
1215 (unsigned long long) up->port.mapbase,
1216 up->port.irq);
1232 (!(up->port.line & 1) ? "su/serio0" : "su/serio1"),
1238 serio->dev.parent = up->port.dev;
1243 sunsu_change_speed(&up->port, up->cflag, 0, quot);
1245 sunsu_startup(&up->port);
1279 if (up->port.flags & UPF_CONS_FLOW) {
1287 static void sunsu_console_putchar(struct uart_port *port, int ch)
1290 container_of(port, struct uart_sunsu_port, port);
1297 * Print a string to the serial port trying not to disturb
1298 * any possible real use of the port...
1308 if (up->port.sysrq || oops_in_progress)
1309 locked = spin_trylock_irqsave(&up->port.lock, flags);
1311 spin_lock_irqsave(&up->port.lock, flags);
1319 uart_console_write(&up->port, s, count, sunsu_console_putchar);
1329 spin_unlock_irqrestore(&up->port.lock, flags);
1335 * - initialize the serial port
1336 * Return non-zero if we didn't find a serial port.
1342 struct uart_port *port;
1349 port = &sunsu_ports[co->index].port;
1354 spin_lock_init(&port->lock);
1357 sunserial_console_termios(co, port->dev->of_node);
1361 port->mctrl |= TIOCM_DTR;
1362 port->ops->set_termios(port, &termios, &dummy);
1452 up->port.line = nr_inst;
1454 spin_lock_init(&up->port.lock);
1459 up->port.mapbase = rp->start;
1461 up->port.membase = of_ioremap(rp, 0, up->reg_size, "su");
1462 if (!up->port.membase) {
1468 up->port.irq = op->archdata.irqs[0];
1470 up->port.dev = &op->dev;
1472 up->port.type = PORT_UNKNOWN;
1473 up->port.uartclk = (SU_BASE_BAUD * 16);
1474 up->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_SUNSU_CONSOLE);
1481 up->port.membase, up->reg_size);
1492 up->port.flags |= UPF_BOOT_AUTOCONF;
1497 if (up->port.type == PORT_UNKNOWN)
1500 up->port.ops = &sunsu_pops;
1508 &sunsu_reg, up->port.line,
1510 err = uart_add_one_port(&sunsu_reg, &up->port);
1521 of_iounmap(&op->resource[0], up->port.membase, up->reg_size);
1539 } else if (up->port.type != PORT_UNKNOWN)
1540 uart_remove_one_port(&sunsu_reg, &up->port);
1542 if (up->port.membase)
1543 of_iounmap(&op->resource[0], up->port.membase, up->reg_size);
1630 MODULE_DESCRIPTION("Sun SU serial port driver");