summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-08-29 20:15:52 (GMT)
committerSimon Glass <sjg@chromium.org>2017-09-15 11:27:47 (GMT)
commit09264e04330479fbe5bdb647619be4fd90735bfc (patch)
tree38600f35a011832e8bdfe15ce1d360da0b95be3a /tools
parent5ec741fd84ec2c080a6c400feaaa7f335f5cb62f (diff)
downloadu-boot-09264e04330479fbe5bdb647619be4fd90735bfc.tar.xz
dtoc: Update the Fdt class to record phandles
Add a map from phandles to nodes. This can be used by clients of the the class instead of maintaining this themselves. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Kever Yang <kever.yang@rock-chips.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/dtoc/fdt.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index ffd42ce..dbc3386 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -212,6 +212,10 @@ class Node:
searching into subnodes so that the entire tree is built.
"""
self.props = self._fdt.GetProps(self)
+ phandle = self.props.get('phandle')
+ if phandle:
+ val = fdt_util.fdt32_to_cpu(phandle.value)
+ self._fdt.phandle_to_node[val] = self
offset = libfdt.fdt_first_subnode(self._fdt.GetFdt(), self.Offset())
while offset >= 0:
@@ -263,6 +267,7 @@ class Fdt:
def __init__(self, fname):
self._fname = fname
self._cached_offsets = False
+ self.phandle_to_node = {}
if self._fname:
self._fname = fdt_util.EnsureCompiled(self._fname)