diff options
author | Jonas Karlman | 2023-07-22 13:30:15 +0000 |
---|---|---|
committer | Kever Yang | 2023-07-28 18:45:03 +0800 |
commit | 5e030632d49367944879e17a6d73828be22edd55 (patch) | |
tree | 3ca3ef2cfe4429f6e8eb87131ef19e00c762be84 /include/dm/read.h | |
parent | e5b33200f8fcc79c8555dd0b852827912abc0b04 (diff) |
core: read: add dev_read_addr_size_index_ptr function
Add dev_read_addr_size_index_ptr function with the same functionality as
dev_read_addr_size_index, but instead a return pointer is given.
Use map_sysmem() function as cast for the return.
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Diffstat (limited to 'include/dm/read.h')
-rw-r--r-- | include/dm/read.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/dm/read.h b/include/dm/read.h index 137f2a52a29..c2615f72f40 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -247,6 +247,20 @@ fdt_addr_t dev_read_addr_size_index(const struct udevice *dev, int index, fdt_size_t *size); /** + * dev_read_addr_size_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 + * @size: place to put size value (on success) + * + * Return: pointer or NULL if not found + */ +void *dev_read_addr_size_index_ptr(const struct udevice *dev, int index, + fdt_size_t *size); + +/** * dev_remap_addr_index() - Get the indexed reg property of a device * as a memory-mapped I/O pointer * @@ -952,6 +966,13 @@ static inline fdt_addr_t dev_read_addr_size_index(const struct udevice *dev, return devfdt_get_addr_size_index(dev, index, size); } +static inline void *dev_read_addr_size_index_ptr(const struct udevice *dev, + int index, + fdt_size_t *size) +{ + return devfdt_get_addr_size_index_ptr(dev, index, size); +} + static inline fdt_addr_t dev_read_addr_name(const struct udevice *dev, const char *name) { |