diff options
author | Simon Glass <sjg@chromium.org> | 2020-11-29 03:50:02 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2020-12-13 17:58:18 +0300 |
commit | 0de1b07406d709c3951dbb1a69ca196d80bd516d (patch) | |
tree | a741e4a124438112f6ef63c0fce2473da2870227 /drivers | |
parent | 734206dda14b328bfb946eea1e343f06a5fcceea (diff) | |
download | u-boot-0de1b07406d709c3951dbb1a69ca196d80bd516d.tar.xz |
dm: core: Add a livetree function to check node status
Add a way to find out if a node is enabled or not, based on its 'status'
property.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/core/ofnode.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index a68076bf35..87072094f3 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -226,6 +226,16 @@ int ofnode_read_u32_array(ofnode node, const char *propname, } } +bool ofnode_is_enabled(ofnode node) +{ + if (ofnode_is_np(node)) { + return of_device_is_available(ofnode_to_np(node)); + } else { + return fdtdec_get_is_enabled(gd->fdt_blob, + ofnode_to_offset(node)); + } +} + ofnode ofnode_first_subnode(ofnode node) { assert(ofnode_valid(node)); |