diff options
author | Bin Meng <bmeng.cn@gmail.com> | 2021-09-12 11:15:13 +0800 |
---|---|---|
committer | Leo Yu-Chi Liang <ycliang@andestech.com> | 2021-10-20 10:59:09 +0800 |
commit | bdce903106397add4283b713132e24972a6ac0ee (patch) | |
tree | 1fb6df63028126ea07ed1661a90eedfb61f48bf3 | |
parent | fb9bec8e8a7378d921478d5fbcc941e0fa80c01e (diff) | |
download | u-boot-bdce903106397add4283b713132e24972a6ac0ee.tar.gz u-boot-bdce903106397add4283b713132e24972a6ac0ee.tar.bz2 u-boot-bdce903106397add4283b713132e24972a6ac0ee.zip |
dm: Provide dev_read_addr_index_ptr() wrapper
Like dev_read_addr_ptr(), provide a wrapper for the indexed version.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | include/dm/read.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/dm/read.h b/include/dm/read.h index 5bf3405614..890bf3d847 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -181,6 +181,18 @@ int dev_read_size(const struct udevice *dev, const char *propname); fdt_addr_t dev_read_addr_index(const struct udevice *dev, int index); /** + * dev_read_addr_index_ptr() - Get the indexed reg property of a device + * as a pointer + * + * @dev: Device to read from + * @index: the 'reg' property can hold a list of <addr, size> pairs + * and @index is used to select which one is required + * + * @return pointer or NULL if not found + */ +void *dev_read_addr_index_ptr(const struct udevice *dev, int index); + +/** * dev_read_addr_size_index() - Get the indexed reg property of a device * * @dev: Device to read from @@ -805,6 +817,12 @@ static inline fdt_addr_t dev_read_addr_index(const struct udevice *dev, return devfdt_get_addr_index(dev, index); } +static inline void *dev_read_addr_index_ptr(const struct udevice *dev, + int index) +{ + return devfdt_get_addr_index_ptr(dev, index); +} + static inline fdt_addr_t dev_read_addr_size_index(const struct udevice *dev, int index, fdt_size_t *size) |