diff options
author | Tom Rini <trini@konsulko.com> | 2020-04-16 13:45:03 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-04-16 13:45:03 -0400 |
commit | f51b4bcf61c9aa7994138a4a417488c1fbdb47cd (patch) | |
tree | 4f536d0892be1359f2cf02bfe366b56bef83bf28 /include/dm/read.h | |
parent | dba0a6ae1907bbff3ebda06e4874d006f10db1bb (diff) | |
parent | b0dcc87106464c3fc019e3771378a092fd32ebdb (diff) |
Merge tag 'dm-pull-10apr20-take2' of git://git.denx.de/u-boot-dm
Functions for reading indexed values from device tree
Enhancements to 'dm' command
Log test enhancements and syslog driver
DM change to read parent ofdata before children
Minor fixes
Diffstat (limited to 'include/dm/read.h')
-rw-r--r-- | include/dm/read.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/include/dm/read.h b/include/dm/read.h index da8c7f25e7c..77d3bc8db5b 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -67,6 +67,32 @@ int dev_read_u32_default(const struct udevice *dev, const char *propname, int def); /** + * dev_read_u32_index() - read an indexed 32-bit integer from a device's DT + * property + * + * @dev: device to read DT property from + * @propname: name of the property to read from + * @index: index of the integer to return + * @outp: place to put value (if found) + * @return 0 if OK, -ve on error + */ +int dev_read_u32_index(struct udevice *dev, const char *propname, int index, + u32 *outp); + +/** + * dev_read_u32_index_default() - read an indexed 32-bit integer from a device's + * DT property + * + * @dev: device to read DT property from + * @propname: name of the property to read from + * @index: index of the integer to return + * @def: default value to return if the property has no value + * @return property value, or @def if not found + */ +u32 dev_read_u32_index_default(struct udevice *dev, const char *propname, + int index, u32 def); + +/** * dev_read_s32() - read a signed 32-bit integer from a device's DT property * * @dev: device to read DT property from @@ -621,6 +647,20 @@ static inline int dev_read_u32_default(const struct udevice *dev, return ofnode_read_u32_default(dev_ofnode(dev), propname, def); } +static inline 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); +} + +static inline 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); +} + static inline int dev_read_s32(const struct udevice *dev, const char *propname, s32 *outp) { |