[U-Boot] [PATCH 1/2] fdt: Allow indicating a node is for U-Boot proper only
Patrick DELAUNAY
patrick.delaunay at st.com
Mon Feb 11 14:34:49 UTC 2019
Hi Marek,
> From: Marek Vasut <marex at denx.de>
> Sent: lundi 11 février 2019 12:58
>
> On 2/11/19 12:56 PM, Patrick DELAUNAY wrote:
> > Hi Marek and Simon
> >
> >> From: Patrick DELAUNAY
> >> Sent: vendredi 8 février 2019 13:47
> >>
> >> 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>
> >>>>>>
> > ...
> >>>> 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
> >
> > FYI: patch sent with http://patchwork.ozlabs.org/patch/1039756/
> >
> >> NB: side effect on the patch, we only need to TAG the children (all
> >> node are bounded in SPL)
> >> That improve the next point.
> >
> > After test, the phandle of the parent node is remove when the tag preloc or spl
> is not present....
> > So the need to tag all the DT tree is not solved.
>
> I'm not sure I quite understand this, but if you reference the leaf node in the
> tree, you should get references to all the parent nodes for free and they cannot
> be removed, right ?
Yes, I think the same before my test,
it is why I indicate this point, even if it not clear.
But I don't known ftdgrep can be used fro this point.
To explain more in details:
I try to remove u-boot,dm-spl for some nodes in ED1/EV1 board :
------------------- arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi -------------------
index 4898483..574b251 100644
@@ -165,14 +165,12 @@
/* SPL part **************************************/
/* MMC1 boot */
&sdmmc1_b4_pins_a {
- u-boot,dm-spl;
pins {
u-boot,dm-spl;
};
};
&sdmmc1_dir_pins_a {
- u-boot,dm-spl;
pins {
u-boot,dm-spl;
};
@@ -184,14 +182,12 @@
/* MMC2 boot */
&sdmmc2_b4_pins_a {
- u-boot,dm-spl;
pins {
u-boot,dm-spl;
};
};
&sdmmc2_d47_pins_a {
- u-boot,dm-spl;
pins {
u-boot,dm-spl;
};
------------------- arch/arm/dts/stm32mp157c-ev1-u-boot.dtsi -------------------
index 30b1734..eab7334 100644
@@ -35,14 +35,12 @@
};
&qspi_clk_pins_a {
- u-boot,dm-spl;
pins {
u-boot,dm-spl;
};
};
&qspi_bk1_pins_a {
- u-boot,dm-spl;
pins1 {
u-boot,dm-spl;
};
@@ -52,7 +50,6 @@
};
&qspi_bk2_pins_a {
- u-boot,dm-spl;
pins1 {
u-boot,dm-spl;
};
The result seems correct for a first look, but in fact some many phandle are missing
and the device becomes invalid :
***************
*** 351,353 ****
qspi-clk-0 {
- phandle = <0x00000013>;
pins {
--- 351,352 ----
***************
*** 360,362 ****
qspi-bk1-0 {
- phandle = <0x00000014>;
pins1 {
--- 359,360 ----
***************
*** 375,377 ****
qspi-bk2-0 {
- phandle = <0x00000015>;
pins1 {
--- 373,374 ----
***************
*** 390,392 ****
sdmmc1-b4 at 0 {
- phandle = <0x00000016>;
pins {
--- 387,388 ----
***************
*** 399,401 ****
sdmmc1-dir at 0 {
- phandle = <0x00000017>;
pins {
--- 395,396 ----
***************
*** 408,410 ****
sdmmc2-b4 at 0 {
- phandle = <0x0000001a>;
pins {
--- 403,404 ----
***************
*** 417,419 ****
sdmmc2-d47 at 0 {
- phandle = <0x0000001b>;
pins {
--- 411,412 ----
I think the fdtgrep correctly adds the supernode (the parent node) but not their properties , it is managed by the code:
FDT_REG_SUPERNODES is used by default in fdtgrep
=> tools/fdtgrep.c:1195: disp.flags = FDT_REG_SUPERNODES; /* Default flags */
But properties are not added except if h_include return true :
=> lib/libfdt/fdt_region.c:513:
if ((flags & FDT_REG_SUPERNODES) && val &&
!p.want)
p.want = WANT_NODES_ONLY;
So to have also properties, I think fdtgrep.c:h_include()
should be change to return 1 for some FDT_IS_PROP case.....
but it should be difficult to know that the chil are include, before to parse them
For example trace in ftdgrep for
sdmmc1-b4 at 0 {
phandle = <0x00000016>;
pins {
pinmux = <0x0000280d 0x00002c0d 0x0000036b 0x0000035b 0x00000002 0x63312d64>;
slew-rate = <0x00000003>;
drive-push-pull;
bias-disable;
};
};
type=1, data=/soc/pin-controller at 50002000/sdmmc2-b4 at 0
- val->type=1, str='/config', match=0
- val->type=1, str='/chosen', match=0
- no match, types_inc=11, types_exc=0, none_match=1f
- checking node 'sdmmc2-b4 at 0'
type=10, data=phandle
- val->type=10, str='u-boot,dm-spl', match=0
- val->type=10, str='u-boot,dm-pre-reloc', match=0
- no match, types_inc=11, types_exc=0, none_match=1f
- returning 0
=> phandle NOT added -----------------------------------------------------
type=1, data=/soc/pin-controller at 50002000/sdmmc2-b4 at 0
- val->type=1, str='/config', match=0
- val->type=1, str='/chosen', match=0
- no match, types_inc=11, types_exc=0, none_match=1f
- checking node 'sdmmc2-b4 at 0'
type=10, data=phandle
- val->type=10, str='u-boot,dm-spl', match=0
- val->type=10, str='u-boot,dm-pre-reloc', match=0
- no match, types_inc=11, types_exc=0, none_match=1f
- returning 0
type=2, data=phandle
- not in any condition
- returning -1
type=1, data=/soc/pin-controller at 50002000/sdmmc2-b4 at 0/pins
- val->type=1, str='/config', match=0
- val->type=1, str='/chosen', match=0
- no match, types_inc=11, types_exc=0, none_match=1f
- checking node 'pins'
type=10, data=pinmux
- val->type=10, str='u-boot,dm-spl', match=0
- val->type=10, str='u-boot,dm-pre-reloc', match=0
- no match, types_inc=11, types_exc=0, none_match=1f
type=10, data=slew-rate
- val->type=10, str='u-boot,dm-spl', match=0
- val->type=10, str='u-boot,dm-pre-reloc', match=0
- no match, types_inc=11, types_exc=0, none_match=1f
type=10, data=drive-push-pull
- val->type=10, str='u-boot,dm-spl', match=0
- val->type=10, str='u-boot,dm-pre-reloc', match=0
- no match, types_inc=11, types_exc=0, none_match=1f
type=10, data=bias-pull-up
- val->type=10, str='u-boot,dm-spl', match=0
- val->type=10, str='u-boot,dm-pre-reloc', match=0
- no match, types_inc=11, types_exc=0, none_match=1f
type=10, data=u-boot,dm-spl
- val->type=10, str='u-boot,dm-spl', match=1
- match inc u-boot,dm-spl
- returning 1
------------ including sub node pins ------------------------------
type=2, data=pinmux
- not in any condition
- returning -1
type=2, data=slew-rate
- not in any condition
- returning -1
type=2, data=drive-push-pull
- not in any condition
- returning -1
type=2, data=bias-pull-up
- not in any condition
- returning -1
type=2, data=u-boot,dm-spl
- not in any condition
- returning -1
------- Next node --------
type=1, data=/soc/pin-controller at 50002000/sdmmc2-d47 at 0
- val->type=1, str='/config', match=0
- val->type=1, str='/chosen', match=0
- no match, types_inc=11, types_exc=0, none_match=1f
- checking node 'sdmmc2-d47 at 0'
> --
> Best regards,
> Marek Vasut
Sorry for the long exmplaination.
Regards
Patrick
More information about the U-Boot
mailing list