From: Simon Glass Date: Tue, 29 Aug 2017 20:15:52 +0000 (-0600) Subject: dtoc: Update the Fdt class to record phandles X-Git-Tag: v2017.11-rc1~90^2~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=09264e04330479fbe5bdb647619be4fd90735bfc;p=platform%2Fkernel%2Fu-boot.git 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 Tested-by: Kever Yang --- 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)