From: Simon Glass Date: Tue, 29 Aug 2017 14:15:52 -0600 Subject: [U-Boot] [PATCH v2 07/16] dtoc: Update the Fdt class to record phandles In-Reply-To: <20170829201601.64312-1-sjg@chromium.org> References: <20170829201601.64312-1-sjg@chromium.org> Message-ID: <20170829201601.64312-8-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- Changes in v2: None tools/dtoc/fdt.py | 5 +++++ 1 file changed, 5 insertions(+) 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) -- 2.14.1.342.g6490525c54-goog