diff mbox series

[U-Boot,v2,07/16] dtoc: Update the Fdt class to record phandles

Message ID 20170829201601.64312-8-sjg@chromium.org
State Accepted
Commit 09264e04330479fbe5bdb647619be4fd90735bfc
Delegated to: Simon Glass
Headers show
Series dtoc: Add support for 64-bit addresses | expand

Commit Message

Simon Glass Aug. 29, 2017, 8:15 p.m. UTC
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>
---

Changes in v2: None

 tools/dtoc/fdt.py | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Simon Glass Sept. 15, 2017, 7:25 p.m. UTC | #1
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>
---

Changes in v2: None

 tools/dtoc/fdt.py | 5 +++++
 1 file changed, 5 insertions(+)

Applied to u-boot-fdt thanks!
diff mbox series

Patch

diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index ffd42ce541..dbc338653b 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)