[U-Boot] [PATCH 1/2] fdt: Allow indicating a node is for U-Boot proper only
Patrick DELAUNAY
patrick.delaunay at st.com
Fri Feb 8 12:47:19 UTC 2019
Hi Marek,
> From: Marek Vasut <marex at denx.de>
> Sent: jeudi 7 février 2019 18:48
>
> On 2/7/19 6:40 PM, Patrick DELAUNAY wrote:
> > Hi Marek,
> >
> >> From: Marek Vasut <marex at denx.de>
> >> Sent: mardi 5 février 2019 09:55
> >>
> >> On 2/4/19 3:40 PM, Simon Glass wrote:
> >>> On Mon, 4 Feb 2019 at 03:15, Patrick Delaunay
> >>> <patrick.delaunay at st.com>
> >> wrote:
> >>>>
> >>>> This add missing parts for previous commit 06f94461a9f4
> >>>> ("fdt: Allow indicating a node is for U-Boot proper only")
> >>>>
> >>>> At present it is not possible to specify that a node should be used
> >>>> before relocation (in U-Boot proper) without it also ending up in
> >>>> SPL and TPL device trees. Add a new "u-boot,dm-pre-proper" boolean
> >>>> property
> >> for this.
> >>>>
> >>>>
> >>>> Signed-off-by: Patrick Delaunay <patrick.delaunay at st.com>
> >>>
> >>> Reviewed-by: Simon Glass <sjg at chromium.org>
> >>>
> >>> There was discussion some time ago about using a property instead:
> >>>
> >>> chosen {
> >>> u-boot,dm-spl = <&node1 &node2>;
> >>> u-boot,dm-tpl = <&node1>;
> >>> };
> >>>
> >>> At the time I decided that this was more painful since it separates
> >>> out the tag from its node.
> >>>
> >>> I wonder if that is still true? We do now in fact generally use a
> >>> u-boot.dtsi file to hold these tags.
> >>>
> >>> I'm not suggesting a change, just raising the question.
> >>
> >> It's a good suggestion. In fact, you can then use some tool to walk
> >> back up the tree and only retain the branches which are referenced by
> >> phandle from u- boot,dm-spl/tpl node for U-Boot SPL/TPL DTs. I think
> >> that could save a bit of space too. I wonder if we can even use /omit-if-no-
> ref/ DTC syntax somehow.
> >
> > If I correctly understood the new feature of dtc "/omit-if-no-ref/",
> > in kernel dtc since 4.18, dtc remove node when nobody use reference on
> > this node, so it is useful for U-Boot nodes when they are used as reference :
> for example pincontrol nodes.
> > cf: https://elinux.org/Device_Tree_Source_Undocumented
> >
> > U-Boot dtb use dtc to compile dts files , so it can be used here.
> >
> > But for SPL / TPL the parsing in done in fdtgrep, on dtb And the tags
> > "/omit-if-no-ref/" are already removed in dtb.
>
> Maybe we need feature which is similar, not the same.
>
Ok.
I take some time to check how the "omit is no ref" is done in dtc and fdtgrep manage the dtb.
And I think a similar feature (count the number of reference for the resulting dtb)
are difficult to do in ftdgrep, and so in SPL because dtc replace the reference by phandle in DTB.
ftdgrep can know if one node have phandle= referenced at least one time ... in U-boot device tree.
But how know is referenced (directly or inderclty , for pincotnrol fro exemple)
For example
ddr at 0x5A003000 {
u-boot,dm-pre-reloc;
compatible = "st,stm32mp1-ddr";
reg = <0x5a003000 0x00000550 0x5a004000 0x00000234>;
clocks = <0x00000002 0x000000e4 0x00000002 0x000000dc 0x00000002 0x000000de 0x00000002 0x000000e0 0x00000002 0x000000e2 0x00000002 0x000000e5>;
PHDANDLE PHANDLE PHANDLE
> > NB: we could also remove the tags u-boot,dm-pre-reloc/u-boot,dm-spl : we
> can gain place in spl dtb
> > These tags are not needed as binding is mandatory in SPL build for ALL
> node present in SPL device tree
> > others node are cleaned by fdtgrep (but impact in SPL code)
Finally I will sent a patch for this proposal (today I hope)
=> On my board stm32mp1-ev1, the SPL device tree is reduced by 790 bytes
NB: side effect on the patch, we only need to TAG the children (all node are bounded in SPL)
That improve the next point.
> > PS: a other boring point: if we need to tag all the tree to have one sub-node in
> SPL
> > For me spl tag on the children should be enough ...
>
> Indeed, referencing the child node with a phandle from some chosen node
> would be much better than adding u-boot,dm-... throughout the tree.
PS: We can use the option -e of fdtgrep ...
but with side effect (some unwanted node can be added)
Example SPL should be see only the first flash on SPI controller, not need to see the second one.
> > But is perhaps difficult in ftdgrep (need to parse all the
> > fathers node)
> >
> > For example to have pins1 and pins2,
> > we have to also tag qspi-bk2-0 and pin-controller
> >
> > pin-controller at 50002000 {
> > u-boot,dm-pre-reloc;
> > qspi-bk2-0 {
> > u-boot,dm-spl;
> > pins1 {
> > u-boot,dm-spl;
> > };
> > pins2 {
> > u-boot,dm-spl;
> > };
> > };
> > };
>
> I still like using the phandle better than the u-boot,dm-spl all over the place.
I agree that it is a way for SPL improvement.
But still difficult : need to reference all the needed node (including pincontrol ones)
and need to add this reference (when then don't exist yet in kernel DT)
for example, you need to have
chosen {
u-boot,dm-spl = <&node1 &node2
&{/soc/pin-controller at 0 /pin1_a/pins}
&{/soc/pin-controller at 0 /pin2_a/pins1} &{/soc/pin-controller at 0 /pin2_a/pins2} >;
u-boot,dm-tpl = <&node1 &{/soc/pin-controller at 0 /pin1_a/pins}>;
};
Kernel device tree is :
soc {
node1: ip at 0 {
pinctrl-names = "default", "sleep", "standby";
pinctrl-0 = <&pin1_a &pin1_b &pin1_c >;
}
node2: ip at 0 {
pinctrl-names = "default", "sleep", "standby";
pinctrl-0 = <&pin2_a &pin2_b &pin2_c>;
}
pinctrl: pin-controller at 0 {
pin1_a: node1-0 {
pins {
....
};
};
pin1_b: node1-1 {
pins1 {
....
};
pins2 {
....
};
};
pin1_c: node1-2 {
pins1 {
....
};
pins1 {
....
};
};
pint2_a: node2-0 {
pins1 {
....
};
pins1 {
....
};
};
pin2_b: node2-1 {
pins1 {
....
};
pins1 {
....
};
};
pin2_c: node2-2 {
pins1 {
....
};
pins1 {
....
};
};
Today I prefer the current way (kernel device tree in <board>.dts and added when necessary tag can be done in <board>-u-boot.dtsi),
because we can use include (for commun feature for several boards)
see for example ./arch/arm/dts/stm32mp157-u-boot.dtsi
>
> --
> Best regards,
> Marek Vasut
Regards
Patrick
More information about the U-Boot
mailing list