From 30a90f56c3a20da0456e09e6e665b648719b8935 Mon Sep 17 00:00:00 2001 From: Álvaro Fernández Rojas Date: Sun, 29 Apr 2018 21:56:54 +0200 Subject: dm: core: add functions to get memory-mapped I/O addresses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Álvaro Fernández Rojas Reviewed-by: Daniel Schwierzeck Signed-off-by: Daniel Schwierzeck Reviewed-by: Simon Glass --- drivers/core/read.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'drivers/core/read.c') diff --git a/drivers/core/read.c b/drivers/core/read.c index 0322cbf330..96766c7876 100644 --- a/drivers/core/read.c +++ b/drivers/core/read.c @@ -4,6 +4,8 @@ * Written by Simon Glass */ +#include +#include #include #include #include @@ -57,6 +59,16 @@ fdt_addr_t dev_read_addr_index(struct udevice *dev, int index) return devfdt_get_addr_index(dev, index); } +void *dev_remap_addr_index(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_physmem(addr, 0, MAP_NOCACHE); +} + fdt_addr_t dev_read_addr(struct udevice *dev) { return dev_read_addr_index(dev, 0); @@ -69,6 +81,11 @@ void *dev_read_addr_ptr(struct udevice *dev) return (addr == FDT_ADDR_T_NONE) ? NULL : map_sysmem(addr, 0); } +void *dev_remap_addr(struct udevice *dev) +{ + return dev_remap_addr_index(dev, 0); +} + fdt_addr_t dev_read_addr_size(struct udevice *dev, const char *property, fdt_size_t *sizep) { -- cgit