mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-11 15:37:23 +00:00
core: read: add dev_read_addr_index_ptr function
Add dev_read_addr_index_ptr function with the same functionality as dev_read_addr_index, but instead a return pointer is given. Use map_sysmem() function as cast for the return. Make same fix for dev_read_addr_ptr() function. Signed-off-by: Johan Jonker <jbx6244@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
aa4f61a776
commit
b526656c5b
1 changed files with 14 additions and 1 deletions
|
@ -131,6 +131,16 @@ fdt_addr_t dev_read_addr_index(const struct udevice *dev, int index)
|
||||||
return devfdt_get_addr_index(dev, index);
|
return devfdt_get_addr_index(dev, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *dev_read_addr_index_ptr(const struct udevice *dev, int index)
|
||||||
|
{
|
||||||
|
fdt_addr_t addr = dev_read_addr_index(dev, index);
|
||||||
|
|
||||||
|
if (addr == FDT_ADDR_T_NONE)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return map_sysmem(addr, 0);
|
||||||
|
}
|
||||||
|
|
||||||
fdt_addr_t dev_read_addr_size_index(const struct udevice *dev, int index,
|
fdt_addr_t dev_read_addr_size_index(const struct udevice *dev, int index,
|
||||||
fdt_size_t *size)
|
fdt_size_t *size)
|
||||||
{
|
{
|
||||||
|
@ -190,7 +200,10 @@ void *dev_read_addr_ptr(const struct udevice *dev)
|
||||||
{
|
{
|
||||||
fdt_addr_t addr = dev_read_addr(dev);
|
fdt_addr_t addr = dev_read_addr(dev);
|
||||||
|
|
||||||
return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)(uintptr_t)addr;
|
if (addr == FDT_ADDR_T_NONE)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return map_sysmem(addr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *dev_remap_addr(const struct udevice *dev)
|
void *dev_remap_addr(const struct udevice *dev)
|
||||||
|
|
Loading…
Reference in a new issue