aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorKevin Cernekee <cernekee@gmail.com>2014-10-21 18:23:02 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-06 17:57:24 -0500
commit1ab8e4b1acdf39ebe6002bbe07ef6e578cff5d74 (patch)
treec6e8ae09bee04390f3ea37c669493c52d7e55f0c /drivers/tty/serial
parente1a184eea9bcab00faa5943292d049bc30f8cd09 (diff)
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')
-rw-r--r--drivers/tty/serial/Kconfig1
-rw-r--r--drivers/tty/serial/bcm63xx_uart.c20
2 files changed, 21 insertions, 0 deletions
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 5210c9f62302..7088373efc15 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1297,6 +1297,7 @@ config SERIAL_BCM63XX_CONSOLE
1297 bool "Console on BCM63xx serial port" 1297 bool "Console on BCM63xx serial port"
1298 depends on SERIAL_BCM63XX=y 1298 depends on SERIAL_BCM63XX=y
1299 select SERIAL_CORE_CONSOLE 1299 select SERIAL_CORE_CONSOLE
1300 select SERIAL_EARLYCON
1300 help 1301 help
1301 If you have enabled the serial port on the BCM63xx CPU 1302 If you have enabled the serial port on the BCM63xx CPU
1302 you can make it the console by answering Y to this option. 1303 you can make it the console by answering Y to this option.
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)
782 782
783console_initcall(bcm63xx_console_init); 783console_initcall(bcm63xx_console_init);
784 784
785static void bcm_early_write(struct console *con, const char *s, unsigned n)
786{
787 struct earlycon_device *dev = con->data;
788
789 uart_console_write(&dev->port, s, n, bcm_console_putchar);
790 wait_for_xmitr(&dev->port);
791}
792
793static int __init bcm_early_console_setup(struct earlycon_device *device,
794 const char *opt)
795{
796 if (!device->port.membase)
797 return -ENODEV;
798
799 device->con->write = bcm_early_write;
800 return 0;
801}
802
803OF_EARLYCON_DECLARE(bcm63xx_uart, "brcm,bcm6345-uart", bcm_early_console_setup);
804
785#define BCM63XX_CONSOLE (&bcm63xx_console) 805#define BCM63XX_CONSOLE (&bcm63xx_console)
786#else 806#else
787#define BCM63XX_CONSOLE NULL 807#define BCM63XX_CONSOLE NULL