summaryrefslogtreecommitdiff
path: root/drivers/core/device.c
diff options
context:
space:
mode:
authorVignesh R <vigneshr@ti.com>2016-07-06 04:28:55 (GMT)
committerJagan Teki <jteki@openedev.com>2016-07-09 14:46:08 (GMT)
commit7c616862553e37c89ea5db399961018a7367ca33 (patch)
tree9a1a71c35a2e8abc20d882fd0b6358140f32bb2a /drivers/core/device.c
parentc8864d720926c6b136aa9aa97fd1d4410250d271 (diff)
downloadu-boot-7c616862553e37c89ea5db399961018a7367ca33.tar.xz
dm: core: implement dev_map_physmem()
This API helps to map physical register addresss pace of device to virtual address space easily. Its just a wrapper around map_physmem() with MAP_NOCACHE flag. Signed-off-by: Vignesh R <vigneshr@ti.com> Suggested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jagan Teki <jteki@openedev.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Jagan Teki <jteki@openedev.com>
Diffstat (limited to 'drivers/core/device.c')
-rw-r--r--drivers/core/device.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c
index eb75b17..f7fb0cc 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -10,6 +10,7 @@
*/
#include <common.h>
+#include <asm/io.h>
#include <fdtdec.h>
#include <fdt_support.h>
#include <malloc.h>
@@ -697,6 +698,16 @@ void *dev_get_addr_ptr(struct udevice *dev)
return (void *)(uintptr_t)dev_get_addr_index(dev, 0);
}
+void *dev_map_physmem(struct udevice *dev, unsigned long size)
+{
+ fdt_addr_t addr = dev_get_addr(dev);
+
+ if (addr == FDT_ADDR_T_NONE)
+ return NULL;
+
+ return map_physmem(addr, size, MAP_NOCACHE);
+}
+
bool device_has_children(struct udevice *dev)
{
return !list_empty(&dev->child_head);