diff options
author | Simon Glass <sjg@chromium.org> | 2018-09-14 13:57:21 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-09-28 20:09:01 +0300 |
commit | f46621d255181bd8d1e8092945ffc66147b88531 (patch) | |
tree | 1abc966d98fefc9eb298b5336ad380f54612b42a /tools/binman/state.py | |
parent | 2a72cc72ca29fb14a61dd50a60ffcd096a0be317 (diff) | |
download | u-boot-f46621d255181bd8d1e8092945ffc66147b88531.tar.xz |
binman: Centralise device-tree updates within binman
At present we have a few calls to device-tree functions in binman and plan
to add more as we add new entry types which need to report their results.
It makes sense to put this code in a central place so that we can make
sure all device trees are updated. At present we only have U-Boot proper,
but plan to add SPL and TPL too.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/state.py')
-rw-r--r-- | tools/binman/state.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/binman/state.py b/tools/binman/state.py index 9583b3fa5f..5f25b907b9 100644 --- a/tools/binman/state.py +++ b/tools/binman/state.py @@ -118,3 +118,38 @@ def GetFdts(): """ yield main_dtb +def GetUpdateNodes(node): + """Yield all the nodes that need to be updated in all device trees + + The property referenced by this node is added to any device trees which + have the given node. Due to removable of unwanted notes, SPL and TPL may + not have this node. + + Args: + node: Node object in the main device tree to look up + + Yields: + Node objects in each device tree that is in use (U-Boot proper, which + is node, SPL and TPL) + """ + yield node + +def AddZeroProp(node, prop): + """Add a new property to affected device trees with an integer value of 0. + + Args: + prop_name: Name of property + """ + for n in GetUpdateNodes(node): + n.AddZeroProp(prop) + +def SetInt(node, prop, value): + """Update an integer property in affected device trees with an integer value + + This is not allowed to change the size of the FDT. + + Args: + prop_name: Name of property + """ + for n in GetUpdateNodes(node): + n.SetInt(prop, value) |