summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2012-04-02 13:18:42 +0000
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2012-05-15 08:31:36 +0200
commit3ddecfc74086aa185a2f671cc07cb826b72d35f0 (patch)
treeae643a3369183c2286b8e2a9c503eb4f40d759be /include
parent96875e7d3b9900d0e63f0b591ff5693b31c4d9c3 (diff)
downloadtalos-obmc-uboot-3ddecfc74086aa185a2f671cc07cb826b72d35f0.tar.gz
talos-obmc-uboot-3ddecfc74086aa185a2f671cc07cb826b72d35f0.zip
fdt: Add function to return next compatible subnode
We need to iterate through subnodes of a parent, looking only at compatible nodes. Add a utility function to do this for us. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
Diffstat (limited to 'include')
-rw-r--r--include/fdtdec.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/fdtdec.h b/include/fdtdec.h
index 84f0768526..0351a25a98 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -117,6 +117,23 @@ int fdtdec_next_compatible(const void *blob, int node,
enum fdt_compat_id id);
/**
+ * Find the next compatible subnode for a peripheral.
+ *
+ * Do the first call with node set to the parent and depth = 0. This
+ * function will return the offset of the next compatible node. Next time
+ * you call this function, pass the node value returned last time, with
+ * depth unchanged, and the next node will be provided.
+ *
+ * @param blob FDT blob to use
+ * @param node Start node for search
+ * @param id Compatible ID to look for (enum fdt_compat_id)
+ * @param depthp Current depth (set to 0 before first call)
+ * @return offset of next compatible node, or -FDT_ERR_NOTFOUND if no more
+ */
+int fdtdec_next_compatible_subnode(const void *blob, int node,
+ enum fdt_compat_id id, int *depthp);
+
+/**
* Look up an address property in a node and return it as an address.
* The property must hold either one address with no trailing data or
* one address with a length. This is only tested on 32-bit machines.
OpenPOWER on IntegriCloud