[PATCH 2/3] earlycon: Print a notice when uartclk is unknown

Raul E Rangel posted 3 patches 2 months, 2 weeks ago
[PATCH 2/3] earlycon: Print a notice when uartclk is unknown
Posted by Raul E Rangel 2 months, 2 weeks ago
When trying to construct an earlycon=uart parameter it's hard to debug
why it's not working.  In my specific case it was because the default
uartclk earlycon assumes doesn't match my hardware. This change adds a
notice so that the user is made aware of that this assumption is being
made. This should hopefully lead to them adding a <uartclk> option to
their earlycon parameter.

Booting with `console=uart,mmio32,0xfedc9000,115200n8`:
[    0.000000] earlycon: uart: Unknown uartclk, assuming 1843200hz
[    0.000000] earlycon: uart0 at MMIO32 0x00000000fedc9000 (options '115200n8')

Signed-off-by: Raul E Rangel <rrangel@chromium.org>

---

 drivers/tty/serial/earlycon.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index ab9af37f6cda35..5a8fe0cb3b1986 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -145,8 +145,12 @@ static int __init register_earlycon(char *buf, const struct earlycon_id *match)
 		buf = NULL;
 
 	spin_lock_init(&port->lock);
-	if (!port->uartclk)
+	if (!port->uartclk) {
 		port->uartclk = BASE_BAUD * 16;
+		if (early_console_dev.baud)
+			pr_notice("%s: Unknown uartclk, assuming %dhz",
+				  match->name, port->uartclk);
+	}
 	if (port->mapbase)
 		port->membase = earlycon_map(port->mapbase, 64);
 
-- 
2.46.0.662.g92d0881bb0-goog
Re: [PATCH 2/3] earlycon: Print a notice when uartclk is unknown
Posted by Petr Mladek 2 months, 2 weeks ago
On Thu 2024-09-12 11:36:20, Raul E Rangel wrote:
> When trying to construct an earlycon=uart parameter it's hard to debug
> why it's not working.  In my specific case it was because the default
> uartclk earlycon assumes doesn't match my hardware. This change adds a
> notice so that the user is made aware of that this assumption is being
> made. This should hopefully lead to them adding a <uartclk> option to
> their earlycon parameter.
> 
> Booting with `console=uart,mmio32,0xfedc9000,115200n8`:
> [    0.000000] earlycon: uart: Unknown uartclk, assuming 1843200hz
> [    0.000000] earlycon: uart0 at MMIO32 0x00000000fedc9000 (options '115200n8')
> 
> Signed-off-by: Raul E Rangel <rrangel@chromium.org>

Looks good to me:

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr
Re: [PATCH 2/3] earlycon: Print a notice when uartclk is unknown
Posted by Greg Kroah-Hartman 2 months, 2 weeks ago
On Thu, Sep 12, 2024 at 11:36:20AM -0600, Raul E Rangel wrote:
> When trying to construct an earlycon=uart parameter it's hard to debug
> why it's not working.  In my specific case it was because the default
> uartclk earlycon assumes doesn't match my hardware. This change adds a
> notice so that the user is made aware of that this assumption is being
> made. This should hopefully lead to them adding a <uartclk> option to
> their earlycon parameter.
> 
> Booting with `console=uart,mmio32,0xfedc9000,115200n8`:
> [    0.000000] earlycon: uart: Unknown uartclk, assuming 1843200hz
> [    0.000000] earlycon: uart0 at MMIO32 0x00000000fedc9000 (options '115200n8')
> 
> Signed-off-by: Raul E Rangel <rrangel@chromium.org>

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>