diff options
author | Simon Glass <sjg@chromium.org> | 2022-09-06 20:27:22 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-09-29 22:43:43 -0400 |
commit | 928d267aeea9406497c8060c03d3a0a78a8cbaa9 (patch) | |
tree | 443df55e9b11f345966d076f6877e4f7ddcbc7dd /include/dm | |
parent | 085d59411ca7cde4ca5c70beeab4fdcea209aed6 (diff) | |
download | u-boot-928d267aeea9406497c8060c03d3a0a78a8cbaa9.tar.gz u-boot-928d267aeea9406497c8060c03d3a0a78a8cbaa9.tar.bz2 u-boot-928d267aeea9406497c8060c03d3a0a78a8cbaa9.zip |
dm: core: Add a way to look up a phandle in an oftree
When we have multiple trees, the ofnode logic needs to be told which one
to use. Create a new function which takes an oftree argument, along with
a helper to obtain the FDT pointer from an oftree.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/dm')
-rw-r--r-- | include/dm/ofnode.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index 328e1edad4..fa72bb9eff 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -103,6 +103,22 @@ static inline bool ofnode_valid(ofnode node) } /** + * oftree_lookup_fdt() - obtain the FDT pointer from an oftree + * + * This can only be called when flat tree is enabled + * + * @tree: Tree to look at + * @return FDT pointer from the tree + */ +static inline void *oftree_lookup_fdt(oftree tree) +{ + if (of_live_active()) + return NULL; + else + return tree.fdt; +} + +/** * offset_to_ofnode() - convert a DT offset to an ofnode * * @of_offset: DT offset (either valid, or -1) @@ -595,6 +611,15 @@ int ofnode_get_path(ofnode node, char *buf, int buflen); ofnode ofnode_get_by_phandle(uint phandle); /** + * oftree_get_by_phandle() - get ofnode from phandle + * + * @tree: tree to use + * @phandle: phandle to look up + * Return: ofnode reference to the phandle + */ +ofnode oftree_get_by_phandle(oftree tree, uint phandle); + +/** * ofnode_read_size() - read the size of a property * * @node: node to check |