diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 10d51c2f10d712b179f5e6f67d0b9032bb42b75c..adc1cd7c3bc7a2a1c4c2d362ce9286b30f3030a4 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -921,6 +921,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted. earlycon= [KNL] Output early console device and options. + cdns, + 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,[,options] uart[8250],mmio,[,options] uart[8250],mmio32,[,options] diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 81f6ee7d42238583b1be1babd26d1660224c9f4a..02a896f4dbcddccb4df50c9242d2b968a34e1063 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -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. diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 7f8027f27ab9c727c11b03901083681a0a92fb78..200c1af2141bb11b1f13442b1e311622df641188 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -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