* [PATCH v2] tty: serial: atmel: add earlycon support
@ 2022-02-17 9:46 Michael Walle
2022-02-17 9:47 ` Michael Walle
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Michael Walle @ 2022-02-17 9:46 UTC (permalink / raw)
To: Richard Genoud, Greg Kroah-Hartman, Jiri Slaby, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: linux-serial, linux-arm-kernel, linux-kernel, Michael Walle
Add early console support which relies on the bootloader for the
initialization of the UART.
Please note, that the compatibles are taken from at91-usart MFD
driver.
Signed-off-by: Michael Walle <michael@walle.cc>
---
drivers/tty/serial/Kconfig | 1 +
drivers/tty/serial/atmel_serial.c | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 0e5ccb25bdb1..407a98ec0791 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -139,6 +139,7 @@ config SERIAL_ATMEL_CONSOLE
bool "Support for console on AT91 serial port"
depends on SERIAL_ATMEL=y
select SERIAL_CORE_CONSOLE
+ select SERIAL_EARLYCON
help
Say Y here if you wish to use an on-chip UART on a Atmel
AT91 processor as the system console (the system
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 2d09a89974a2..73d43919898d 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -2673,6 +2673,30 @@ static struct console atmel_console = {
.data = &atmel_uart,
};
+static void atmel_serial_early_write(struct console *con, const char *s,
+ unsigned int n)
+{
+ struct earlycon_device *dev = con->data;
+
+ uart_console_write(&dev->port, s, n, atmel_console_putchar);
+}
+
+static int __init atmel_early_console_setup(struct earlycon_device *device,
+ const char *options)
+{
+ if (!device->port.membase)
+ return -ENODEV;
+
+ device->con->write = atmel_serial_early_write;
+
+ return 0;
+}
+
+OF_EARLYCON_DECLARE(atmel_serial, "atmel,at91rm9200-usart",
+ atmel_early_console_setup);
+OF_EARLYCON_DECLARE(atmel_serial, "atmel,at91sam9260-usart",
+ atmel_early_console_setup);
+
#define ATMEL_CONSOLE_DEVICE (&atmel_console)
#else
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v2] tty: serial: atmel: add earlycon support
2022-02-17 9:46 [PATCH v2] tty: serial: atmel: add earlycon support Michael Walle
@ 2022-02-17 9:47 ` Michael Walle
2022-02-17 9:58 ` Claudiu.Beznea
2022-02-17 10:03 ` Richard Genoud
2 siblings, 0 replies; 4+ messages in thread
From: Michael Walle @ 2022-02-17 9:47 UTC (permalink / raw)
To: Richard Genoud, Greg Kroah-Hartman, Jiri Slaby, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: linux-serial, linux-arm-kernel, linux-kernel
Am 2022-02-17 10:46, schrieb Michael Walle:
> Add early console support which relies on the bootloader for the
> initialization of the UART.
> Please note, that the compatibles are taken from at91-usart MFD
> driver.
>
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
Sorry forgot the changelog:
changes since v1:
- add "select SERIAL_EARLYCON"
- rename atmelserial to atmel_serial
-michael
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] tty: serial: atmel: add earlycon support
2022-02-17 9:46 [PATCH v2] tty: serial: atmel: add earlycon support Michael Walle
2022-02-17 9:47 ` Michael Walle
@ 2022-02-17 9:58 ` Claudiu.Beznea
2022-02-17 10:03 ` Richard Genoud
2 siblings, 0 replies; 4+ messages in thread
From: Claudiu.Beznea @ 2022-02-17 9:58 UTC (permalink / raw)
To: michael, richard.genoud, gregkh, jirislaby, Nicolas.Ferre,
alexandre.belloni
Cc: linux-serial, linux-arm-kernel, linux-kernel
On 17.02.2022 11:46, Michael Walle wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> Add early console support which relies on the bootloader for the
> initialization of the UART.
> Please note, that the compatibles are taken from at91-usart MFD
> driver.
>
> Signed-off-by: Michael Walle <michael@walle.cc>
On SAMA7G5:
Tested-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
> ---
> drivers/tty/serial/Kconfig | 1 +
> drivers/tty/serial/atmel_serial.c | 24 ++++++++++++++++++++++++
> 2 files changed, 25 insertions(+)
>
> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> index 0e5ccb25bdb1..407a98ec0791 100644
> --- a/drivers/tty/serial/Kconfig
> +++ b/drivers/tty/serial/Kconfig
> @@ -139,6 +139,7 @@ config SERIAL_ATMEL_CONSOLE
> bool "Support for console on AT91 serial port"
> depends on SERIAL_ATMEL=y
> select SERIAL_CORE_CONSOLE
> + select SERIAL_EARLYCON
> help
> Say Y here if you wish to use an on-chip UART on a Atmel
> AT91 processor as the system console (the system
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index 2d09a89974a2..73d43919898d 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -2673,6 +2673,30 @@ static struct console atmel_console = {
> .data = &atmel_uart,
> };
>
> +static void atmel_serial_early_write(struct console *con, const char *s,
> + unsigned int n)
> +{
> + struct earlycon_device *dev = con->data;
> +
> + uart_console_write(&dev->port, s, n, atmel_console_putchar);
> +}
> +
> +static int __init atmel_early_console_setup(struct earlycon_device *device,
> + const char *options)
> +{
> + if (!device->port.membase)
> + return -ENODEV;
> +
> + device->con->write = atmel_serial_early_write;
> +
> + return 0;
> +}
> +
> +OF_EARLYCON_DECLARE(atmel_serial, "atmel,at91rm9200-usart",
> + atmel_early_console_setup);
> +OF_EARLYCON_DECLARE(atmel_serial, "atmel,at91sam9260-usart",
> + atmel_early_console_setup);
> +
> #define ATMEL_CONSOLE_DEVICE (&atmel_console)
>
> #else
> --
> 2.30.2
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v2] tty: serial: atmel: add earlycon support
2022-02-17 9:46 [PATCH v2] tty: serial: atmel: add earlycon support Michael Walle
2022-02-17 9:47 ` Michael Walle
2022-02-17 9:58 ` Claudiu.Beznea
@ 2022-02-17 10:03 ` Richard Genoud
2 siblings, 0 replies; 4+ messages in thread
From: Richard Genoud @ 2022-02-17 10:03 UTC (permalink / raw)
To: Michael Walle, Greg Kroah-Hartman, Jiri Slaby, Nicolas Ferre,
Alexandre Belloni, Claudiu Beznea
Cc: linux-serial, linux-arm-kernel, linux-kernel
Le 17/02/2022 à 10:46, Michael Walle a écrit :
> Add early console support which relies on the bootloader for the
> initialization of the UART.
> Please note, that the compatibles are taken from at91-usart MFD
> driver.
>
> Signed-off-by: Michael Walle <michael@walle.cc>
Acked-by: Richard Genoud <richard.genoud@gmail.com>
> ---
> drivers/tty/serial/Kconfig | 1 +
> drivers/tty/serial/atmel_serial.c | 24 ++++++++++++++++++++++++
> 2 files changed, 25 insertions(+)
>
> diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
> index 0e5ccb25bdb1..407a98ec0791 100644
> --- a/drivers/tty/serial/Kconfig
> +++ b/drivers/tty/serial/Kconfig
> @@ -139,6 +139,7 @@ config SERIAL_ATMEL_CONSOLE
> bool "Support for console on AT91 serial port"
> depends on SERIAL_ATMEL=y
> select SERIAL_CORE_CONSOLE
> + select SERIAL_EARLYCON
> help
> Say Y here if you wish to use an on-chip UART on a Atmel
> AT91 processor as the system console (the system
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index 2d09a89974a2..73d43919898d 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -2673,6 +2673,30 @@ static struct console atmel_console = {
> .data = &atmel_uart,
> };
>
> +static void atmel_serial_early_write(struct console *con, const char *s,
> + unsigned int n)
> +{
> + struct earlycon_device *dev = con->data;
> +
> + uart_console_write(&dev->port, s, n, atmel_console_putchar);
> +}
> +
> +static int __init atmel_early_console_setup(struct earlycon_device *device,
> + const char *options)
> +{
> + if (!device->port.membase)
> + return -ENODEV;
> +
> + device->con->write = atmel_serial_early_write;
> +
> + return 0;
> +}
> +
> +OF_EARLYCON_DECLARE(atmel_serial, "atmel,at91rm9200-usart",
> + atmel_early_console_setup);
> +OF_EARLYCON_DECLARE(atmel_serial, "atmel,at91sam9260-usart",
> + atmel_early_console_setup);
> +
> #define ATMEL_CONSOLE_DEVICE (&atmel_console)
>
> #else
Thanks !
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-02-17 10:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-17 9:46 [PATCH v2] tty: serial: atmel: add earlycon support Michael Walle
2022-02-17 9:47 ` Michael Walle
2022-02-17 9:58 ` Claudiu.Beznea
2022-02-17 10:03 ` Richard Genoud
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).