.. | .. |
---|
14 | 14 | * serial8250_register_8250_port() ports |
---|
15 | 15 | */ |
---|
16 | 16 | |
---|
| 17 | +#include <linux/acpi.h> |
---|
17 | 18 | #include <linux/module.h> |
---|
18 | 19 | #include <linux/moduleparam.h> |
---|
19 | 20 | #include <linux/ioport.h> |
---|
.. | .. |
---|
22 | 23 | #include <linux/sysrq.h> |
---|
23 | 24 | #include <linux/delay.h> |
---|
24 | 25 | #include <linux/platform_device.h> |
---|
| 26 | +#include <linux/pm_runtime.h> |
---|
25 | 27 | #include <linux/tty.h> |
---|
26 | 28 | #include <linux/ratelimit.h> |
---|
27 | 29 | #include <linux/tty_flip.h> |
---|
.. | .. |
---|
54 | 56 | |
---|
55 | 57 | static unsigned int skip_txen_test; /* force skip of txen test at init time */ |
---|
56 | 58 | |
---|
57 | | -/* |
---|
58 | | - * On -rt we can have a more delays, and legitimately |
---|
59 | | - * so - so don't drop work spuriously and spam the |
---|
60 | | - * syslog: |
---|
61 | | - */ |
---|
62 | | -#ifdef CONFIG_PREEMPT_RT_FULL |
---|
63 | | -# define PASS_LIMIT 1000000 |
---|
64 | | -#else |
---|
65 | | -# define PASS_LIMIT 512 |
---|
66 | | -#endif |
---|
| 59 | +#define PASS_LIMIT 512 |
---|
67 | 60 | |
---|
68 | 61 | #include <asm/serial.h> |
---|
69 | 62 | /* |
---|
.. | .. |
---|
139 | 132 | |
---|
140 | 133 | l = l->next; |
---|
141 | 134 | |
---|
142 | | - if (l == i->head && pass_counter++ > PASS_LIMIT) { |
---|
143 | | - /* If we hit this, we're dead. */ |
---|
144 | | - printk_ratelimited(KERN_ERR |
---|
145 | | - "serial8250: too much work for irq%d\n", irq); |
---|
| 135 | + if (l == i->head && pass_counter++ > PASS_LIMIT) |
---|
146 | 136 | break; |
---|
147 | | - } |
---|
148 | 137 | } while (l != end); |
---|
149 | 138 | |
---|
150 | 139 | spin_unlock(&i->lock); |
---|
.. | .. |
---|
343 | 332 | * hardware interrupt, we use a timer-based system. The original |
---|
344 | 333 | * driver used to do this with IRQ0. |
---|
345 | 334 | */ |
---|
346 | | - if (!port->irq) { |
---|
| 335 | + if (!port->irq) |
---|
347 | 336 | mod_timer(&up->timer, jiffies + uart_poll_timeout(port)); |
---|
348 | | - } else |
---|
| 337 | + else |
---|
349 | 338 | retval = serial_link_irq_chain(up); |
---|
350 | 339 | |
---|
351 | 340 | return retval; |
---|
.. | .. |
---|
584 | 573 | |
---|
585 | 574 | up->port.dev = dev; |
---|
586 | 575 | |
---|
| 576 | + if (uart_console_enabled(&up->port)) |
---|
| 577 | + pm_runtime_get_sync(up->port.dev); |
---|
| 578 | + |
---|
587 | 579 | serial8250_apply_quirks(up); |
---|
588 | 580 | uart_add_one_port(drv, &up->port); |
---|
589 | 581 | } |
---|
.. | .. |
---|
620 | 612 | if (retval != 0) |
---|
621 | 613 | port->cons = NULL; |
---|
622 | 614 | return retval; |
---|
| 615 | +} |
---|
| 616 | + |
---|
| 617 | +static int univ8250_console_exit(struct console *co) |
---|
| 618 | +{ |
---|
| 619 | + struct uart_port *port; |
---|
| 620 | + |
---|
| 621 | + port = &serial8250_ports[co->index].port; |
---|
| 622 | + return serial8250_console_exit(port); |
---|
623 | 623 | } |
---|
624 | 624 | |
---|
625 | 625 | /** |
---|
.. | .. |
---|
680 | 680 | .write = univ8250_console_write, |
---|
681 | 681 | .device = uart_console_device, |
---|
682 | 682 | .setup = univ8250_console_setup, |
---|
| 683 | + .exit = univ8250_console_exit, |
---|
683 | 684 | .match = univ8250_console_match, |
---|
684 | 685 | .flags = CON_PRINTBUFFER | CON_ANYTIME, |
---|
685 | 686 | .index = -1, |
---|
.. | .. |
---|
767 | 768 | if (!console_suspend_enabled && uart_console(port) && |
---|
768 | 769 | port->type != PORT_8250) { |
---|
769 | 770 | unsigned char canary = 0xa5; |
---|
| 771 | + |
---|
770 | 772 | serial_out(up, UART_SCR, canary); |
---|
771 | 773 | if (serial_in(up, UART_SCR) == canary) |
---|
772 | 774 | up->canary = canary; |
---|
.. | .. |
---|
829 | 831 | uart.port.flags = p->flags; |
---|
830 | 832 | uart.port.mapbase = p->mapbase; |
---|
831 | 833 | uart.port.hub6 = p->hub6; |
---|
| 834 | + uart.port.has_sysrq = p->has_sysrq; |
---|
832 | 835 | uart.port.private_data = p->private_data; |
---|
833 | 836 | uart.port.type = p->type; |
---|
834 | 837 | uart.port.serial_in = p->serial_in; |
---|
.. | .. |
---|
996 | 999 | |
---|
997 | 1000 | uart = serial8250_find_match_or_unused(&up->port); |
---|
998 | 1001 | if (uart && uart->port.type != PORT_8250_CIR) { |
---|
| 1002 | + struct mctrl_gpios *gpios; |
---|
| 1003 | + |
---|
999 | 1004 | if (uart->port.dev) |
---|
1000 | 1005 | uart_remove_one_port(&serial8250_reg, &uart->port); |
---|
1001 | 1006 | |
---|
.. | .. |
---|
1018 | 1023 | uart->port.unthrottle = up->port.unthrottle; |
---|
1019 | 1024 | uart->port.rs485_config = up->port.rs485_config; |
---|
1020 | 1025 | uart->port.rs485 = up->port.rs485; |
---|
| 1026 | + uart->rs485_start_tx = up->rs485_start_tx; |
---|
| 1027 | + uart->rs485_stop_tx = up->rs485_stop_tx; |
---|
1021 | 1028 | uart->dma = up->dma; |
---|
1022 | 1029 | #ifdef CONFIG_ARCH_ROCKCHIP |
---|
1023 | 1030 | uart->port.line = up->port.line; |
---|
.. | .. |
---|
1026 | 1033 | if (uart->port.fifosize && !uart->tx_loadsz) |
---|
1027 | 1034 | uart->tx_loadsz = uart->port.fifosize; |
---|
1028 | 1035 | |
---|
1029 | | - if (up->port.dev) |
---|
| 1036 | + if (up->port.dev) { |
---|
1030 | 1037 | uart->port.dev = up->port.dev; |
---|
| 1038 | + ret = uart_get_rs485_mode(&uart->port); |
---|
| 1039 | + if (ret) |
---|
| 1040 | + goto err; |
---|
| 1041 | + } |
---|
1031 | 1042 | |
---|
1032 | 1043 | if (up->port.flags & UPF_FIXED_TYPE) |
---|
1033 | 1044 | uart->port.type = up->port.type; |
---|
| 1045 | + |
---|
| 1046 | + /* |
---|
| 1047 | + * Only call mctrl_gpio_init(), if the device has no ACPI |
---|
| 1048 | + * companion device |
---|
| 1049 | + */ |
---|
| 1050 | + if (!has_acpi_companion(uart->port.dev)) { |
---|
| 1051 | + gpios = mctrl_gpio_init(&uart->port, 0); |
---|
| 1052 | + if (IS_ERR(gpios)) { |
---|
| 1053 | + ret = PTR_ERR(gpios); |
---|
| 1054 | + goto err; |
---|
| 1055 | + } else { |
---|
| 1056 | + uart->gpios = gpios; |
---|
| 1057 | + } |
---|
| 1058 | + } |
---|
1034 | 1059 | |
---|
1035 | 1060 | serial8250_set_defaults(uart); |
---|
1036 | 1061 | |
---|
.. | .. |
---|
1138 | 1163 | uart->port.type = PORT_UNKNOWN; |
---|
1139 | 1164 | uart->port.dev = &serial8250_isa_devs->dev; |
---|
1140 | 1165 | uart->capabilities = 0; |
---|
| 1166 | + serial8250_init_port(uart); |
---|
1141 | 1167 | serial8250_apply_quirks(uart); |
---|
1142 | 1168 | uart_add_one_port(&serial8250_reg, &uart->port); |
---|
1143 | 1169 | } else { |
---|