summaryrefslogtreecommitdiff
path: root/tools/dtoc/dtb_platdata.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-06-28 02:51:10 +0300
committerBin Meng <bmeng.cn@gmail.com>2021-07-15 14:50:27 +0300
commit1c56469ce132859a18df054378c5d6ad6e57b195 (patch)
tree5dd92525378d501479de7ac8676968181f987e75 /tools/dtoc/dtb_platdata.py
parent54e0bd1728a4db60fd87a5c385250e173d03674e (diff)
downloadu-boot-1c56469ce132859a18df054378c5d6ad6e57b195.tar.xz
dtoc: Check that a parent is not missing
With of-platdata-inst we want to set up a reference to each devices' parent device, if there is one. If we find that the device has a parent (i.e. is not a root node) but it is not in the list of devices being written, then we cannot create the reference. Report an error in this case, since it indicates that the parent node is either missing a compatible string, is disabled, or perhaps does not have any properties because it was not tagged for SPL. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/dtoc/dtb_platdata.py')
-rw-r--r--tools/dtoc/dtb_platdata.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py
index 2d42480a9a..869c92b49b 100644
--- a/tools/dtoc/dtb_platdata.py
+++ b/tools/dtoc/dtb_platdata.py
@@ -749,6 +749,15 @@ class DtbPlatdata():
break
if node.parent and node.parent.parent:
+ if node.parent not in self._valid_nodes:
+ # This might indicate that the parent node is not in the
+ # SPL/TPL devicetree but the child is. For example if we are
+ # dealing with of-platdata in TPL, the parent has a
+ # u-boot,dm-tpl tag but the child has u-boot,dm-pre-reloc. In
+ # this case the child node exists in TPL but the parent does
+ # not.
+ raise ValueError("Node '%s' requires parent node '%s' but it is not in the valid list" %
+ (node.path, node.parent.path))
self.buf('\t.parent\t\t= DM_DEVICE_REF(%s),\n' %
node.parent.var_name)
if priv_name: