From: Andre Przywara Date: Tue, 28 Jan 2020 17:29:14 +0000 Subject: [PATCH] dtc: add ability to make nodes conditional on them being referenced In-Reply-To: References: <20200121102317.82798-1-andre.przywara@arm.com> <20200125162028.GY26536@bill-the-cat> <2d5296d9-1617-24e2-d2dd-0cc2020215c5@arm.com> Message-ID: <20200128172914.2c0fb4e9@donnerap.cambridge.arm.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: u-boot@lists.denx.de On Tue, 28 Jan 2020 10:07:18 -0700 Simon Glass wrote: Hi Simon, > On Sat, 25 Jan 2020 at 16:18, Andr=C3=A9 Przywara wrote: > > > > On 25/01/2020 16:20, Tom Rini wrote: > > > > Hi Tom, > > > > thanks for having a look! > > > > =20 > > > On Tue, Jan 21, 2020 at 10:23:17AM +0000, Andre Przywara wrote: > > > =20 > > >> From: Maxime Ripard > > >> > > >> This is needed when importing mainline DTs into U-Boot, as some star= ted > > >> using this /omit-if-no-ref/ tag, so won't compile with U-Boot's curr= ent > > >> dtc copy. This is just a cherry-pick of the patch introducing this > > >> feature. > > >> Original commit message from Maxime: > > >> ------------------ > > >> A number of platforms have a need to reduce the number of DT nodes, > > >> mostly because of two similar constraints: the size of the DT blob, = and > > >> the time it takes to parse it. > > >> > > >> As the DT is used in more and more SoCs, and by more projects, some > > >> constraints start to appear in bootloaders running from SRAM with an > > >> order of magnitude of 10kB. A typical DT is in the same order of > > >> magnitude, so any effort to reduce the blob size is welcome in such = an > > >> environment. > > >> > > >> Some platforms also want to reach very fast boot time, and the time = it > > >> takes to parse a typical DT starts to be noticeable. > > >> > > >> Both of these issues can be mitigated by reducing the number of node= s in > > >> the DT. The biggest provider of nodes is usually the pin controller = and > > >> its subnodes, usually one for each valid pin configuration in a given > > >> SoC. > > >> > > >> Obviously, a single, fixed, set of these nodes will be used by a giv= en > > >> board, so we can introduce a node property that will tell the DT > > >> compiler to drop the nodes when they are not referenced in the tree,= and > > >> as such wouldn't be useful in the targetted system. > > >> > > >> Signed-off-by: Maxime Ripard > > >> Reviewed-by: Rob Herring > > >> Signed-off-by: Andre Przywara > > >> --- > > >> scripts/dtc/checks.c | 13 +++++++++++++ > > >> scripts/dtc/dtc-lexer.l | 7 +++++++ > > >> scripts/dtc/dtc-parser.y | 17 +++++++++++++++++ > > >> scripts/dtc/dtc.h | 4 ++++ > > >> scripts/dtc/livetree.c | 14 ++++++++++++++ > > >> 5 files changed, 55 insertions(+) =20 >=20 > Reviewed-by: Simon Glass Thanks! >=20 > Is this for SPL or U-Boot proper? I don't think either of those was the original target here, as this showed = up in the Linux tree first. If you need an answer to your question: it would actually be U-Boot proper,= as it originates from Maxime's work on some Allwinner A20 devices - and we= don't use DT in the SPL on sunxi. > I assume the former since you talk about SRAM. I think the idea was to provide a generic solution for some specific proble= m. The observation was that the .dtb is growing with all those pinmux nodes= , also reportedly boot time increased because of the parsing efforts. So short of hacking/trimming the DT manually, this tag was introduced, to a= ddress the issue in a generic way. > But changing dtc won't affect SPL at present, since the DT > is not separately compiled for SPL. Of course if nodes are not needed > for U-Boot proper, removing them is good and may have SPL too. But we > use dtoc to drop unwanted nodes (as you probably know), and U-Boot has > its own tags for indicating what nodes should be present (since > everything is omitted from SPL by default). Understood. As mentioned, sunxi doesn't even use the DT at all in the SPL. The reason I posted this patch is simply that some mainline Linux .dts file= s carry this tag now, and without U-Boot's dtc understanding it, those DTs = fail to build. So for the sake of copying .dts files verbatim from the kernel tree, we nee= d dtc support for this tag. Cheers, Andre.