Re: [PATCH] earlycon: initialise baud field of earlycon device structure

From: Eugeniy Paltsev
Date: Wed Aug 16 2017 - 07:52:53 EST


Hi Rob,

On Tue, 2017-08-15 at 14:26 -0500, Rob Herring wrote:
> On Tue, Aug 15, 2017 at 12:21 PM, Eugeniy Paltsev
> <Eugeniy.Paltsev@xxxxxxxxxxxx> wrote:
> > [snip]
> > @@ -282,7 +283,15 @@ int __init of_setup_earlycon(const struct
> > earlycon_id *match,
> >ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ}
> >ÂÂÂÂÂÂÂÂÂ}
>
> > +ÂÂÂÂÂÂÂval = of_get_flat_dt_prop(node, "baud", NULL);
>Â
> No, we already have a defined way to set the baud, we don't need a
> property in addition. Plus you didn't document it.

I guess by defined way to set the baud you mean setting baud after
device alias
in stdout-path property (like stdout-path = "serial:115200n8"), right?

The idea was to reuse "baud" property from serial node to set the
earlycon baud:

chosen {
ÂÂÂÂ...
ÂÂÂÂstdout-path = &serial;
};

serial: uart@... {
ÂÂÂÂ...
ÂÂÂÂbaud = <115200>; /* Get baud from here */
};

> > +ÂÂÂÂÂÂÂif (val)
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂearly_console_dev.baud = be32_to_cpu(*val);
> > +
> >ÂÂÂÂÂÂÂÂÂif (options) {
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂerr = kstrtoul(options, 10, &baud);
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂif (!err)
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂearly_console_dev.baud = baud;
>Â
> This seems fine to do here, but then we should also parse the other
> standard options here too. And we should make sure we're not doing it
> twice.
I added only baud parsing here because we parse only baud from standard
options
when register_earlycon is used. (see parse_options function which is
called
from register_earlycon)

But I can add other standard options parsing here (probably using
uart_parse_options + uart_set_options).Â
What do you think?

> > +
> >ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂstrlcpy(early_console_dev.options, options,
> >ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂsizeof(early_console_dev.options));
> >ÂÂÂÂÂÂÂÂÂ}
> > --
> > 2.9.3
--Â
ÂEugeniy Paltsev