summaryrefslogtreecommitdiff
path: root/tools/dtoc
diff options
context:
space:
mode:
authorPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>2017-02-22 18:06:04 (GMT)
committerSimon Glass <sjg@chromium.org>2017-03-22 13:27:19 (GMT)
commit55bc080e799ac18802a791bd5ce5d83a136da6e3 (patch)
tree25977d0f0a3879b5a145c642748dce7e54b3e8b4 /tools/dtoc
parentb06a381a69a292d54485e5fd51e8d57f9cf2f7f9 (diff)
downloadu-boot-fsl-qoriq-55bc080e799ac18802a791bd5ce5d83a136da6e3.tar.xz
dtoc: make ScanTree recurse into subnodes
Previously, dtoc could only process the top-level nodes which led to device nodes in hierarchical trees to be ignored. E.g. the mmc0 node in the following example would be ignored, as only the soc node was processed: / { soc { mmc0 { /* ... */ }; }; }; This introduces a recursive helper method ScanNode, which is used by ScanTree to recursively parse the entire tree hierarchy. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/dtoc')
-rwxr-xr-xtools/dtoc/dtoc.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/tools/dtoc/dtoc.py b/tools/dtoc/dtoc.py
index bf67ec8..afc5171 100755
--- a/tools/dtoc/dtoc.py
+++ b/tools/dtoc/dtoc.py
@@ -172,6 +172,21 @@ class DtbPlatdata:
"""
self.fdt = fdt_select.FdtScan(self._dtb_fname)
+ def ScanNode(self, root):
+ for node in root.subnodes:
+ if 'compatible' in node.props:
+ status = node.props.get('status')
+ if (not options.include_disabled and not status or
+ status.value != 'disabled'):
+ self._valid_nodes.append(node)
+ phandle_prop = node.props.get('phandle')
+ if phandle_prop:
+ phandle = phandle_prop.GetPhandle()
+ self._phandle_node[phandle] = node
+
+ # recurse to handle any subnodes
+ self.ScanNode(node);
+
def ScanTree(self):
"""Scan the device tree for useful information
@@ -180,8 +195,10 @@ class DtbPlatdata:
_valid_nodes: A list of nodes we wish to consider include in the
platform data
"""
- node_list = []
self._phandle_node = {}
+ self._valid_nodes = []
+ return self.ScanNode(self.fdt.GetRoot());
+
for node in self.fdt.GetRoot().subnodes:
if 'compatible' in node.props:
status = node.props.get('status')