
On Sat, 5 Oct 2024 at 07:14, Marek Vasut marex@denx.de wrote:
On 9/29/24 9:19 PM, Lothar Rubusch wrote:
On Sun, Sep 29, 2024 at 6:55 PM Marek Vasut marex@denx.de wrote:
On 9/28/24 12:47 AM, Lothar Rubusch wrote:
[...]
Ideally I like to setup some Kconfig choice for base board selection and one for boot-mode.
1.) In the documentation control.rst I read that the u-boot.dts is combined of several elements. Is there a way to take this base .dts, then add a base board .dtsi by Kconfig option, and similar a boot-mode?
The -u-boot.dtsi is preprocessed by C preprocessor, just like all the other DTs, so you can have a -u-boot.dtsi file which contains C preprocessor conditional statements in it to conditionally include other .dtsi files:
#if IS_ENABLED(...) #include ... #else ... ... #endif
Going through the include list setup by the Makefile made me find my mistake. Currently I may use u-boot specific stuff in arch/arm/dts and include generic .dtsi fragments from dts/upstream. Note: I'm not setting CONFIG_OF_UPSTREAM since I'm using the regular include list which already contains dts/upstream/src/arm/intel. Is this ok? Or, shall I try a different approach, which involves having CONFIG_OF_UPSTREAM explicitely set in the defconfig?
I'm not quite sure I understand the question. Once this platform DTs land in mainline and the DTs get synchronized into U-Boot, you should then set CONFIG_OF_UPSTREAM. Until then, you could patch the DTs into dts/upstream/ to test the result with OF_UPSTREAM enabled .
Ah, sorry. I did not explain well. Currently I patch the DTs which should go to kernel/mainline into my local u-boot: dts/upstream/src/arm/intel/socfpga/ as a preparation for my test builds.
OK
For U-boot I will need to build a devicetree file from archarm/dts. I cannot rely just on the upstream fragments for u-boot. Imagine settings like initial fpga bitstream loading, handoff file setup for initialization, etc. In parts I may use .dtsi files from dts/upstream, though, but most of the u-boot particular devicetree setup will reside in arch/arm/dts, I guess (you may see later in the patches).
You should be able to use dts/upstream/src/arm/intel/socfpga/ with -u-boot.dtsi from arch/arm/dts/ for this purpose, right ?
Yeah that's a possibility. But are there any plans on pushing currently U-Boot specific DT bits to upstream DT (Linux kernel source)?
I noticed when setting the option CONFIG_OF_UPSTREAM in `make menuconfig`, it prepends `dts/upstream/` to the included paths of the devicetree files. The resulting path for the .dts was then dts/upstream/arch/arm/dts/ and could not be found anymore. When I don't activate CONFIG_OF_UPSTREAM, dts/upstream is in the Makefile's include list anyway so that I easily can include from both locations.
+CC Sumit
Yeah that's true it's done on purpose to allow reuse of DT sources includes (.dtsi or header files) even when CONFIG_OF_UPSTREAM isn't enabled.
-Sumit
In conclusion, currently I'm calling a .dts for building the u-boot DT from arch/arm/dts. The file includes upstream stuff as .dtsi fragment from dts/upstream and handoff from local. CONFIG_OF_UPSTREAM does not seem to be necessary in this case.
This approach currently works for me. If you strongly disagree, I may invest more time to find a way (or why there is currently no way) with CONFIG_OF_UPSTREAM.
This was my question about. Anyway you may wait on v3 to understand better in source what I'm doing, or if I'm just messing around.
I'll wait for V3, sure, good luck.
Sorry for the delayed reply.