diff options
author | Bin Meng | 2021-09-12 11:15:12 +0800 |
---|---|---|
committer | Leo Yu-Chi Liang | 2021-10-20 10:59:09 +0800 |
commit | fb9bec8e8a7378d921478d5fbcc941e0fa80c01e (patch) | |
tree | 5876e80d9ab8107d72821e93e57df8d7495310ac /drivers | |
parent | 7e22c85918e68e6df50d01d08585f88fbbaf3456 (diff) |
dm: core: Add a new API devfdt_get_addr_index_ptr()
At present there is only devfdt_get_addr_ptr() which only returns
the first <addr, size> pair in the 'reg' property. Add a new API
devfdt_get_addr_index_ptr() to return the indexed pointer.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/core/fdtaddr.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c index 6dfda207726..c3a50a2b0c1 100644 --- a/drivers/core/fdtaddr.c +++ b/drivers/core/fdtaddr.c @@ -93,6 +93,13 @@ fdt_addr_t devfdt_get_addr_index(const struct udevice *dev, int index) #endif } +void *devfdt_get_addr_index_ptr(const struct udevice *dev, int index) +{ + fdt_addr_t addr = devfdt_get_addr_index(dev, index); + + return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)(uintptr_t)addr; +} + fdt_addr_t devfdt_get_addr_size_index(const struct udevice *dev, int index, fdt_size_t *size) { @@ -155,9 +162,7 @@ fdt_addr_t devfdt_get_addr(const struct udevice *dev) void *devfdt_get_addr_ptr(const struct udevice *dev) { - fdt_addr_t addr = devfdt_get_addr_index(dev, 0); - - return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)(uintptr_t)addr; + return devfdt_get_addr_index_ptr(dev, 0); } void *devfdt_remap_addr_index(const struct udevice *dev, int index) |