Re: [PATCH RESEND v2 1/2] serial: earlycon: add uart_clk_freq parameter
From: Markus Probst
Date: Tue Jun 09 2026 - 11:12:37 EST
On Tue, 2026-06-09 at 08:53 +0200, Geert Uytterhoeven wrote:
> Hi Markus,
>
> On Tue, 9 Jun 2026 at 00:40, Markus Probst <markus.probst@xxxxxxxxx> wrote:
> > Add `uart_clk_freq` parameter to `setup_earlycon`. This allows the
> > options string to be reused with `add_preferred_console`, while still
> > allowing to set the uart clock frequency. This will be used in the
> > following commit ("ACPI: SPCR: Support UART clock frequency field").
> >
> > No logical change intended.
> >
> > Signed-off-by: Markus Probst <markus.probst@xxxxxxxxx>
>
> > --- a/drivers/tty/serial/earlycon.c
> > +++ b/drivers/tty/serial/earlycon.c
> > @@ -135,11 +135,14 @@ static int __init parse_options(struct earlycon_device *device, char *options)
> > return 0;
> > }
> >
> > -static int __init register_earlycon(char *buf, const struct earlycon_id *match)
> > +static int __init register_earlycon(char *buf, unsigned int uart_clk_freq,
> > + const struct earlycon_id *match)
> > {
> > int err;
> > struct uart_port *port = &early_console_dev.port;
> >
> > + port->uartclk = uart_clk_freq;
>
> Who is actually consuming this value?
I think primarily init_port in drivers/tty/serial/8250/8250_early.c.
> Earlycon typically works with the serial console, as configured before
> Linux boot by the firmware.
Thats defined in the SPCR table. If "Configured Baud Rate" is set to 0,
it will use it as is [1]. If not, it will configure it.
Thanks
- Markus Probst
[1]https://learn.microsoft.com/en-us/windows-hardware/drivers/bringup/serial-port-console-redirection-table
> The Microsoft doc referenced in patch 2 seem to agree with that:
>
> "On a system where the BIOS or system firmware uses the serial
> port for console input/output, this table should be used to convey
> information about the settings, to ensure a seamless transition
> between the firmware console output and Windows EMS output."
>
> > +
> > /* On parsing error, pass the options buf to the setup function */
> > if (buf && !parse_options(&early_console_dev, buf))
> > buf = NULL;
>
> Gr{oetje,eeting}s,
>
> Geert
Attachment:
signature.asc
Description: This is a digitally signed message part