diff options
author | Simon Glass <sjg@chromium.org> | 2018-06-11 22:07:10 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-07-09 18:11:00 +0300 |
commit | 7e5196c409f17091f2aeca144c6d76750df81cc4 (patch) | |
tree | 427b03797b692f0752fecd92dccc397027df98da /drivers/core/of_access.c | |
parent | 90c08fa038451d6d7b7d8711bfd829b61d64c490 (diff) | |
download | u-boot-7e5196c409f17091f2aeca144c6d76750df81cc4.tar.xz |
dm: core: Add ofnode function to read a 64-bit int
We have a 32-bit version of this function. Add a 64-bit version as well so
we can easily read 64-bit ints from the device tree.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/of_access.c')
-rw-r--r-- | drivers/core/of_access.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/core/of_access.c b/drivers/core/of_access.c index 9a50f559de..0729dfcdb3 100644 --- a/drivers/core/of_access.c +++ b/drivers/core/of_access.c @@ -457,6 +457,26 @@ int of_read_u32_array(const struct device_node *np, const char *propname, return 0; } +int of_read_u64(const struct device_node *np, const char *propname, u64 *outp) +{ + const __be64 *val; + + debug("%s: %s: ", __func__, propname); + if (!np) + return -EINVAL; + val = of_find_property_value_of_size(np, propname, sizeof(*outp)); + if (IS_ERR(val)) { + debug("(not found)\n"); + return PTR_ERR(val); + } + + *outp = be64_to_cpup(val); + debug("%#llx (%lld)\n", (unsigned long long)*outp, + (unsigned long long)*outp); + + return 0; +} + int of_property_match_string(const struct device_node *np, const char *propname, const char *string) { |