aboutsummaryrefslogtreecommitdiff
path: root/drivers/core
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas2018-04-29 21:56:54 +0200
committerDaniel Schwierzeck2018-06-01 15:56:02 +0200
commit30a90f56c3a20da0456e09e6e665b648719b8935 (patch)
treecb89e7bcd28929b59dc90cb5cced979d9b19b090 /drivers/core
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')
-rw-r--r--drivers/core/fdtaddr.c15
-rw-r--r--drivers/core/read.c17
2 files changed, 32 insertions, 0 deletions
diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
index 528cf472960..f8cdbd6688d 100644
--- a/drivers/core/fdtaddr.c
+++ b/drivers/core/fdtaddr.c
@@ -136,6 +136,21 @@ void *devfdt_get_addr_ptr(struct udevice *dev)
return (void *)(uintptr_t)devfdt_get_addr_index(dev, 0);
}
+void *devfdt_remap_addr_index(struct udevice *dev, int index)
+{
+ fdt_addr_t addr = devfdt_get_addr(dev);
+
+ 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);
+}
+
void *devfdt_map_physmem(struct udevice *dev, unsigned long size)
{
fdt_addr_t addr = devfdt_get_addr(dev);
diff --git a/drivers/core/read.c b/drivers/core/read.c
index 0322cbf3300..96766c7876a 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)
{