summaryrefslogtreecommitdiff
path: root/drivers/core/read.c
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2018-04-29 21:56:54 +0200
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>2018-06-01 15:56:02 +0200
commit30a90f56c3a20da0456e09e6e665b648719b8935 (patch)
treecb89e7bcd28929b59dc90cb5cced979d9b19b090 /drivers/core/read.c
parentc3c863880479edeb5b08226e622d13c91326e4a7 (diff)
dm: core: add functions to get memory-mapped I/O addresses
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/read.c')
-rw-r--r--drivers/core/read.c17
1 files changed, 17 insertions, 0 deletions
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 <sjg@chromium.org>
*/
+#include <asm/types.h>
+#include <asm/io.h>
#include <common.h>
#include <dm.h>
#include <mapmem.h>
@@ -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)
{