diff options
author | Dario Binacchi <dariobin@libero.it> | 2020-03-29 18:04:41 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2020-04-16 08:07:58 -0600 |
commit | 4bb7075c830c6f4e4512fe0277ff1f08c5a9e084 (patch) | |
tree | a1d8d9d36db2c061edd17dadddfed57a4188470e /drivers/core/read.c | |
parent | 70573c6c46be96d2e60497d8484b9afb119da8c1 (diff) | |
download | u-boot-4bb7075c830c6f4e4512fe0277ff1f08c5a9e084.tar.gz |
dm: core: support reading a single indexed u32 value
The patch adds helper functions to allow reading a single indexed u32
value from a device-tree property containing multiple u32 values, that
is an array of integers.
Signed-off-by: Dario Binacchi <dariobin@libero.it>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/read.c')
-rw-r--r-- | drivers/core/read.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/core/read.c b/drivers/core/read.c index 1f999b1b31..ce78f09d28 100644 --- a/drivers/core/read.c +++ b/drivers/core/read.c @@ -22,6 +22,19 @@ int dev_read_u32_default(const struct udevice *dev, const char *propname, return ofnode_read_u32_default(dev_ofnode(dev), propname, def); } +int dev_read_u32_index(struct udevice *dev, const char *propname, int index, + u32 *outp) +{ + return ofnode_read_u32_index(dev_ofnode(dev), propname, index, outp); +} + +u32 dev_read_u32_index_default(struct udevice *dev, const char *propname, + int index, u32 def) +{ + return ofnode_read_u32_index_default(dev_ofnode(dev), propname, index, + def); +} + int dev_read_s32(const struct udevice *dev, const char *propname, s32 *outp) { return ofnode_read_u32(dev_ofnode(dev), propname, (u32 *)outp); |