On Fri, Oct 20, 2017 at 08:37:26AM -0500, Rob Herring wrote: > On Fri, Oct 20, 2017 at 4:55 AM, Alexandre Torgue > <alexandre.torgue@xxxxxx> wrote: > > Hi Frank, > > > > > > On 10/19/2017 08:46 PM, Frank Rowand wrote: > >> On 10/19/17 07:59, Rob Herring wrote: > >>> On Thu, Oct 19, 2017 at 9:00 AM, Alexandre Torgue > >>> <alexandre.torgue@xxxxxx> wrote: > >>>> > >>>> Hi Rob, > >>>> > >>>> > >>>> On 10/19/2017 01:53 AM, Rob Herring wrote: > >>>>> On Wed, Oct 18, 2017 at 6:28 PM, Andrew Turner <andrew@xxxxxxxxxxxxx> > >>>>> wrote: > >>> > >>> > >>> [...] > > >>>> -->For example, I want to use the same dtsi files between Linux > >>>> and > >>>> U-boot. If in u-boot dts file I overload several "status" entry by > >>>> "disabled", is it possible that compiler doesn't build it ? And what > >>>> about > >>>> not used phandle ? > >>> > >>> > >>> You certainly could remove disabled nodes in dtc. I'm not sure how > >>> hard it would be to plumb into dtc. I think phandle properties are > >>> already only created if there's a reference to them. If that is > >> > >> > >> Yes, phandles are only created if referenced, unless compiled > >> for loading overlays into: > >> > > > > Are there DTC "extra" options to use to not build those useless phandles ? I > > just tried to revert the dtb to dts (using following command: > > ./scripts/dtc/dtc -I dtb -O dts -o stm32f469-disco-flat.dts > > arch/arm/boot/dts/stm32f469-disco.dtb) > > > > I see that phandles not used are in the dts output file. It is especially an > > issue for pinmux phandles. All pinmux groups possibilities are written > > inside (in my case) stm32f4-pinctrl.dtsi. This file is included in each > > stm32 board dts files, and in those stm32 board dts files only required node > > are enabled. But I see that all pinmux definitions are embedded inside dtb > > binary (even ones not used in board dts file). > > Ah, you mean removing nodes without a phandle reference, not phandles > themselves. > > There's no way dtc could do that because no reference doesn't equate > to unused. For example, there's no phandle reference to the /memory > node, but that is for sure needed. We would have to add some > annotation to nodes that could be removed if unused. This could be > some source annotation (/delete-if-unused/), some extension to status > property, or some new property. > > Another option would be just mark all those nodes disabled and then > postprocess the dtb to mark them okay if they have a phandle property > and delete the node if not. I'd be happy enough to merge a patch to dtc which added an option to strip disabled nodes. It's also pretty easy to do using libfdt (see fdt_next_node() and fdt_del_node()). -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Attachment:
signature.asc
Description: PGP signature