diff options
author | Simon Glass <sjg@chromium.org> | 2012-02-03 15:13:53 +0000 |
---|---|---|
committer | Albert ARIBAUD <albert.u.boot@aribaud.net> | 2012-03-29 08:12:49 +0200 |
commit | c67822704b73dcfb86debf4c25151e43309af844 (patch) | |
tree | 1ed8997f2f8f023fa3ddf2a244c69ba5434deddd /include/fdtdec.h | |
parent | f4589a7d6f477876c18eb8087e3ee7fa0a8655ca (diff) | |
download | u-boot-imx-c67822704b73dcfb86debf4c25151e43309af844.zip u-boot-imx-c67822704b73dcfb86debf4c25151e43309af844.tar.gz u-boot-imx-c67822704b73dcfb86debf4c25151e43309af844.tar.bz2 |
fdt: Add function to allow aliases to refer to multiple nodes
Some devices can deal with multiple compatible properties. The devices
need to know which nodes to bind to which features. For example an
I2C driver which supports two different controller types will want to
know which type it is dealing with in each case.
The new fdtdec_add_aliases_for_id() function deals with this by allowing
the driver to search for additional compatible nodes for a different ID.
It can then detect the new ones and perform appropriate processing.
Another option considered was to return a tuple (node offset, compat id)
and have the function be passed a list of compatible IDs. This is more
overhead for the common case though. We may add such a function later if
more drivers in U-Boot require it.
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Warren <twarren@nvidia.com>
Diffstat (limited to 'include/fdtdec.h')
-rw-r--r-- | include/fdtdec.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/fdtdec.h b/include/fdtdec.h index 6249f22..1e198f8 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -213,6 +213,29 @@ int fdtdec_find_aliases_for_id(const void *blob, const char *name, enum fdt_compat_id id, int *node_list, int maxcount); /* + * This function is similar to fdtdec_find_aliases_for_id() except that it + * adds to the node_list that is passed in. Any 0 elements are considered + * available for allocation - others are considered already used and are + * skipped. + * + * You can use this by calling fdtdec_find_aliases_for_id() with an + * uninitialised array, then setting the elements that are returned to -1, + * say, then calling this function, perhaps with a different compat id. + * Any elements you get back that are >0 are new nodes added by the call + * to this function. + * + * Note that if you have some nodes with aliases and some without, you are + * sailing close to the wind. The call to fdtdec_find_aliases_for_id() with + * one compat_id may fill in positions for which you have aliases defined + * for another compat_id. When you later call *this* function with the second + * compat_id, the alias positions may already be used. A debug warning may + * be generated in this case, but it is safest to define aliases for all + * nodes when you care about the ordering. + */ +int fdtdec_add_aliases_for_id(const void *blob, const char *name, + enum fdt_compat_id id, int *node_list, int maxcount); + +/* * Get the name for a compatible ID * * @param id Compatible ID to look for |