[U-Boot] [PATCH v3 01/12] dm: core: implement dev_map_phsymem()
Vignesh R
vigneshr at ti.com
Wed May 4 13:19:21 CEST 2016
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 at ti.com>
Suggested-by: Simon Glass <sjg at chromium.org>
---
v3: Explicitly include header file
v2: New patch
drivers/core/device.c | 6 ++++++
include/dm/device.h | 9 +++++++++
2 files changed, 15 insertions(+)
diff --git a/drivers/core/device.c b/drivers/core/device.c
index 1322991d6c7b..6b19b4b8c7a0 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>
@@ -678,6 +679,11 @@ 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)
+{
+ return map_physmem(dev_get_addr(dev), size, MAP_NOCACHE);
+}
+
bool device_has_children(struct udevice *dev)
{
return !list_empty(&dev->child_head);
diff --git a/include/dm/device.h b/include/dm/device.h
index 8970fc015c7e..5253b5410d9a 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -463,6 +463,15 @@ fdt_addr_t dev_get_addr(struct udevice *dev);
*/
void *dev_get_addr_ptr(struct udevice *dev);
+/* * dev_map_physmem() - Map bus memory into CPU space
+ *
+ * @dev: Pointer to device
+ * @size: size of the memory to map
+ *
+ * @return addr
+ */
+void *dev_map_physmem(struct udevice *dev, unsigned long size);
+
/**
* dev_get_addr_index() - Get the indexed reg property of a device
*
--
2.8.2
More information about the U-Boot
mailing list