fdt: Allow indicating a node is for U-Boot proper only
PATCH 1/2 fdt: Allow indicating a node is for U-Boot proper only
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.
---
Hi,
I create this patch, after testing the new key "u-boot,dm-pre-proper" for ltdc VIDEO driver on stm32mp1 board. I try to replace the previous used "u-boot,dm-pre-reloc".
/* pre-reloc probe = reserve video frame buffer in video_reserve() */
<dc {
- u-boot,dm-pre-reloc;
+ u-boot,dm-pre-proper;
};
And it is failing.
NB: preloc support is only needed in video uclass to reserved
the frame buffer(called by board_f), so the node for video u-class driver is only used in U-BOOT pre-relocation and not in SPL.
After a grep in code, I see that the initial patch don't add the support of the new "u-boot,dm-pre-proper" in all location where "u-boot,dm-pre-reloc" was tested.
When I add the needed test in util.c, it is working.
drivers/core/util.c | 4 ++++ drivers/video/video-uclass.c | 4 +++- include/dm/ofnode.h | 6 ++++-- include/dm/util.h | 12 ++++++++---- 4 files changed, 19 insertions(+), 7 deletions(-)
drivers/core/util.c +4 -0
@@ -35,6 +35,8 @@ bool dm_fdt_pre_reloc(const void *blob, int offset) {if (fdt_getprop (blob, offset,"u-boot,dm-pre-reloc" ,NULL ))return true; +if (fdt_getprop (blob, offset,"u-boot,dm-pre-proper" ,NULL )) +return true;#ifdef CONFIG_TPL_BUILD if (fdt_getprop (blob, offset,"u-boot,dm-tpl" ,NULL ))
@@ -59,6 +61,8 @@ bool dm_ofnode_pre_reloc(ofnode node) {if (ofnode_read_bool (node,"u-boot,dm-pre-reloc" ))return true; +if (ofnode_read_bool (node,"u-boot,dm-pre-proper" )) +return true;#ifdef CONFIG_TPL_BUILD if (ofnode_read_bool (node,"u-boot,dm-tpl" ))
drivers/video/video-uclass.c +3 -1
@@ -290,7 +290,9 @@ static int video_post_bind(struct udevice *dev)return 0 ; size =alloc_fb (dev, &addr);if (addr < gd->video_bottom) { -/* Device tree node may need the 'u-boot,dm-pre-reloc' tag */ +/* Device tree node may need the 'u-boot,dm-pre-reloc' or +* 'u-boot,dm-pre-proper' tag +*/ printf ("Video device '%s' cannot allocate frame buffer memory -ensure the device is set up before relocation\n" , dev->name);return -ENOSPC ;
include/dm/ofnode.h +4 -2
@@ -662,12 +662,14 @@ int ofnode_read_simple_size_cells(ofnode node);* After relocation and jumping into the real U-Boot binary it is possible to * determine if a node was bound in one of SPL/TPL stages. * -* There are 3 settings currently in use -* - +* There are 4 settings currently in use +* - u-boot,dm-pre-proper: U-Boot proper pre-relocation only * - u-boot,dm-pre-reloc: legacy and indicates any of TPL or SPL * Existing platforms only use it to indicate nodes needed in * SPL. Should probably be replaced by u-boot,dm-spl for * new platforms. +* - u-boot,dm-spl: SPL and U-Boot pre-relocation +* - u-boot,dm-tpl: TPL and U-Boot pre-relocation * * @node: node to check * @return true if node is needed in SPL/TL, false otherwise
include/dm/util.h +8 -4
@@ -52,12 +52,14 @@ static inline void dm_dump_devres(void)* it is possible to determine if a node was bound in one of * SPL/TPL stages. * -* There are 3 settings currently in use -* - +* There are 4 settings currently in use +* - u-boot,dm-pre-proper: U-Boot proper pre-relocation only * - u-boot,dm-pre-reloc: legacy and indicates any of TPL or SPL * Existing platforms only use it to indicate nodes needed in * SPL. Should probably be replaced by u-boot,dm-spl for * existing platforms. +* - u-boot,dm-spl: SPL and U-Boot pre-relocation +* - u-boot,dm-tpl: TPL and U-Boot pre-relocation * @blob: devicetree * @offset: node offset *
@@ -78,12 +80,14 @@ bool dm_fdt_pre_reloc(const void *blob, int offset);* it is possible to determine if a node was bound in one of * SPL/TPL stages. * -* There are 3 settings currently in use -* - +* There are 4 settings currently in use +* - u-boot,dm-pre-proper: U-Boot proper pre-relocation only * - u-boot,dm-pre-reloc: legacy and indicates any of TPL or SPL * Existing platforms only use it to indicate nodes needed in * SPL. Should probably be replaced by u-boot,dm-spl for * existing platforms. +* - u-boot,dm-spl: SPL and U-Boot pre-relocation +* - u-boot,dm-tpl: TPL and U-Boot pre-relocation * @node: of node * * Returns true if node is needed in SPL/TL, false otherwise.
Signature · 1 line
2.7.4
PATCH 2/2 dm: core: remove the duplicated function dm_ofnode_pre_reloc
The content dm_ofnode_pre_reloc() is identical with ofnode_pre_reloc() defined in drivers/core/ofnode.c and used only one time
in drivers/core/lists.c:lists_bind_fdt().
So the function can be removed and directly call ofnode_pre_reloc.
---
drivers/core/lists.c | 2 +- drivers/core/util.c | 26 -------------------------- include/dm/util.h | 27 --------------------------- 3 files changed, 1 insertion(+), 54 deletions(-)
drivers/core/lists.c +1 -1
@@ -173,7 +173,7 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp,continue ;if (pre_reloc_only) { -if (!dm_ofnode_pre_reloc (node) && +if (!ofnode_pre_reloc (node) && !(entry->flags &DM_FLAG_PRE_RELOC ))return 0 ; }
drivers/core/util.c +0 -26
@@ -56,29 +56,3 @@ bool dm_fdt_pre_reloc(const void *blob, int offset)return false; } - -bool dm_ofnode_pre_reloc (ofnode node) -{ -if (ofnode_read_bool (node,"u-boot,dm-pre-reloc" )) -return true; -if (ofnode_read_bool (node,"u-boot,dm-pre-proper" )) -return true; - -#ifdef CONFIG_TPL_BUILD -if (ofnode_read_bool (node,"u-boot,dm-tpl" )) -return true; -#elif defined(CONFIG_SPL_BUILD ) -if (ofnode_read_bool (node,"u-boot,dm-spl" )) -return true; -#else -/* -* In regular builds individual spl and tpl handling both -* count as handled pre-relocation for later second init. -*/ -if (ofnode_read_bool (node,"u-boot,dm-spl" ) || -ofnode_read_bool (node,"u-boot,dm-tpl" )) -return true; -#endif - -return false; -}
include/dm/util.h +0 -27
@@ -67,31 +67,4 @@ static inline void dm_dump_devres(void)*/ bool dm_fdt_pre_reloc (const void *blob,int offset); -/** -* Check if an of node should be or was bound before relocation. -* -* Devicetree nodes can be marked as needed to be bound -* in the loader stages via special devicetree properties. -* -* Before relocation this function can be used to check if nodes -* are required in either SPL or TPL stages. -* -* After relocation and jumping into the real U-Boot binary -* it is possible to determine if a node was bound in one of -* SPL/TPL stages. -* -* There are 4 settings currently in use -* - u-boot,dm-pre-proper: U-Boot proper pre-relocation only -* - u-boot,dm-pre-reloc: legacy and indicates any of TPL or SPL -* Existing platforms only use it to indicate nodes needed in -* SPL. Should probably be replaced by u-boot,dm-spl for -* existing platforms. -* - u-boot,dm-spl: SPL and U-Boot pre-relocation -* - u-boot,dm-tpl: TPL and U-Boot pre-relocation -* @node: of node -* -* Returns true if node is needed in SPL/TL, false otherwise. -*/ -bool dm_ofnode_pre_reloc (ofnode node); -#endif
Signature · 1 line
2.7.4
PATCH 2/2 dm: core: remove the duplicated function dm_ofnode_pre_reloc
Hi Patrick,
Quoted 7 lines · Patrick Delaunay
The content
dm_ofnode_pre_reloc()is identical withofnode_pre_reloc()defined indrivers/core/ofnode.cand used only one time
in drivers/core/lists.c:lists_bind_fdt().So the function can be removed and directly call
ofnode_pre_reloc.
Quoted 7 lines
Signed-off-by Patrick Delaunay <[email protected]>---
drivers/core/lists.c | 2 +- drivers/core/util.c | 26 -------------------------- include/dm/util.h | 27 --------------------------- 3 files changed, 1 insertion(+), 54 deletions(-)
I think the docs for ofnode_pre_reloc() need updating.
Regards,
Simon
PATCH 2/2 dm: core: remove the duplicated function dm_ofnode_pre_reloc
Hi Simon,
Quoted 17 lines
From: Simon Glass <[email protected]>
Sent: lundi 4 février 2019 15:41Hi Patrick,
Quoted 10 lines · Patrick Delaunay
The content
dm_ofnode_pre_reloc()is identical withofnode_pre_reloc()defined indrivers/core/ofnode.cand used only one time in drivers/core/lists.c:lists_bind_fdt().So the function can be removed and directly call
ofnode_pre_reloc.Signed-off-by Patrick Delaunay <[email protected]>---
Quoted 6 lines
Quoted 4 lines
drivers/core/lists.c | 2 +- drivers/core/util.c | 26 -------------------------- include/dm/util.h | 27 --------------------------- 3 files changed, 1 insertion(+), 54 deletions(-)I think the docs for
ofnode_pre_reloc()need updating.
You think about which docs ?
With previous patch in the serie, in ofnode.h, I have:
/**
* ofnode_pre_reloc() - check if a node should be bound before relocation *
* Device tree nodes can be marked as needing-to-be-bound in the loader stages
* via special device tree properties.
*
* Before relocation this function can be used to check if nodes are required
* in either SPL or TPL stages.
*
* After relocation and jumping into the real U-Boot binary it is possible to
* determine if a node was bound in one of SPL/TPL stages.
*
* There are 4 settings currently in use
* - u-boot,dm-pre-proper: U-Boot proper pre-relocation only
* - u-boot,dm-pre-reloc: legacy and indicates any of TPL or SPL
* Existing platforms only use it to indicate nodes needed in * SPL. Should probably be replaced by u-boot,dm-spl for * new platforms.
* - u-boot,dm-spl: SPL and U-Boot pre-relocation
* - u-boot,dm-tpl: TPL and U-Boot pre-relocation *
* @node: node to check
* @return true if node is needed in SPL/TL, false otherwise */
bool ofnode_pre_reloc(ofnode node);
What do you expect ?
Quoted 2 lines
Regards,
Simon
Regards
Patrick
PATCH 1/2 fdt: Allow indicating a node is for U-Boot proper only
In reply to Patrick DelaunayQuoted 10 lines · Patrick Delaunay
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 <[email protected]>
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.
Regards,
Simon
PATCH 1/2 fdt: Allow indicating a node is for U-Boot proper only
Quoted 21 lines · Simon Glass
Quoted 10 lines · Patrick Delaunay
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 <[email protected]>Reviewed-by Simon Glass <[email protected]>There was discussion some time ago about using a property instead:
chosen { u-boot,dm-spl = <&node1 &node2>; u-boot,dm-tpl = <&node1>; };
Quoted 7 lines
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.dtsifile 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.
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/2 fdt: Allow indicating a node is for U-Boot proper only
Hi Marek,
Quoted 33 lines
From: Marek Vasut <[email protected]>
Sent: mardi 5 février 2019 09:55Quoted 1 line · Simon Glass
On Mon, 4 Feb 2019 at 03:15, Patrick Delaunay <[email protected]>
Quoted 7 lines · wrote:
Quoted 7 lines
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.
Quoted 19 lines
Quoted 3 lines
Signed-off-by Patrick Delaunay <[email protected]>Reviewed-by Simon Glass <[email protected]>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.dtsifile to hold these tags.
Quoted 6 lines
Quoted 1 line
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.
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)
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 ...
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;
};
};
};Quoted 3 lines
--
Best regards,
Marek Vasut
PATCH 1/2 fdt: Allow indicating a node is for U-Boot proper only
Quoted 47 lines · Patrick DELAUNAY
Hi Marek,
Quoted 33 lines
From: Marek Vasut <[email protected]>
Sent: mardi 5 février 2019 09:55Quoted 1 line · Simon Glass
On Mon, 4 Feb 2019 at 03:15, Patrick Delaunay <[email protected]>
Quoted 7 lines · wrote:
Quoted 7 lines
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.
Quoted 19 lines
Quoted 3 lines
Signed-off-by Patrick Delaunay <[email protected]>Reviewed-by Simon Glass <[email protected]>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.dtsifile to hold these tags.Quoted 6 lines
Quoted 1 line
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
Quoted 4 lines
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.
Quoted 6 lines
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)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.
Quoted 9 lines
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;Quoted 8 lines
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.
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/2 fdt: Allow indicating a node is for U-Boot proper only
Hi Marek,
Quoted 53 lines
From: Marek Vasut <[email protected]>
Sent: jeudi 7 février 2019 18:48Quoted 43 lines · Patrick DELAUNAY
Hi Marek,
Quoted 41 lines
From: Marek Vasut <[email protected]>
Sent: mardi 5 février 2019 09:55Quoted 2 lines · Simon Glass
On Mon, 4 Feb 2019 at 03:15, Patrick Delaunay
<[email protected]>Quoted 8 lines · wrote:
Quoted 8 lines
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.
Quoted 13 lines
Quoted 3 lines
Signed-off-by Patrick Delaunay <[email protected]>Reviewed-by Simon Glass <[email protected]>There was discussion some time ago about using a property instead:
chosen { u-boot,dm-spl = <&node1 &node2>; u-boot,dm-tpl = <&node1>; };Quoted 7 lines
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.dtsifile 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.
Quoted 4 lines
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.
Quoted 9 lines
Quoted 6 lines
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 PHANDLEQuoted 5 lines
Quoted 1 line
NB: we could also remove the tags u-boot,dm-pre-reloc/u-boot,dm-spl : we
can gain place in spl dtb
Quoted 1 line
These tags are not needed as binding is mandatory in SPL build for ALL
node present in SPL device tree
Quoted 1 line
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.
Quoted 6 lines
Quoted 1 line
PS: a other boring point: if we need to tag all the tree to have one sub-node in
SPL
Quoted 1 line
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.
Quoted 19 lines
Quoted 18 lines
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; }; }; };
Quoted 1 line
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@0 /pin2_a/pins2} >;
u-boot,dm-tpl = <&node1 &{/soc/pin-controller@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
Quoted 4 lines
--
Best regards,
Marek Vasut
Regards
Patrick
PATCH 1/2 fdt: Allow indicating a node is for U-Boot proper only
In reply to Marek VasutHi Marek and Simon
Quoted 31 lines
From: Patrick DELAUNAY
Sent: vendredi 8 février 2019 13:47Hi Marek,
Quoted 26 lines
From: Marek Vasut <[email protected]>
Sent: jeudi 7 février 2019 18:48Quoted 22 lines · Patrick DELAUNAY
Hi Marek,
Quoted 20 lines
From: Marek Vasut <[email protected]>
Sent: mardi 5 février 2019 09:55Quoted 2 lines · Simon Glass
On Mon, 4 Feb 2019 at 03:15, Patrick Delaunay
<[email protected]>Quoted 8 lines · wrote:
Quoted 8 lines
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.
Quoted 4 lines
Quoted 3 lines
Signed-off-by Patrick Delaunay <[email protected]>
...
Quoted 10 lines
Quoted 7 lines
Quoted 2 lines
NB: we could also remove the tags u-boot,dm-pre-reloc/u-boot,dm-spl : we
can gain place in spl dtb
Quoted 2 lines
These tags are not needed as binding is mandatory in SPL
build for ALLnode present in SPL device tree
Quoted 1 line
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/
Quoted 3 lines
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.
Regards
Patrick
PATCH 1/2 fdt: Allow indicating a node is for U-Boot proper only
Quoted 45 lines · Patrick DELAUNAY
Hi Marek and Simon
Quoted 31 lines
From: Patrick DELAUNAY
Sent: vendredi 8 février 2019 13:47Hi Marek,
Quoted 26 lines
From: Marek Vasut <[email protected]>
Sent: jeudi 7 février 2019 18:48Quoted 22 lines · Patrick DELAUNAY
Hi Marek,
Quoted 20 lines
From: Marek Vasut <[email protected]>
Sent: mardi 5 février 2019 09:55Quoted 2 lines · Simon Glass
On Mon, 4 Feb 2019 at 03:15, Patrick Delaunay
<[email protected]>Quoted 8 lines · wrote:
Quoted 8 lines
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.
Quoted 4 lines
Quoted 3 lines
Signed-off-by Patrick Delaunay <[email protected]>...
Quoted 10 lines
Quoted 7 lines
Quoted 2 lines
NB: we could also remove the tags u-boot,dm-pre-reloc/u-boot,dm-spl : we
can gain place in spl dtb
Quoted 2 lines
These tags are not needed as binding is mandatory in SPL
build for ALLnode present in SPL device tree
Quoted 1 line
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
Quoted 8 lines
FYI: patch sent with http://patchwork.ozlabs.org/patch/1039756/
Quoted 3 lines
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 ?
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/2 fdt: Allow indicating a node is for U-Boot proper only
Hi Marek,
Quoted 55 lines
From: Marek Vasut <[email protected]>
Sent: lundi 11 février 2019 12:58Quoted 51 lines · Patrick DELAUNAY
Hi Marek and Simon
Quoted 31 lines
From: Patrick DELAUNAY
Sent: vendredi 8 février 2019 13:47Hi Marek,
Quoted 26 lines
From: Marek Vasut <[email protected]>
Sent: jeudi 7 février 2019 18:48Quoted 22 lines · Patrick DELAUNAY
Hi Marek,
Quoted 20 lines
From: Marek Vasut <[email protected]>
Sent: mardi 5 février 2019 09:55Quoted 2 lines · Simon Glass
On Mon, 4 Feb 2019 at 03:15, Patrick Delaunay
<[email protected]>Quoted 8 lines · wrote:
Quoted 8 lines
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.
Quoted 4 lines
Quoted 3 lines
Signed-off-by Patrick Delaunay <[email protected]>...
Quoted 10 lines
Quoted 7 lines
Quoted 2 lines
NB: we could also remove the tags u-boot,dm-pre-reloc/u-boot,dm-spl : we
can gain place in spl dtb
Quoted 2 lines
These tags are not needed as binding is mandatory in SPL
build for ALLnode present in SPL device tree
Quoted 1 line
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/
Quoted 3 lines
NB: side effect on the patch, we only need to TAG the children (all node are bounded in SPL)
That improve the next point.
Quoted 7 lines
Quoted 1 line
After test, the phandle of the parent node is remove when the tag preloc or spl
is not present....
Quoted 1 line
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'
Quoted 3 lines
--
Best regards,
Marek Vasut
Sorry for the long exmplaination.
Regards
Patrick
PATCH 1/2 fdt: Allow indicating a node is for U-Boot proper only
Hi Patrick,
Quoted 53 lines · Patrick DELAUNAY
Hi Marek,
Quoted 50 lines
From: Marek Vasut <[email protected]>
Sent: lundi 11 février 2019 12:58Quoted 46 lines · Patrick DELAUNAY
Hi Marek and Simon
Quoted 31 lines
From: Patrick DELAUNAY
Sent: vendredi 8 février 2019 13:47Hi Marek,
Quoted 26 lines
From: Marek Vasut <[email protected]>
Sent: jeudi 7 février 2019 18:48Quoted 22 lines · Patrick DELAUNAY
Hi Marek,
Quoted 20 lines
From: Marek Vasut <[email protected]>
Sent: mardi 5 février 2019 09:55Quoted 2 lines · Simon Glass
On Mon, 4 Feb 2019 at 03:15, Patrick Delaunay
<[email protected]>Quoted 8 lines · wrote:
Quoted 8 lines
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.
Quoted 4 lines
Quoted 3 lines
Signed-off-by Patrick Delaunay <[email protected]>...
Quoted 10 lines
Quoted 7 lines
Quoted 2 lines
NB: we could also remove the tags u-boot,dm-pre-reloc/u-boot,dm-spl : we
can gain place in spl dtb
Quoted 2 lines
These tags are not needed as binding is mandatory in SPL
build for ALLnode present in SPL device tree
Quoted 1 line
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/
That patch was applied.
But what is the status of this patch, and the second one in this series?
If these are still needed can you please resend them, rebased?
Regards,
Simon
PATCH 1/2 fdt: Allow indicating a node is for U-Boot proper only
Hi Simon,
Quoted 61 lines
Hi Patrick,
Quoted 34 lines · Patrick DELAUNAY
Hi Marek,
Quoted 31 lines
From: Marek Vasut <[email protected]>
Sent: lundi 11 février 2019 12:58Quoted 27 lines · Patrick DELAUNAY
Hi Marek and Simon
Quoted 25 lines
From: Patrick DELAUNAY
Sent: vendredi 8 février 2019 13:47Hi Marek,
Quoted 20 lines
From: Marek Vasut <[email protected]>
Sent: jeudi 7 février 2019 18:48Quoted 16 lines · Patrick DELAUNAY
Hi Marek,
Quoted 14 lines
From: Marek Vasut <[email protected]>
Sent: mardi 5 février 2019 09:55Quoted 2 lines · Simon Glass
On Mon, 4 Feb 2019 at 03:15, Patrick Delaunay
<[email protected]>Quoted 7 lines · wrote:
Quoted 7 lines
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"
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line
boolean property
for this.
Quoted 4 lines
Quoted 3 lines
Signed-off-by Patrick Delaunay <[email protected]>...
Quoted 13 lines
Quoted 9 lines
Quoted 3 lines
NB: we could also remove the tags
u-boot,dm-pre-reloc/u-boot,dm-spl
: wecan gain place in spl dtb
Quoted 2 lines
These tags are not needed as binding is mandatory in SPL
build for ALLnode present in SPL device tree
Quoted 2 lines
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
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
FYI: patch sent with http://patchwork.ozlabs.org/patch/1039756/
That patch was applied.
But what is the status of this patch, and the second one in this series?
If these are still needed can you please resend them, rebased?
Yes , I need to sent a update.
I finish just it (include tests) Friday, I will sent it today
Quoted 2 lines
Regards,
Simon
Regards
Patrick