tty: serial: meson: Add earlycon support
PATCH 1/1 tty: serial: meson: Add earlycon support
Signed-off-by Nicolas Saenz Julienne <[email protected]>
--- Documentation/kernel-parameters.txt | 6 ++++++ drivers/tty/serial/meson_uart.c | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+)
Documentation/kernel-parameters.txt +6 -0
@@ -1025,6 +1025,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted. the driver will use only 32-bit accessors to read/write the device registers. + meson,<addr> + Start an early, polled-mode console on an meson serial + port at the specified address. The serial port + must already be setup and configured. Options are not + yet supported. + msm_serial,<addr> Start an early, polled-mode console on an msm serial port at the specified address. The serial port
drivers/tty/serial/meson_uart.c +22 -0
@@ -548,6 +548,28 @@ static int __init meson_serial_console_init(void) }console_initcall (meson_serial_console_init); +static void meson_early_console_write (struct console *con,const char *s, +unsigned n) +{ +struct earlycon_device *dev = con->data; + +uart_console_write (&dev->port, s, n, meson_console_putchar); +} + +static int __init meson_early_console_setup (struct earlycon_device *device, +const char *opt) +{ +if (!device->port.membase) +return -ENODEV ; + + device->con->write = meson_early_console_write; +return 0 ; +} + +EARLYCON_DECLARE (meson, meson_early_console_setup); +OF_EARLYCON_DECLARE (meson,"amlogic,meson-uart" , + meson_early_console_setup); +#define MESON_SERIAL_CONSOLE (&meson_serial_console)#else #define MESON_SERIAL_CONSOLE NULL
Signature · 1 line
2.5.0
Hi Nicolas,
Quoted 28 lines · Nicolas Saenz Julienne
Signed-off-by Nicolas Saenz Julienne <[email protected]>--- Documentation/kernel-parameters.txt | 6 ++++++ drivers/tty/serial/meson_uart.c | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+)Documentation/kernel-parameters.txt +6
-0@@ -1025,6 +1025,12 @@ bytes respectively. Such letter suffixes can also be entirely omitted. the driver will use only 32-bit accessors to read/write the device registers. + meson,<addr> + Start an early, polled-mode console on an meson serial + port at the specified address. The serial port + must already be setup and configured. Options are not + yet supported. + msm_serial,<addr> Start an early, polled-mode console on an msm serial port at the specified address. The serial portdrivers/tty/serial/meson_uart.c +0
-0
drivers/tty/serial/meson_uart.c static int __init meson_serial_console_init(void) · line 552
Quoted 5 lines
drivers/tty/serial/meson_uart.c +2
-0@@ -548,6 +548,28 @@ static int __init meson_serial_console_init(void) }console_initcall (meson_serial_console_init); +static void meson_early_console_write (struct console *con,const char *s, +unsigned n)
^^^^^^^^
I don't really care, but it's customary to use 'unsigned int'.
Quoted 10 lines
drivers/tty/serial/meson_uart.c +10
-0+{ +struct earlycon_device *dev = con->data; + +uart_console_write (&dev->port, s, n, meson_console_putchar); +} + +static int __init meson_early_console_setup (struct earlycon_device *device, +const char *opt) +{ +if (!device->port.membase)
drivers/tty/serial/meson_uart.c static int __init meson_serial_console_init(void) · line 572
Quoted 10 lines
drivers/tty/serial/meson_uart.c +10
-0+return -ENODEV ; + + device->con->write = meson_early_console_write; +return 0 ; +} + +EARLYCON_DECLARE (meson, meson_early_console_setup); +OF_EARLYCON_DECLARE (meson,"amlogic,meson-uart" , + meson_early_console_setup); +
With today's linux-next (or Greg's tty-next tree), it is no longer necessary to declare separate earlycon's when you want both; OF_EARLYCON_DECLARE() declares both a devicetree-enabled earlycon and automatically provides for a command line earlycon of the same name.
Regards,
Peter Hurley
Quoted 4 lines
drivers/tty/serial/meson_uart.c +0
-0#define MESON_SERIAL_CONSOLE (&meson_serial_console)#else #define MESON_SERIAL_CONSOLE NULL