diff options
author | Matthias Schiffer <matthias.schiffer@ew.tq-group.com> | 2023-09-27 15:33:32 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2023-10-13 10:15:41 -0700 |
commit | bc8fa1cbfd429138ebd894a170ce36b07f86b150 (patch) | |
tree | ff4ca06372ea8711b4c9ce8f2b5b4e754e5edb81 /drivers | |
parent | e367305769d091bc8a0026d69136eb77fd055784 (diff) | |
download | u-boot-bc8fa1cbfd429138ebd894a170ce36b07f86b150.tar.gz u-boot-bc8fa1cbfd429138ebd894a170ce36b07f86b150.tar.bz2 u-boot-bc8fa1cbfd429138ebd894a170ce36b07f86b150.zip |
core: introduce dev_read_addr_name[_size]_ptr() functions
Same as dev_read_addr_name[_size](), but returns a pointer, cast
through map_sysmem().
Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/core/fdtaddr.c | 21 | ||||
-rw-r--r-- | drivers/core/read.c | 21 |
2 files changed, 42 insertions, 0 deletions
diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c index 0f4eff6707..8e774d49ce 100644 --- a/drivers/core/fdtaddr.c +++ b/drivers/core/fdtaddr.c @@ -153,6 +153,16 @@ fdt_addr_t devfdt_get_addr_name(const struct udevice *dev, const char *name) #endif } +void *devfdt_get_addr_name_ptr(const 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_sysmem(addr, 0); +} + fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev, const char *name, fdt_size_t *size) { @@ -170,6 +180,17 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev, #endif } +void *devfdt_get_addr_size_name_ptr(const struct udevice *dev, + const char *name, fdt_size_t *size) +{ + fdt_addr_t addr = devfdt_get_addr_size_name(dev, name, size); + + if (addr == FDT_ADDR_T_NONE) + return NULL; + + return map_sysmem(addr, 0); +} + fdt_addr_t devfdt_get_addr(const struct udevice *dev) { return devfdt_get_addr_index(dev, 0); diff --git a/drivers/core/read.c b/drivers/core/read.c index 419013451f..1a4a95cdde 100644 --- a/drivers/core/read.c +++ b/drivers/core/read.c @@ -181,6 +181,16 @@ fdt_addr_t dev_read_addr_name(const struct udevice *dev, const char *name) return dev_read_addr_index(dev, index); } +void *dev_read_addr_name_ptr(const struct udevice *dev, const char *name) +{ + fdt_addr_t addr = dev_read_addr_name(dev, name); + + if (addr == FDT_ADDR_T_NONE) + return NULL; + + return map_sysmem(addr, 0); +} + fdt_addr_t dev_read_addr_size_name(const struct udevice *dev, const char *name, fdt_size_t *size) { @@ -192,6 +202,17 @@ fdt_addr_t dev_read_addr_size_name(const struct udevice *dev, const char *name, return dev_read_addr_size_index(dev, index, size); } +void *dev_read_addr_size_name_ptr(const struct udevice *dev, const char *name, + fdt_size_t *size) +{ + fdt_addr_t addr = dev_read_addr_size_name(dev, name, size); + + if (addr == FDT_ADDR_T_NONE) + return NULL; + + return map_sysmem(addr, 0); +} + void *dev_remap_addr_name(const struct udevice *dev, const char *name) { fdt_addr_t addr = dev_read_addr_name(dev, name); |