summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/arc_uart.c
diff options
context:
space:
mode:
authorVineet Gupta <Vineet.Gupta1@synopsys.com>2014-06-24 13:55:09 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-10 15:43:27 -0700
commit27cfe4ec17d85c2a9e7f26804d1652ad3fabf19e (patch)
tree015f77d35c18c196e2a5846d526bb4925872d4ed /drivers/tty/serial/arc_uart.c
parent5a56d59e853b3dcd97e9497c1c7d3834b24f0664 (diff)
downloadtalos-op-linux-27cfe4ec17d85c2a9e7f26804d1652ad3fabf19e.tar.gz
talos-op-linux-27cfe4ec17d85c2a9e7f26804d1652ad3fabf19e.zip
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>
Diffstat (limited to 'drivers/tty/serial/arc_uart.c')
-rw-r--r--drivers/tty/serial/arc_uart.c30
1 files changed, 30 insertions, 0 deletions
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)
register_console(&arc_early_serial_console);
return 0;
}
+
+static __init void arc_early_serial_write(struct console *con, const char *s,
+ unsigned int n)
+{
+ struct earlycon_device *dev = con->data;
+
+ uart_console_write(&dev->port, s, n, arc_serial_poll_putchar);
+}
+
+static int __init arc_early_console_setup(struct earlycon_device *dev,
+ const char *opt)
+{
+ struct uart_port *port = &dev->port;
+ unsigned int l, h, hw_val;
+
+ if (!dev->port.membase)
+ return -ENODEV;
+
+ hw_val = port->uartclk / (dev->baud * 4) - 1;
+ l = hw_val & 0xFF;
+ h = (hw_val >> 8) & 0xFF;
+
+ UART_SET_BAUDL(port, l);
+ UART_SET_BAUDH(port, h);
+
+ dev->con->write = arc_early_serial_write;
+ return 0;
+}
+EARLYCON_DECLARE(arc_uart, arc_early_console_setup);
+
#endif /* CONFIG_SERIAL_ARC_CONSOLE */
static int arc_serial_probe(struct platform_device *pdev)
OpenPOWER on IntegriCloud