Question regarding CONFIG_SPL_OF_PLATDATA_INST usage
Simon Glass
sjg at chromium.org
Fri Apr 28 01:35:05 CEST 2023
Hi Lukasz,
On Thu, 27 Apr 2023 at 09:23, Lukasz Majewski <lukma at denx.de> wrote:
>
> Hi Simon,
>
> I'm trying to convert imx28 based XEA board to use CONFIG_DM_SERIAL.
> This board uses SPL_OF_PLATDATA to have as small SPL as possible.
>
> It looks like the 'duart' description/driver is properly instantiated,
> but serial console is configured too early -> apparently
> serial_find_console_or_panic() from serial_init() at serial-uclass.c is
> called before DM is setup in SPL.
>
>
> To fix this problem - in the commit (SHA1: 5a1b25c2011) the
> CONFIG_SPL_OF_PLATDATA_INST has been introduced; without it (after
> commit SHA1: 1e9ced28f18ed75bef96df08e47baad27dd51829) uclass_get()
> returns -EDEADLOCK.
That is not the goal of the _INST feature. The goal is to drop the
need for the device_bind() function, thus cutting down the code size
of driver model by about 1KB.
To get DM inited early you can call spl_early_init().
>
>
> Grepping the sources show that only two "boards" use it:
>
> 1. arch/x86/cpu/apollolake/Kconfig -> TPL_OF_PLATDATA_INST
> (configs/chromebook_coral_defconfig and corresponding
> ./arch/x86/dts/chromebook_coral.dts)
>
> 2. configs/sandbox_spl_defconfig -> CONFIG_SPL_OF_PLATDATA_INST=y
>
>
>
> I would like to ask if:
>
> - Anybody managed to use CONFIG_SPL_OF_PLATDATA_INST=y on real HW?
>
> - Is it on purpose, that dtoc tool is not extracting structures
> definitions from *.c files ?
I don't understand that question, sorry. The docs is at [1] but I
suppose you saw that.
>
> - Is the "coral" board (from point 1 above) using any extra
> coral*-u-boot.dtsi to specify which parts of dts shall be included to
> the in-TPL DTS? Or is it just using full-blown DTS support ins TPL?
Yes it is using tags, since we don't want all the devices in TPL. It
only has enough to use serial, SPI flash and some early pinmux stuff.
You can build it and take a look.
>
>
> I'm using cutting-edge mainline u-boot - SHA1:
> 6a11fdf0536e02ac9cd4a3da0535a271c694715f
>
> Thanks in advance for any help.
Regards,
Simon
[1] https://u-boot.readthedocs.io/en/latest/develop/driver-model/of-plat.html?highlight=of-platdata#build-time-instantiation
More information about the U-Boot
mailing list