* [PATCH] tty: serial: atmel: add earlycon support
@ 2022-02-16 16:18 Michael Walle
2022-02-17 9:12 ` Claudiu.Beznea
0 siblings, 1 reply; 3+ messages in thread
From: Michael Walle @ 2022-02-16 16:18 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/atmel_serial.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 2d09a89974a2..50fc6d51ff0d 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(atmelserial, "atmel,at91rm9200-usart",
+ atmel_early_console_setup);
+OF_EARLYCON_DECLARE(atmelserial, "atmel,at91sam9260-usart",
+ atmel_early_console_setup);
+
#define ATMEL_CONSOLE_DEVICE (&atmel_console)
#else
--
2.30.2
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] tty: serial: atmel: add earlycon support
2022-02-16 16:18 [PATCH] tty: serial: atmel: add earlycon support Michael Walle
@ 2022-02-17 9:12 ` Claudiu.Beznea
2022-02-17 9:28 ` Michael Walle
0 siblings, 1 reply; 3+ messages in thread
From: Claudiu.Beznea @ 2022-02-17 9:12 UTC (permalink / raw)
To: michael, richard.genoud, gregkh, jirislaby, Nicolas.Ferre,
alexandre.belloni
Cc: linux-serial, linux-arm-kernel, linux-kernel
Hi Micheal,
On 16.02.2022 18:18, 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>
> ---
> drivers/tty/serial/atmel_serial.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index 2d09a89974a2..50fc6d51ff0d 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(atmelserial, "atmel,at91rm9200-usart",
> + atmel_early_console_setup);
> +OF_EARLYCON_DECLARE(atmelserial, "atmel,at91sam9260-usart",
For consistency with the rest of the naming in this file could you name it
atmel_serial?
Also, it would be good to select SERIAL_EARLYCON in Kconfig to have it
available also for production w/o changing defconfigs.
Thank you,
Claudiu Beznea
> + atmel_early_console_setup);
> +
> #define ATMEL_CONSOLE_DEVICE (&atmel_console)
>
> #else
> --
> 2.30.2
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] tty: serial: atmel: add earlycon support
2022-02-17 9:12 ` Claudiu.Beznea
@ 2022-02-17 9:28 ` Michael Walle
0 siblings, 0 replies; 3+ messages in thread
From: Michael Walle @ 2022-02-17 9:28 UTC (permalink / raw)
To: Claudiu.Beznea
Cc: richard.genoud, gregkh, jirislaby, Nicolas.Ferre,
alexandre.belloni, linux-serial, linux-arm-kernel, linux-kernel
Hi,
Am 2022-02-17 10:12, schrieb Claudiu.Beznea@microchip.com:
> On 16.02.2022 18:18, 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>
>> ---
>> drivers/tty/serial/atmel_serial.c | 24 ++++++++++++++++++++++++
>> 1 file changed, 24 insertions(+)
>>
>> diff --git a/drivers/tty/serial/atmel_serial.c
>> b/drivers/tty/serial/atmel_serial.c
>> index 2d09a89974a2..50fc6d51ff0d 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(atmelserial, "atmel,at91rm9200-usart",
>> + atmel_early_console_setup);
>> +OF_EARLYCON_DECLARE(atmelserial, "atmel,at91sam9260-usart",
>
>
> For consistency with the rest of the naming in this file could you name
> it
> atmel_serial?
Sure, I don't have an opinion on that. It's done both ways:
omap-serial.c:OF_EARLYCON_DECLARE(omapserial, "ti,omap2-uart",
early_omap_serial_setup);
bcm63xx_uart.c:OF_EARLYCON_DECLARE(bcm63xx_uart, "brcm,bcm6345-uart",
bcm_early_console_setup);
...
> Also, it would be good to select SERIAL_EARLYCON in Kconfig to have it
> available also for production w/o changing defconfigs.
Ahh, missed that these are enabled for all the other Kconfig symbols.
Will add it to SERIAL_ATMEL_CONSOLE.
-michael
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-17 9:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16 16:18 [PATCH] tty: serial: atmel: add earlycon support Michael Walle
2022-02-17 9:12 ` Claudiu.Beznea
2022-02-17 9:28 ` Michael Walle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®