diff options
author | Vineet Gupta <Vineet.Gupta1@synopsys.com> | 2014-06-24 04:25:09 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-07-10 18:43:27 -0400 |
commit | 27cfe4ec17d85c2a9e7f26804d1652ad3fabf19e (patch) | |
tree | 015f77d35c18c196e2a5846d526bb4925872d4ed | |
parent | 5a56d59e853b3dcd97e9497c1c7d3834b24f0664 (diff) |
serial/arc: Use generic earlycon infrastructure
With this change both earlyprintk and earlycon coexist
We switch over to latter in next patch
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/serial/Kconfig | 1 | ||||
-rw-r--r-- | drivers/tty/serial/arc_uart.c | 30 |
2 files changed, 31 insertions, 0 deletions
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 7039238b134f..7f12a005c6cb 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig | |||
@@ -1472,6 +1472,7 @@ config SERIAL_ARC_CONSOLE | |||
1472 | bool "Console on ARC UART" | 1472 | bool "Console on ARC UART" |
1473 | depends on SERIAL_ARC=y | 1473 | depends on SERIAL_ARC=y |
1474 | select SERIAL_CORE_CONSOLE | 1474 | select SERIAL_CORE_CONSOLE |
1475 | select SERIAL_EARLYCON | ||
1475 | help | 1476 | help |
1476 | Enable system Console on ARC UART | 1477 | Enable system Console on ARC UART |
1477 | 1478 | ||
diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c index ea954c3be18b..41d2e351c06d 100644 --- a/drivers/tty/serial/arc_uart.c +++ b/drivers/tty/serial/arc_uart.c | |||
@@ -638,6 +638,36 @@ static int __init arc_serial_probe_earlyprintk(struct platform_device *pdev) | |||
638 | register_console(&arc_early_serial_console); | 638 | register_console(&arc_early_serial_console); |
639 | return 0; | 639 | return 0; |
640 | } | 640 | } |
641 | |||
642 | static __init void arc_early_serial_write(struct console *con, const char *s, | ||
643 | unsigned int n) | ||
644 | { | ||
645 | struct earlycon_device *dev = con->data; | ||
646 | |||
647 | uart_console_write(&dev->port, s, n, arc_serial_poll_putchar); | ||
648 | } | ||
649 | |||
650 | static int __init arc_early_console_setup(struct earlycon_device *dev, | ||
651 | const char *opt) | ||
652 | { | ||
653 | struct uart_port *port = &dev->port; | ||
654 | unsigned int l, h, hw_val; | ||
655 | |||
656 | if (!dev->port.membase) | ||
657 | return -ENODEV; | ||
658 | |||
659 | hw_val = port->uartclk / (dev->baud * 4) - 1; | ||
660 | l = hw_val & 0xFF; | ||
661 | h = (hw_val >> 8) & 0xFF; | ||
662 | |||
663 | UART_SET_BAUDL(port, l); | ||
664 | UART_SET_BAUDH(port, h); | ||
665 | |||
666 | dev->con->write = arc_early_serial_write; | ||
667 | return 0; | ||
668 | } | ||
669 | EARLYCON_DECLARE(arc_uart, arc_early_console_setup); | ||
670 | |||
641 | #endif /* CONFIG_SERIAL_ARC_CONSOLE */ | 671 | #endif /* CONFIG_SERIAL_ARC_CONSOLE */ |
642 | 672 | ||
643 | static int arc_serial_probe(struct platform_device *pdev) | 673 | static int arc_serial_probe(struct platform_device *pdev) |