Hi Andre, On Mon, 27 Apr 2020 at 12:18, Andre Przywara <andre.przyw...@arm.com> wrote: > > Even though the PL011 UART driver claims to be DM compliant, it does not > really a good job with parsing DT nodes. U-Boot seems to adhere to a > non-standard binding, either requiring to have a "skip-init" property in > the node, or to have an extra "clock" property holding the base > *frequency* value for the baud rate generator. > DTs in the U-Boot tree seem to have been hacked to match this > requirement.
One problem is that we want a 'debug UART' to work before the clock driver is running, so we want to do the *minimum possible* amount of init to get the UART running. So we don't want to start up driver model, clock drivers, etc. I think we should have useful helpers like the 'clock' property to avoid lots of parsing very early in U-Boot. Of course such things are hard for kernel people to understand / agree to but that doesn't make them wrong. > > The official binding does not mention any of these properties, instead > recommends a standard "clocks" property to point to the baud base clock. > > Some boards use simple "fixed-clock" providers, which U-Boot readily > supports, so let's add some simple DM clock code to the PL011 driver to > learn the rate of the first clock, as described by the official binding. > > These clock nodes seem to be not ready very early in the boot process, > so provide a fallback value, by re-using the already existing > CONFIG_PL011_CLOCK variable. > > Signed-off-by: Andre Przywara <andre.przyw...@arm.com> > --- > drivers/serial/serial_pl01x.c | 47 +++++++++++++++++++++++------------ > 1 file changed, 31 insertions(+), 16 deletions(-) Reviewed-by: Simon Glass <s...@chromium.org> > > diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c > index 2a5f256184..14040f32ef 100644 > --- a/drivers/serial/serial_pl01x.c > +++ b/drivers/serial/serial_pl01x.c > @@ -12,6 +12,7 @@ Regards, Simon