diff options
author | Michal Simek <michal.simek@amd.com> | 2023-08-25 11:37:46 +0200 |
---|---|---|
committer | Michal Simek <michal.simek@amd.com> | 2023-09-21 13:20:10 +0200 |
commit | fa12dfa08a7bdc7d67e3758f10461468a663ce2e (patch) | |
tree | 6639f242e26867cb59b662da81680240e35b5784 /include/dm/of_access.h | |
parent | 91ed45a24f5bad1d8538a8f54738e51924443b76 (diff) |
dm: core: support reading a single indexed u64 value
Add helper function to allow reading a single indexed u64 value from a
device-tree property containing multiple u64 values, that is an array of
u64's.
Co-developed-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/08043c8d204d0068f04c27de86afe78c75c50b69.1692956263.git.michal.simek@amd.com
Diffstat (limited to 'include/dm/of_access.h')
-rw-r--r-- | include/dm/of_access.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/dm/of_access.h b/include/dm/of_access.h index c556a18f7d9..9361d0a87bf 100644 --- a/include/dm/of_access.h +++ b/include/dm/of_access.h @@ -334,6 +334,25 @@ int of_read_u32_index(const struct device_node *np, const char *propname, int index, u32 *outp); /** + * of_read_u64_index() - Find and read a 64-bit value from a multi-value + * property + * + * @np: device node from which the property value is to be read. + * @propname: name of the property to be searched. + * @index: index of the u32 in the list of values + * @outp: pointer to return value, modified only if return value is 0. + * + * Search for a property in a device node and read a 64-bit value from + * it. + * + * Return: + * 0 on success, -EINVAL if the property does not exist, or -EOVERFLOW if the + * property data isn't large enough. + */ +int of_read_u64_index(const struct device_node *np, const char *propname, + int index, u64 *outp); + +/** * of_read_u64() - Find and read a 64-bit integer from a property * * Search for a property in a device node and read a 64-bit value from |