Skip to content

Commit

Permalink
serial: cadence: Add generic earlycon support
Browse files Browse the repository at this point in the history
Add earlycon support for the cadence serial port.
This is based on recent patches:
"tty/serial: pl011: add generic earlycon support"
(sha1: 0d3c673)
"tty/serial: add arm/arm64 semihosting earlycon"
(sha1: d50d726)

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Michal Simek authored and Greg Kroah-Hartman committed Sep 29, 2014
1 parent a4688bc commit 6fa62fc
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Documentation/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted.

earlycon= [KNL] Output early console device and options.

cdns,<addr>
Start an early, polled-mode console on a cadence serial
port at the specified address. The cadence serial port
must already be setup and configured. Options are not
yet supported.

uart[8250],io,<addr>[,options]
uart[8250],mmio,<addr>[,options]
uart[8250],mmio32,<addr>[,options]
Expand Down
1 change: 1 addition & 0 deletions drivers/tty/serial/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1429,6 +1429,7 @@ config SERIAL_XILINX_PS_UART_CONSOLE
bool "Cadence UART console support"
depends on SERIAL_XILINX_PS_UART=y
select SERIAL_CORE_CONSOLE
select SERIAL_EARLYCON
help
Enable a Cadence UART port to be the system console.

Expand Down
19 changes: 19 additions & 0 deletions drivers/tty/serial/xilinx_uartps.c
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,25 @@ static void cdns_uart_console_putchar(struct uart_port *port, int ch)
cdns_uart_writel(ch, CDNS_UART_FIFO_OFFSET);
}

static void cdns_early_write(struct console *con, const char *s, unsigned n)
{
struct earlycon_device *dev = con->data;

uart_console_write(&dev->port, s, n, cdns_uart_console_putchar);
}

static int __init cdns_early_console_setup(struct earlycon_device *device,
const char *opt)
{
if (!device->port.membase)
return -ENODEV;

device->con->write = cdns_early_write;

return 0;
}
EARLYCON_DECLARE(cdns, cdns_early_console_setup);

/**
* cdns_uart_console_write - perform write operation
* @co: Console handle
Expand Down

0 comments on commit 6fa62fc

Please sign in to comment.