[PATCH 2/9] ARM: dts: socfpga: add Enclustra Intel AA1

Lothar Rubusch l.rubusch at gmail.com
Sat Sep 28 00:47:12 CEST 2024


On Fri, Sep 27, 2024 at 1:19 AM Marek Vasut <marex at denx.de> wrote:
>
> On 9/27/24 12:53 AM, Lothar Rubusch wrote:
> > On Thu, Sep 26, 2024 at 3:36 AM Marek Vasut <marex at denx.de> wrote:
> >>
> >> On 9/26/24 12:49 AM, Lothar Rubusch wrote:
> >>
> >> Hi,
> > [...]
> >>> Shall I add the files to my DTS patches and ask for upstreaming of the
> >>> handoff files into the kernel?
> >>
> >> Are the handoff files really used by Linux for anything , or do they
> >> contain various clock/pinmux/DRAM settings only used by U-Boot ? If the
> >> later, place them into U-Boot and include them from -u-boot.dtsi file.
> >
> > Similar to the other socfpga targets, the handoff files are just
> > relevant to u-boot. So, I'll keep them in arch/arm/dts.
>
> Right
>
> > My particular situation then is as follows. The .dts file just
> > includes several .dtsi files. I place this .dts file into
> > arch/arm/dts. The first includes contain the "handoff setup". Then I
> > include adjustments (.dtsi fragments) to the selected base-board and
> > boot-mode. Both  can vary that's why I really would prefer to allow
> > for a Kconfig option on that, in contrary to provide a set of .dts
> > files for all possible combinations.
> >
> > Example:
> > $ cat ./arch/arm/dts/socfpga_arria10_mercury_aa1_pe1_sdmmc-u-boot.dts
>
> Upstream DT named this way into Linux:
>
> socfpga_arria10_mercury_aa1_pe1_sdmmc.dts
>
> And then in U-Boot, implement the extras which include whatever you
> need, name the file:
>
> socfpga_arria10_mercury_aa1_pe1_sdmmc-u-boot.dtsi
>
> The U-Boot build system will combine the two DTs, the build system
> should automatically append matching -u-boot.dtsi content to any .dts file.
>
> I am not sure if this also works if the .dts file is in dts/upstream/*
> while the -u-boot.dtsi is in arch/*/dts/ , but there is now definitely a
> use case for such a setup, it is probably a matter of tweaking the
> Makefiles .
>
> > /dts-v1/;
> > /* will be taken from /arch/arm/dts */
> > #include "socfpga_arria10_mercury_aa1_handoff.h"
> > #include "socfpga_arria10-handoff.dtsi"
> > #include "socfpga_arria10_handoff_u-boot.dtsi"
> >
> > /* will be taken from /dts/upstream */
> > #include "../../../dts/upstream/src/arm/intel/socfpga/socfpga_arria10_mercury_aa1.dtsi"
> > #include "../../../dts/upstream/src/arm/intel/socfpga/socfpga_enclustra_mercury_bootmode_sdmmc.dtsi"
> > #include "../../../dts/upstream/src/arm/intel/socfpga/socfpga_enclustra_mercury_pe1.dtsi"
> >
> > Ideally, now I like to have the first part as default device tree.
> > DEFAULT_DEVICE_TREE=socfpga_arria10_mercury_aa1_pe1_sdmmc-u-boot.dts
> > When doing so, I noticed I cannot enable CONFIG_OF_UPSTREAM anymore,
> > the files in arch/arm/dts won't be found anymore.
> > Then I have the issue how to access the generic .dtsi files used for
> > boot-mode or base board. These files are identical to the kernel DT
> > why I would prefer to use them from dts/upstream. Including them like
> > ../../../../../... works, but... I think there must be a better way.
>
> Look at how the -u-boot.dtsi are automatically added on top of .dts
> files, that might be a start.
>
> > 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?

> > 3.) What would be the best possibility to have a u-boot.dts with
> > handoff setup in arch/arm/dts and append .dtsi files from the general
> > dts/upstream - in case are there other boards are doing something
> > similar?
>
> See above, maybe some of it helps.

Yes. This helped. I can set base-board and boot mode now by Kconfig
option with a generic .dts file. Note, it may still take some time,
since I'd like to test the stuff still a bit on hardware before
submitting something to the list.


More information about the U-Boot mailing list