summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/bcm63xx_uart.c
diff options
context:
space:
mode:
authorKevin Cernekee <cernekee@gmail.com>2014-10-22 00:23:02 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-06 23:57:24 +0100
commit1ab8e4b1acdf39ebe6002bbe07ef6e578cff5d74 (patch)
treec6e8ae09bee04390f3ea37c669493c52d7e55f0c /drivers/tty/serial/bcm63xx_uart.c
parentDocumentation: DT: Add entries for bcm63xx UART (diff)
downloadlinux-1ab8e4b1acdf39ebe6002bbe07ef6e578cff5d74.tar.xz
linux-1ab8e4b1acdf39ebe6002bbe07ef6e578cff5d74.zip
tty: serial: bcm63xx: Enable DT earlycon support
This enables early console output if there is a chosen/stdout-path property referencing a UART node with the "brcm,bcm6345-uart" compatible string. The bootloader sets up the pinmux and baud/parity/etc. Tested on bcm3384 (MIPS, DT). Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/bcm63xx_uart.c')
-rw-r--r--drivers/tty/serial/bcm63xx_uart.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c
index b615af2230aa..109dea711318 100644
--- a/drivers/tty/serial/bcm63xx_uart.c
+++ b/drivers/tty/serial/bcm63xx_uart.c
@@ -782,6 +782,26 @@ static int __init bcm63xx_console_init(void)
console_initcall(bcm63xx_console_init);
+static void bcm_early_write(struct console *con, const char *s, unsigned n)
+{
+ struct earlycon_device *dev = con->data;
+
+ uart_console_write(&dev->port, s, n, bcm_console_putchar);
+ wait_for_xmitr(&dev->port);
+}
+
+static int __init bcm_early_console_setup(struct earlycon_device *device,
+ const char *opt)
+{
+ if (!device->port.membase)
+ return -ENODEV;
+
+ device->con->write = bcm_early_write;
+ return 0;
+}
+
+OF_EARLYCON_DECLARE(bcm63xx_uart, "brcm,bcm6345-uart", bcm_early_console_setup);
+
#define BCM63XX_CONSOLE (&bcm63xx_console)
#else
#define BCM63XX_CONSOLE NULL