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);
136 offset <<= up->port.regshift;
138 switch (up->port.iotype) {
140 outb(up->port.hub6 - 1 + offset, up->port.iobase);
141 outb(value, up->port.iobase + 1);
145 writeb(value, up->port.membase + offset);
149 outb(value, up->port.iobase + offset);
189 * We set the port uart clock rate if we succeed.
206 up->port.uartclk = SERIAL_RSA_BAUD_BASE * 16;
213 if (up->port.type == PORT_RSA) {
214 if (up->port.uartclk != SERIAL_RSA_BAUD_BASE * 16) {
215 spin_lock_irq(&up->port.lock);
217 spin_unlock_irq(&up->port.lock);
219 if (up->port.uartclk == SERIAL_RSA_BAUD_BASE * 16)
235 if (up->port.type == PORT_RSA &&
236 up->port.uartclk == SERIAL_RSA_BAUD_BASE * 16) {
237 spin_lock_irq(&up->port.lock);
249 up->port.uartclk = SERIAL_RSA_BAUD_BASE_LO * 16;
250 spin_unlock_irq(&up->port.lock);
263 static void sunsu_stop_tx(struct uart_port *port)
266 container_of(port, struct uart_sunsu_port, port);
273 if (up->port.type == PORT_16C950) {
279 static void sunsu_start_tx(struct uart_port *port)
282 container_of(port, struct uart_sunsu_port, port);
292 if (up->port.type == PORT_16C950 && up->acr & UART_ACR_TXDIS) {
298 static void sunsu_stop_rx(struct uart_port *port)
301 container_of(port, struct uart_sunsu_port, port);
304 up->port.read_status_mask &= ~UART_LSR_DR;
308 static void sunsu_enable_ms(struct uart_port *port)
311 container_of(port, struct uart_sunsu_port, port);
314 spin_lock_irqsave(&up->port.lock, flags);
317 spin_unlock_irqrestore(&up->port.lock, flags);
323 struct tty_port *port = &up->port.state->port;
331 up->port.icount.rx++;
340 up->port.icount.brk++;
341 if (up->port.cons != NULL &&
342 up->port.line == up->port.cons->index)
350 if (uart_handle_break(&up->port))
353 up->port.icount.parity++;
355 up->port.icount.frame++;
357 up->port.icount.overrun++;
362 *status &= up->port.read_status_mask;
364 if (up->port.cons != NULL &&
365 up->port.line == up->port.cons->index) {
378 if (uart_handle_sysrq_char(&up->port, ch))
380 if ((*status & up->port.ignore_status_mask) == 0)
381 tty_insert_flip_char(port, ch, flag);
388 tty_insert_flip_char(port, 0, TTY_OVERRUN);
399 struct circ_buf *xmit = &up->port.state->xmit;
402 if (up->port.x_char) {
403 serial_outp(up, UART_TX, up->port.x_char);
404 up->port.icount.tx++;
405 up->port.x_char = 0;
408 if (uart_tx_stopped(&up->port)) {
409 sunsu_stop_tx(&up->port);
417 count = up->port.fifosize;
420 uart_xmit_advance(&up->port, 1);
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 tty_flip_buffer_push(&up->port.state->port);
473 spin_unlock_irqrestore(&up->port.lock, flags);
481 sunsu_change_speed(struct uart_port *port, unsigned int cflag,
492 quot = up->port.uartclk / (16 * new_baud);
494 sunsu_change_speed(&up->port, up->cflag, 0, quot);
541 static unsigned int sunsu_tx_empty(struct uart_port *port)
544 container_of(port, struct uart_sunsu_port, port);
548 spin_lock_irqsave(&up->port.lock, flags);
550 spin_unlock_irqrestore(&up->port.lock, flags);
555 static unsigned int sunsu_get_mctrl(struct uart_port *port)
558 container_of(port, struct uart_sunsu_port, port);
576 static void sunsu_set_mctrl(struct uart_port *port, unsigned int mctrl)
579 container_of(port, struct uart_sunsu_port, port);
596 static void sunsu_break_ctl(struct uart_port *port, int break_state)
599 container_of(port, struct uart_sunsu_port, port);
602 spin_lock_irqsave(&up->port.lock, flags);
608 spin_unlock_irqrestore(&up->port.lock, flags);
611 static int sunsu_startup(struct uart_port *port)
614 container_of(port, struct uart_sunsu_port, port);
618 if (up->port.type == PORT_16C950) {
633 * If this is an RSA port, see if we can kick it up to the
643 if (uart_config[up->port.type].flags & UART_CLEAR_FIFO) {
663 if (!(up->port.flags & UPF_BUGGY_UART) &&
665 printk("ttyS%d: LSR safety check engaged!\n", up->port.line);
670 retval = request_irq(up->port.irq, sunsu_kbd_ms_interrupt,
673 retval = request_irq(up->port.irq, sunsu_serial_interrupt,
677 printk("su: Cannot register IRQ %d\n", up->port.irq);
686 spin_lock_irqsave(&up->port.lock, flags);
688 up->port.mctrl |= TIOCM_OUT2;
690 sunsu_set_mctrl(&up->port, up->port.mctrl);
691 spin_unlock_irqrestore(&up->port.lock, flags);
701 if (up->port.flags & UPF_FOURPORT) {
706 icp = (up->port.iobase & 0xfe0) | 0x01f;
722 static void sunsu_shutdown(struct uart_port *port)
725 container_of(port, struct uart_sunsu_port, port);
729 * Disable interrupts from this port
734 spin_lock_irqsave(&up->port.lock, flags);
735 if (up->port.flags & UPF_FOURPORT) {
737 inb((up->port.iobase & 0xfe0) | 0x1f);
738 up->port.mctrl |= TIOCM_OUT1;
740 up->port.mctrl &= ~TIOCM_OUT2;
742 sunsu_set_mctrl(&up->port, up->port.mctrl);
743 spin_unlock_irqrestore(&up->port.lock, flags);
762 * Read data port to reset things.
766 free_irq(up->port.irq, up);
770 sunsu_change_speed(struct uart_port *port, unsigned int cflag,
774 container_of(port, struct uart_sunsu_port, port);
808 if ((quot & 0xff) == 0 && up->port.type == PORT_16C950 &&
812 if (uart_config[up->port.type].flags & UART_USE_FIFO) {
813 if ((up->port.uartclk / quot) < (2400 * 16))
816 else if (up->port.type == PORT_RSA)
822 if (up->port.type == PORT_16750)
826 * Ok, we're now changing the port state. Do it with
829 spin_lock_irqsave(&up->port.lock, flags);
832 * Update the per-port timeout.
834 uart_update_timeout(port, cflag, (port->uartclk / (16 * quot)));
836 up->port.read_status_mask = UART_LSR_OE | UART_LSR_THRE | UART_LSR_DR;
838 up->port.read_status_mask |= UART_LSR_FE | UART_LSR_PE;
840 up->port.read_status_mask |= UART_LSR_BI;
845 up->port.ignore_status_mask = 0;
847 up->port.ignore_status_mask |= UART_LSR_PE | UART_LSR_FE;
849 up->port.ignore_status_mask |= UART_LSR_BI;
855 up->port.ignore_status_mask |= UART_LSR_OE;
862 up->port.ignore_status_mask |= UART_LSR_DR;
868 if (UART_ENABLE_MS(&up->port, cflag))
873 if (uart_config[up->port.type].flags & UART_STARTECH) {
880 if (up->port.type == PORT_16750)
884 if (up->port.type != PORT_16750) {
894 spin_unlock_irqrestore(&up->port.lock, flags);
898 sunsu_set_termios(struct uart_port *port, struct ktermios *termios,
906 baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16);
907 quot = uart_get_divisor(port, baud);
909 sunsu_change_speed(port, termios->c_cflag, termios->c_iflag, quot);
912 static void sunsu_release_port(struct uart_port *port)
916 static int sunsu_request_port(struct uart_port *port)
921 static void sunsu_config_port(struct uart_port *port, int flags)
924 container_of(port, struct uart_sunsu_port, port);
932 port->type = up->type_probed; /* XXX */
937 sunsu_verify_port(struct uart_port *port, struct serial_struct *ser)
943 sunsu_type(struct uart_port *port)
945 int type = port->type;
1039 up->port.iotype = UPIO_MEM;
1041 spin_lock_irqsave(&up->port.lock, flags);
1043 if (!(up->port.flags & UPF_BUGGY_UART)) {
1048 * 0x80 is used as a nonsense port to prevent against false
1050 * 0x80 is a non-existent port; which should be safe since
1081 if (!(up->port.flags & UPF_SKIP_TEST)) {
1095 up->port.type = PORT_16450;
1098 up->port.type = PORT_UNKNOWN;
1101 up->port.type = PORT_16550;
1104 up->port.type = PORT_16550A;
1107 if (up->port.type == PORT_16550A) {
1111 up->port.type = PORT_16650;
1115 up->port.type = PORT_16650V2;
1118 if (up->port.type == PORT_16550A) {
1137 up->port.type = PORT_16750;
1142 if (up->port.type == PORT_16450) {
1151 up->port.type = PORT_8250;
1154 up->port.fifosize = uart_config[up->port.type].dfl_xmit_fifo_size;
1156 if (up->port.type == PORT_UNKNOWN)
1158 up->type_probed = up->port.type; /* XXX */
1164 if (up->port.type == PORT_RSA)
1176 spin_unlock_irqrestore(&up->port.lock, flags);
1200 quot = up->port.uartclk / (16 * baud);
1203 if (up->port.type == PORT_UNKNOWN)
1206 printk("%pOF: %s port at %llx, irq %u\n",
1207 up->port.dev->of_node,
1209 (unsigned long long) up->port.mapbase,
1210 up->port.irq);
1226 (!(up->port.line & 1) ? "su/serio0" : "su/serio1"),
1232 serio->dev.parent = up->port.dev;
1237 sunsu_change_speed(&up->port, up->cflag, 0, quot);
1239 sunsu_startup(&up->port);
1271 if (up->port.flags & UPF_CONS_FLOW) {
1279 static void sunsu_console_putchar(struct uart_port *port, unsigned char ch)
1282 container_of(port, struct uart_sunsu_port, port);
1289 * Print a string to the serial port trying not to disturb
1290 * any possible real use of the port...
1300 if (up->port.sysrq || oops_in_progress)
1301 locked = spin_trylock_irqsave(&up->port.lock, flags);
1303 spin_lock_irqsave(&up->port.lock, flags);
1311 uart_console_write(&up->port, s, count, sunsu_console_putchar);
1321 spin_unlock_irqrestore(&up->port.lock, flags);
1327 * - initialize the serial port
1328 * Return non-zero if we didn't find a serial port.
1334 struct uart_port *port;
1341 port = &sunsu_ports[co->index].port;
1346 spin_lock_init(&port->lock);
1349 sunserial_console_termios(co, port->dev->of_node);
1353 port->mctrl |= TIOCM_DTR;
1354 port->ops->set_termios(port, &termios, &dummy);
1444 up->port.line = nr_inst;
1446 spin_lock_init(&up->port.lock);
1451 up->port.mapbase = rp->start;
1453 up->port.membase = of_ioremap(rp, 0, up->reg_size, "su");
1454 if (!up->port.membase) {
1460 up->port.irq = op->archdata.irqs[0];
1462 up->port.dev = &op->dev;
1464 up->port.type = PORT_UNKNOWN;
1465 up->port.uartclk = (SU_BASE_BAUD * 16);
1466 up->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_SUNSU_CONSOLE);
1473 up->port.membase, up->reg_size);
1484 up->port.flags |= UPF_BOOT_AUTOCONF;
1489 if (up->port.type == PORT_UNKNOWN)
1492 up->port.ops = &sunsu_pops;
1500 &sunsu_reg, up->port.line,
1502 err = uart_add_one_port(&sunsu_reg, &up->port);
1513 of_iounmap(&op->resource[0], up->port.membase, up->reg_size);
1531 } else if (up->port.type != PORT_UNKNOWN)
1532 uart_remove_one_port(&sunsu_reg, &up->port);
1534 if (up->port.membase)
1535 of_iounmap(&op->resource[0], up->port.membase, up->reg_size);
1622 MODULE_DESCRIPTION("Sun SU serial port driver");