Re: [PATCH RESEND v2 1/2] serial: earlycon: add uart_clk_freq parameter

Markus Probst <[email protected]>
Newsgroups org.kernel.vger.linux-m68k,org.kernel.vger.linux-acpi,org.kernel.vger.linux-efi,org.kernel.vger.linux-kernel,org.kernel.vger.linux-mips,org.kernel.vger.linux-serial
Message-ID <[email protected]>
On Tue, 2026-06-09 at 08:53 +0200, Geert Uytterhoeven wrote:
> Hi Markus,
> 
> On Tue, 9 Jun 2026 at 00:40, Markus Probst <[email protected]> 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 <[email protected]>
> 
> > --- 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
signature.asc (application/pgp-signature, 870 B)
-----BEGIN PGP SIGNATURE-----

iQJPBAABCAA5FiEEgnQYxPSsWOdyMMRzNHYf+OetQ9IFAmooKakbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyAAoJEDR2H/jnrUPSTOQP/3lOjjeD4rihyrtDkGdA
vD1xzqthwYFbU2fa+qQ1yTgmbp+z5+h7rcbx8T5S2Y7HkuLbilRDe7Q8SGJocpIg
T9085pQlUhA9lCVY+5s0oXqUp+8rSaUSwXYp+MJH8ZXSwPVdr4kDJoAOs8t+PUt0
i9EGA6/6vW2ccRJwYLaCDxmJowfeQZJJG0cjG5ZWLPj2pOOwbXc3Tm8ZWrtfzADd
sS9irtr/CjlO4L6CBUZ2qEIAT1QylOZTOat/B0Xw0VmupSK0ib31FfEzZsxOoCnR
0Dx16p95q+DMLIKa7zgAhrUyvrJjxI2pDpALJfXrbwhjMbjhB+d6lIfL0kEJF8F3
JJg5y5X9ixNdfWomlDFFn6IyLzcuTqrymCLcW14h/lIuGlAv4CDg3OS/i4T+wBW+
raRTVeakyeBUxxwS499UN0EmcFuxI6CuYiEd9it6kbBJU/4w4mfsbB5Lr2eoWh3m
OSuACvoFlS84V3+SQbbziaTFRo+eLtyNfHHpKNM4d2n2Pdn5tWdoXKkoGacl5hhJ
maQmavGZGDX2pWcpdmoB8fDys9gHkhVdMPUPWSdA8KQ3YG01u2gF98UeClteWJOW
tWr4TpLpsrH/5rzFgz4usuMXaetG7wyeMdjVq+7LjG1pGjbeEifYux73o2CxjPkg
6DHab0pVROd5cS1MZIXwtSA/
=g1gl
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.