Lines Matching refs:port

122 		struct uart_port *port;
125 port = &up->port;
127 if (port->handle_irq(port)) {
181 h = &irq_lists[up->port.irq % NR_IRQ_HASH];
184 if (i->irq == up->port.irq)
194 i->irq = up->port.irq;
210 ret = request_irq(up->port.irq, serial8250_interrupt,
211 up->port.irqflags, up->port.name, i);
226 h = &irq_lists[up->port.irq % NR_IRQ_HASH];
229 if (i->irq == up->port.irq)
236 free_irq(up->port.irq, i);
252 up->port.handle_irq(&up->port);
253 mod_timer(&up->timer, jiffies + uart_poll_timeout(&up->port));
262 uart_port_lock_irqsave(&up->port, &flags);
268 if (up->port.irq) {
283 (!uart_circ_empty(&up->port.state->xmit) || up->port.x_char) &&
292 if (up->port.irq)
295 uart_port_unlock_irqrestore(&up->port, flags);
297 /* Standard timer interval plus 0.2s to keep the port running */
299 jiffies + uart_poll_timeout(&up->port) + HZ / 5);
304 struct uart_port *port = &up->port;
308 * the port is opened so this value needs to be preserved.
311 pr_debug("%s - using backup timer\n", port->name);
315 uart_poll_timeout(port) + HZ / 5);
319 * If the "interrupt" for this port doesn't correspond with any
323 if (!port->irq)
324 mod_timer(&up->timer, jiffies + uart_poll_timeout(port));
329 struct uart_port *port = &up->port;
331 if (port->irq)
339 struct uart_port *port = &up->port;
343 if (port->irq)
350 unsigned long start = UART_RSA_BASE << up->port.regshift;
351 unsigned int size = 8 << up->port.regshift;
352 struct uart_port *port = &up->port;
355 switch (port->iotype) {
358 start += port->iobase;
371 unsigned long offset = UART_RSA_BASE << up->port.regshift;
372 unsigned int size = 8 << up->port.regshift;
373 struct uart_port *port = &up->port;
375 switch (port->iotype) {
378 release_region(port->iobase + offset, size);
405 * port.
413 static void (*serial8250_isa_config)(int port, struct uart_port *up,
417 void (*v)(int port, struct uart_port *up, u32 *capabilities))
425 static void univ8250_config_port(struct uart_port *port, int flags)
427 struct uart_8250_port *up = up_to_u8250p(port);
430 if (port->type == PORT_RSA) {
437 if (probe_rsa[i] == up->port.iobase) {
445 base_ops->config_port(port, flags);
447 if (port->type != PORT_RSA && up->probe & UART_PROBE_RSA)
451 static int univ8250_request_port(struct uart_port *port)
453 struct uart_8250_port *up = up_to_u8250p(port);
456 ret = base_ops->request_port(port);
457 if (ret == 0 && port->type == PORT_RSA) {
460 base_ops->release_port(port);
466 static void univ8250_release_port(struct uart_port *port)
468 struct uart_8250_port *up = up_to_u8250p(port);
470 if (port->type == PORT_RSA)
472 base_ops->release_port(port);
488 up->port.quirks |= skip_txen_test ? UPQ_NO_TXEN_TEST : 0;
499 up->port.line = index;
500 up->port.port_id = index;
504 base_ops = up->port.ops;
505 up->port.ops = &univ8250_port_ops;
537 /* chain base port ops to support Remote Supervisor Adapter */
547 struct uart_port *port = &up->port;
549 port->iobase = old_serial_port[i].port;
550 port->irq = irq_canonicalize(old_serial_port[i].irq);
551 port->irqflags = 0;
552 port->uartclk = old_serial_port[i].baud_base * 16;
553 port->flags = old_serial_port[i].flags;
554 port->hub6 = 0;
555 port->membase = old_serial_port[i].iomem_base;
556 port->iotype = old_serial_port[i].io_type;
557 port->regshift = old_serial_port[i].iomem_reg_shift;
559 port->irqflags |= irqflag;
561 serial8250_isa_config(i, &up->port, &up->capabilities);
573 if (up->port.type == PORT_8250_CIR)
576 if (up->port.dev)
579 up->port.dev = dev;
581 if (uart_console_registered(&up->port))
582 pm_runtime_get_sync(up->port.dev);
585 uart_add_one_port(drv, &up->port);
602 struct uart_port *port;
607 * if so, search for the first available port that does have
624 port = &serial8250_ports[co->index].port;
625 /* link port to console */
626 port->cons = co;
628 retval = serial8250_console_setup(port, options, false);
630 port->cons = NULL;
636 struct uart_port *port;
638 port = &serial8250_ports[co->index].port;
639 return serial8250_console_exit(port);
674 /* try to match the port specified on the command line */
676 struct uart_port *port = &serial8250_ports[i].port;
678 if (port->iotype != iotype)
682 && (port->mapbase != addr))
684 if (iotype == UPIO_PORT && port->iobase != addr)
688 port->cons = co;
689 return serial8250_console_setup(port, options, true);
735 * Setup an 8250 port structure prior to console initialisation. Use
738 int __init early_serial_setup(struct uart_port *port)
742 if (port->line >= ARRAY_SIZE(serial8250_ports) || nr_uarts == 0)
746 p = &serial8250_ports[port->line].port;
747 p->iobase = port->iobase;
748 p->membase = port->membase;
749 p->irq = port->irq;
750 p->irqflags = port->irqflags;
751 p->uartclk = port->uartclk;
752 p->fifosize = port->fifosize;
753 p->regshift = port->regshift;
754 p->iotype = port->iotype;
755 p->flags = port->flags;
756 p->mapbase = port->mapbase;
757 p->mapsize = port->mapsize;
758 p->private_data = port->private_data;
759 p->type = port->type;
760 p->line = port->line;
764 if (port->serial_in)
765 p->serial_in = port->serial_in;
766 if (port->serial_out)
767 p->serial_out = port->serial_out;
768 if (port->handle_irq)
769 p->handle_irq = port->handle_irq;
775 * serial8250_suspend_port - suspend one serial port
778 * Suspend one serial port.
783 struct uart_port *port = &up->port;
785 if (!console_suspend_enabled && uart_console(port) &&
786 port->type != PORT_8250) {
794 uart_suspend_port(&serial8250_reg, port);
799 * serial8250_resume_port - resume one serial port
802 * Resume one serial port.
807 struct uart_port *port = &up->port;
813 serial_port_out(port, UART_LCR, 0xE0);
817 serial_port_out(port, UART_LCR, 0);
818 port->uartclk = 921600*16;
820 uart_resume_port(&serial8250_reg, port);
841 uart.port.iobase = p->iobase;
842 uart.port.membase = p->membase;
843 uart.port.irq = p->irq;
844 uart.port.irqflags = p->irqflags;
845 uart.port.uartclk = p->uartclk;
846 uart.port.regshift = p->regshift;
847 uart.port.iotype = p->iotype;
848 uart.port.flags = p->flags;
849 uart.port.mapbase = p->mapbase;
850 uart.port.mapsize = p->mapsize;
851 uart.port.hub6 = p->hub6;
852 uart.port.has_sysrq = p->has_sysrq;
853 uart.port.private_data = p->private_data;
854 uart.port.type = p->type;
856 uart.port.serial_in = p->serial_in;
857 uart.port.serial_out = p->serial_out;
860 uart.port.handle_irq = p->handle_irq;
861 uart.port.handle_break = p->handle_break;
862 uart.port.set_termios = p->set_termios;
863 uart.port.set_ldisc = p->set_ldisc;
864 uart.port.get_mctrl = p->get_mctrl;
865 uart.port.pm = p->pm;
866 uart.port.dev = &dev->dev;
867 uart.port.irqflags |= irqflag;
870 dev_err(&dev->dev, "unable to register port at index %d "
889 if (up->port.dev == &dev->dev)
901 if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev)
902 uart_suspend_port(&serial8250_reg, &up->port);
915 if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev->dev)
945 static struct uart_8250_port *serial8250_find_match_or_unused(const struct uart_port *port)
950 * First, find a port entry which matches.
953 if (uart_match_port(&serial8250_ports[i].port, port))
957 i = port->line;
958 if (i < nr_uarts && serial8250_ports[i].port.type == PORT_UNKNOWN &&
959 serial8250_ports[i].port.iobase == 0)
967 if (serial8250_ports[i].port.type == PORT_UNKNOWN &&
968 serial8250_ports[i].port.iobase == 0)
973 * doesn't have a real port associated with it.
976 if (serial8250_ports[i].port.type == PORT_UNKNOWN)
987 struct uart_port *port = &up->port;
990 uart_port_lock_irqsave(port, &flags);
992 up->port.read_status_mask |= UART_LSR_DR;
994 uart_port_unlock_irqrestore(port, flags);
998 * serial8250_register_8250_port - register a serial port
999 * @up: serial port template
1001 * Configure the serial port specified by the request. If the
1002 * port exists and is in use, it is hung up and unregistered
1005 * The port is then probed and if necessary the IRQ is autodetected
1008 * On success the port is ready to use and the line number is returned.
1015 if (up->port.uartclk == 0)
1020 uart = serial8250_find_match_or_unused(&up->port);
1023 * If the port is past the initial isa ports, initialize a new
1024 * port and increment nr_uarts accordingly.
1032 if (uart->port.type != PORT_8250_CIR) {
1035 if (uart->port.dev)
1036 uart_remove_one_port(&serial8250_reg, &uart->port);
1038 uart->port.ctrl_id = up->port.ctrl_id;
1039 uart->port.port_id = up->port.port_id;
1040 uart->port.iobase = up->port.iobase;
1041 uart->port.membase = up->port.membase;
1042 uart->port.irq = up->port.irq;
1043 uart->port.irqflags = up->port.irqflags;
1044 uart->port.uartclk = up->port.uartclk;
1045 uart->port.fifosize = up->port.fifosize;
1046 uart->port.regshift = up->port.regshift;
1047 uart->port.iotype = up->port.iotype;
1048 uart->port.flags = up->port.flags | UPF_BOOT_AUTOCONF;
1050 uart->port.mapbase = up->port.mapbase;
1051 uart->port.mapsize = up->port.mapsize;
1052 uart->port.private_data = up->port.private_data;
1055 uart->port.throttle = up->port.throttle;
1056 uart->port.unthrottle = up->port.unthrottle;
1057 uart->port.rs485_config = up->port.rs485_config;
1058 uart->port.rs485_supported = up->port.rs485_supported;
1059 uart->port.rs485 = up->port.rs485;
1066 if (uart->port.fifosize && !uart->tx_loadsz)
1067 uart->tx_loadsz = uart->port.fifosize;
1069 if (up->port.dev) {
1070 uart->port.dev = up->port.dev;
1071 ret = uart_get_rs485_mode(&uart->port);
1076 if (up->port.flags & UPF_FIXED_TYPE)
1077 uart->port.type = up->port.type;
1083 if (!has_acpi_companion(uart->port.dev)) {
1084 gpios = mctrl_gpio_init(&uart->port, 0);
1096 if (up->port.serial_in)
1097 uart->port.serial_in = up->port.serial_in;
1098 if (up->port.serial_out)
1099 uart->port.serial_out = up->port.serial_out;
1100 if (up->port.handle_irq)
1101 uart->port.handle_irq = up->port.handle_irq;
1103 if (up->port.set_termios)
1104 uart->port.set_termios = up->port.set_termios;
1105 if (up->port.set_ldisc)
1106 uart->port.set_ldisc = up->port.set_ldisc;
1107 if (up->port.get_mctrl)
1108 uart->port.get_mctrl = up->port.get_mctrl;
1109 if (up->port.set_mctrl)
1110 uart->port.set_mctrl = up->port.set_mctrl;
1111 if (up->port.get_divisor)
1112 uart->port.get_divisor = up->port.get_divisor;
1113 if (up->port.set_divisor)
1114 uart->port.set_divisor = up->port.set_divisor;
1115 if (up->port.startup)
1116 uart->port.startup = up->port.startup;
1117 if (up->port.shutdown)
1118 uart->port.shutdown = up->port.shutdown;
1119 if (up->port.pm)
1120 uart->port.pm = up->port.pm;
1121 if (up->port.handle_break)
1122 uart->port.handle_break = up->port.handle_break;
1128 if (uart->port.type != PORT_8250_CIR) {
1130 serial8250_isa_config(0, &uart->port,
1135 &uart->port);
1139 ret = uart->port.line;
1141 dev_info(uart->port.dev,
1142 "skipping CIR port at 0x%lx / 0x%llx, IRQ %d\n",
1143 uart->port.iobase,
1144 (unsigned long long)uart->port.mapbase,
1145 uart->port.irq);
1170 uart->port.dev = NULL;
1177 * serial8250_unregister_port - remove a 16x50 serial port at runtime
1180 * Remove one serial port. This may not be called from interrupt
1181 * context. We hand the port back to the our control.
1192 uart_port_lock_irqsave(&uart->port, &flags);
1194 uart_port_unlock_irqrestore(&uart->port, flags);
1197 uart_remove_one_port(&serial8250_reg, &uart->port);
1199 uart->port.flags &= ~UPF_BOOT_AUTOCONF;
1200 uart->port.type = PORT_UNKNOWN;
1201 uart->port.dev = &serial8250_isa_devs->dev;
1202 uart->port.port_id = line;
1206 uart_add_one_port(&serial8250_reg, &uart->port);
1208 uart->port.dev = NULL;