public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* Question regarding CONFIG_SPL_OF_PLATDATA_INST usage
@ 2023-04-27 15:23 Lukasz Majewski
  2023-04-27 23:35 ` Simon Glass
  0 siblings, 1 reply; 2+ messages in thread
From: Lukasz Majewski @ 2023-04-27 15:23 UTC (permalink / raw)
  To: Simon Glass; +Cc: u-boot, Tom Rini, Fabio Estevam, Stefano Babic

[-- Attachment #1: Type: text/plain, Size: 1707 bytes --]

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.


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 ? 

- 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?


I'm using cutting-edge mainline u-boot - SHA1:
6a11fdf0536e02ac9cd4a3da0535a271c694715f

Thanks in advance for any help.



Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Question regarding CONFIG_SPL_OF_PLATDATA_INST usage
  2023-04-27 15:23 Question regarding CONFIG_SPL_OF_PLATDATA_INST usage Lukasz Majewski
@ 2023-04-27 23:35 ` Simon Glass
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Glass @ 2023-04-27 23:35 UTC (permalink / raw)
  To: Lukasz Majewski; +Cc: u-boot, Tom Rini, Fabio Estevam, Stefano Babic

Hi Lukasz,

On Thu, 27 Apr 2023 at 09:23, Lukasz Majewski <lukma@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-04-27 23:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-27 15:23 Question regarding CONFIG_SPL_OF_PLATDATA_INST usage Lukasz Majewski
2023-04-27 23:35 ` Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox