Re: [PATCH v3 09/13] serial: sh-sci: Introduced sci_of_data

From: Geert Uytterhoeven
Date: Thu Mar 06 2025 - 05:17:32 EST


Hi Thierry,

On Wed, 26 Feb 2025 at 14:10, Thierry Bultel
<thierry.bultel.yh@xxxxxxxxxxxxxx> wrote:
> The aim here is to provide an easier support to more different SCI
> controllers, like the RZ/T2H one.
>
> The existing .data field of_sci_match is changed to a structure containing
> all what that can be statically initialized, and avoid a call to
> 'sci_probe_regmap', in both 'sci_init_single', and 'early_console_setup'.
>
> 'sci_probe_regmap' is now assumed to be called in the only case where the
> device description is from a board file instead of a dts.
>
> In this way, there is no need to patch 'sci_probe_regmap' for adding new
> SCI type, and also, the specific sci_port_params for a new SCI type can be
> provided by an external file.
>
> Signed-off-by: Thierry Bultel <thierry.bultel.yh@xxxxxxxxxxxxxx>
> Reviewed-by: Paul Barker <paul.barker.ct@xxxxxxxxxxxxxx>

Thanks for your patch!

> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -3250,12 +3247,17 @@ static struct console early_serial_console = {
> static int sci_probe_earlyprintk(struct platform_device *pdev)
> {
> const struct plat_sci_port *cfg = dev_get_platdata(&pdev->dev);
> + struct sci_port *sp = pdev->id;

"sp = &sci_ports[pdev->id]" makes it going again on QEMU RTS7751R2D.

>
> if (early_serial_console.data)
> return -EEXIST;
>
> early_serial_console.index = pdev->id;
>
> + sp->params = sci_probe_regmap(cfg, sp);
> + if (!sp->params)
> + return -ENODEV;
> +
> sci_init_single(pdev, &sci_ports[pdev->id], pdev->id, cfg, true);

Here you can reuse sp.

>
> if (!strstr(early_serial_buf, "keep"))

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds