diff options
author | Simon Glass <sjg@chromium.org> | 2018-07-17 22:25:46 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-08-02 01:30:48 +0300 |
commit | 94a7c603b45b9abdd9e6960ed2b096dd4553c91c (patch) | |
tree | e3e937979b0820915341f4272e8a5b8918e2eac5 /tools/dtoc/fdt.py | |
parent | 4f5dea4543f2b7ebea803fe9b176abf5b637d988 (diff) | |
download | u-boot-94a7c603b45b9abdd9e6960ed2b096dd4553c91c.tar.xz |
dtoc: Add a function to obtain a list of phandles
Add a function which can decode a property containing a list of phandles.
This is useful for finding nodes linked to a property. Also provide a way
to look up a single phandle and get the Fdt object from a Node.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/dtoc/fdt.py')
-rw-r--r-- | tools/dtoc/fdt.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index 01e39b8a2a..d36179bad3 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -181,6 +181,14 @@ class Node: self.subnodes = [] self.props = {} + def GetFdt(self): + """Get the Fdt object for this node + + Returns: + Fdt object + """ + return self._fdt + def FindNode(self, name): """Find a node given its name @@ -314,6 +322,17 @@ class Fdt: with open(self._fname) as fd: self._fdt_obj = libfdt.Fdt(fd.read()) + def LookupPhandle(self, phandle): + """Look up a phandle + + Args: + phandle: Phandle to look up (int) + + Returns: + Node object the phandle points to + """ + return self.phandle_to_node.get(phandle) + def Scan(self, root='/'): """Scan a device tree, building up a tree of Node objects |