diff options
author | Álvaro Fernández Rojas <noltari@gmail.com> | 2018-12-03 21:37:09 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-12-05 16:06:44 +0300 |
commit | 7959882049a9b389c131eff9a128437ee8ebe08e (patch) | |
tree | a0b31f0e5dbf3d95ae731918a675c075614db3be /drivers/core/fdtaddr.c | |
parent | bb48470df21c0ce4ebed47f5dc3ea25ff02fd4dd (diff) | |
download | u-boot-7959882049a9b389c131eff9a128437ee8ebe08e.tar.xz |
dm: core: add functions to get/remap I/O addresses by name
This functions allow us to get and remap I/O addresses by name, which is useful when there are multiple reg addresses indexed by reg-names property.
This is needed in bmips dma/eth patch series, but can also be used on many
other drivers.
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/fdtaddr.c')
-rw-r--r-- | drivers/core/fdtaddr.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c index bfd9580050..e113f1dd39 100644 --- a/drivers/core/fdtaddr.c +++ b/drivers/core/fdtaddr.c @@ -146,6 +146,16 @@ void *devfdt_remap_addr_index(struct udevice *dev, int index) return map_physmem(addr, 0, MAP_NOCACHE); } +void *devfdt_remap_addr_name(struct udevice *dev, const char *name) +{ + fdt_addr_t addr = devfdt_get_addr_name(dev, name); + + if (addr == FDT_ADDR_T_NONE) + return NULL; + + return map_physmem(addr, 0, MAP_NOCACHE); +} + void *devfdt_remap_addr(struct udevice *dev) { return devfdt_remap_addr_index(dev, 0); |