tty: serial: bcm63xx: Enable DT earlycon support
authorKevin Cernekee <cernekee@gmail.com>
Tue, 21 Oct 2014 22:23:02 +0000 (15:23 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Nov 2014 22:57:24 +0000 (14:57 -0800)
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>
drivers/tty/serial/Kconfig
drivers/tty/serial/bcm63xx_uart.c

index 5210c9f623026dcbe3da4ecbc051a7b9a7bc144f..7088373efc153945acbba9e5277462ba81c2c5ed 100644 (file)
@@ -1297,6 +1297,7 @@ config SERIAL_BCM63XX_CONSOLE
        bool "Console on BCM63xx serial port"
        depends on SERIAL_BCM63XX=y
        select SERIAL_CORE_CONSOLE
+       select SERIAL_EARLYCON
        help
          If you have enabled the serial port on the BCM63xx CPU
          you can make it the console by answering Y to this option.
index b615af2230aace6363328c0a42e12ac6c90435b0..109dea711318b5db0f7ddfda9ca0f1f70ae07582 100644 (file)
@@ -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
This page took 0.025486 seconds and 5 git commands to generate.