| .. | .. |
|---|
| 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> |
|---|
| .. | .. |
|---|
| 130 | 132 | |
|---|
| 131 | 133 | l = l->next; |
|---|
| 132 | 134 | |
|---|
| 133 | | - if (l == i->head && pass_counter++ > PASS_LIMIT) { |
|---|
| 134 | | - /* If we hit this, we're dead. */ |
|---|
| 135 | | - printk_ratelimited(KERN_ERR |
|---|
| 136 | | - "serial8250: too much work for irq%d\n", irq); |
|---|
| 135 | + if (l == i->head && pass_counter++ > PASS_LIMIT) |
|---|
| 137 | 136 | break; |
|---|
| 138 | | - } |
|---|
| 139 | 137 | } while (l != end); |
|---|
| 140 | 138 | |
|---|
| 141 | 139 | spin_unlock(&i->lock); |
|---|
| .. | .. |
|---|
| 334 | 332 | * hardware interrupt, we use a timer-based system. The original |
|---|
| 335 | 333 | * driver used to do this with IRQ0. |
|---|
| 336 | 334 | */ |
|---|
| 337 | | - if (!port->irq) { |
|---|
| 335 | + if (!port->irq) |
|---|
| 338 | 336 | mod_timer(&up->timer, jiffies + uart_poll_timeout(port)); |
|---|
| 339 | | - } else |
|---|
| 337 | + else |
|---|
| 340 | 338 | retval = serial_link_irq_chain(up); |
|---|
| 341 | 339 | |
|---|
| 342 | 340 | return retval; |
|---|
| .. | .. |
|---|
| 575 | 573 | |
|---|
| 576 | 574 | up->port.dev = dev; |
|---|
| 577 | 575 | |
|---|
| 576 | + if (uart_console_enabled(&up->port)) |
|---|
| 577 | + pm_runtime_get_sync(up->port.dev); |
|---|
| 578 | + |
|---|
| 578 | 579 | serial8250_apply_quirks(up); |
|---|
| 579 | 580 | uart_add_one_port(drv, &up->port); |
|---|
| 580 | 581 | } |
|---|
| .. | .. |
|---|
| 611 | 612 | if (retval != 0) |
|---|
| 612 | 613 | port->cons = NULL; |
|---|
| 613 | 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); |
|---|
| 614 | 623 | } |
|---|
| 615 | 624 | |
|---|
| 616 | 625 | /** |
|---|
| .. | .. |
|---|
| 671 | 680 | .write = univ8250_console_write, |
|---|
| 672 | 681 | .device = uart_console_device, |
|---|
| 673 | 682 | .setup = univ8250_console_setup, |
|---|
| 683 | + .exit = univ8250_console_exit, |
|---|
| 674 | 684 | .match = univ8250_console_match, |
|---|
| 675 | 685 | .flags = CON_PRINTBUFFER | CON_ANYTIME, |
|---|
| 676 | 686 | .index = -1, |
|---|
| .. | .. |
|---|
| 758 | 768 | if (!console_suspend_enabled && uart_console(port) && |
|---|
| 759 | 769 | port->type != PORT_8250) { |
|---|
| 760 | 770 | unsigned char canary = 0xa5; |
|---|
| 771 | + |
|---|
| 761 | 772 | serial_out(up, UART_SCR, canary); |
|---|
| 762 | 773 | if (serial_in(up, UART_SCR) == canary) |
|---|
| 763 | 774 | up->canary = canary; |
|---|
| .. | .. |
|---|
| 820 | 831 | uart.port.flags = p->flags; |
|---|
| 821 | 832 | uart.port.mapbase = p->mapbase; |
|---|
| 822 | 833 | uart.port.hub6 = p->hub6; |
|---|
| 834 | + uart.port.has_sysrq = p->has_sysrq; |
|---|
| 823 | 835 | uart.port.private_data = p->private_data; |
|---|
| 824 | 836 | uart.port.type = p->type; |
|---|
| 825 | 837 | uart.port.serial_in = p->serial_in; |
|---|
| .. | .. |
|---|
| 987 | 999 | |
|---|
| 988 | 1000 | uart = serial8250_find_match_or_unused(&up->port); |
|---|
| 989 | 1001 | if (uart && uart->port.type != PORT_8250_CIR) { |
|---|
| 1002 | + struct mctrl_gpios *gpios; |
|---|
| 1003 | + |
|---|
| 990 | 1004 | if (uart->port.dev) |
|---|
| 991 | 1005 | uart_remove_one_port(&serial8250_reg, &uart->port); |
|---|
| 992 | 1006 | |
|---|
| .. | .. |
|---|
| 1009 | 1023 | uart->port.unthrottle = up->port.unthrottle; |
|---|
| 1010 | 1024 | uart->port.rs485_config = up->port.rs485_config; |
|---|
| 1011 | 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; |
|---|
| 1012 | 1028 | uart->dma = up->dma; |
|---|
| 1013 | 1029 | #ifdef CONFIG_ARCH_ROCKCHIP |
|---|
| 1014 | 1030 | uart->port.line = up->port.line; |
|---|
| .. | .. |
|---|
| 1017 | 1033 | if (uart->port.fifosize && !uart->tx_loadsz) |
|---|
| 1018 | 1034 | uart->tx_loadsz = uart->port.fifosize; |
|---|
| 1019 | 1035 | |
|---|
| 1020 | | - if (up->port.dev) |
|---|
| 1036 | + if (up->port.dev) { |
|---|
| 1021 | 1037 | uart->port.dev = up->port.dev; |
|---|
| 1038 | + ret = uart_get_rs485_mode(&uart->port); |
|---|
| 1039 | + if (ret) |
|---|
| 1040 | + goto err; |
|---|
| 1041 | + } |
|---|
| 1022 | 1042 | |
|---|
| 1023 | 1043 | if (up->port.flags & UPF_FIXED_TYPE) |
|---|
| 1024 | 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 | + } |
|---|
| 1025 | 1059 | |
|---|
| 1026 | 1060 | serial8250_set_defaults(uart); |
|---|
| 1027 | 1061 | |
|---|
| .. | .. |
|---|
| 1129 | 1163 | uart->port.type = PORT_UNKNOWN; |
|---|
| 1130 | 1164 | uart->port.dev = &serial8250_isa_devs->dev; |
|---|
| 1131 | 1165 | uart->capabilities = 0; |
|---|
| 1166 | + serial8250_init_port(uart); |
|---|
| 1132 | 1167 | serial8250_apply_quirks(uart); |
|---|
| 1133 | 1168 | uart_add_one_port(&serial8250_reg, &uart->port); |
|---|
| 1134 | 1169 | } else { |
|---|