Skip to content

Commit

Permalink
tty: serial: bcm63xx: Enable DT earlycon support
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kevin Cernekee authored and Greg Kroah-Hartman committed Nov 6, 2014
1 parent e1a184e commit 1ab8e4b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/tty/serial/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
20 changes: 20 additions & 0 deletions drivers/tty/serial/bcm63xx_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1ab8e4b

Please sign in to comment.