[U-Boot] [PATCH v2 01/12] dm: core: implement dev_map_phsymem()

Vignesh R vigneshr at ti.com
Mon Apr 25 12:59:55 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>
---

v2: New patch

 drivers/core/device.c |  5 +++++
 include/dm/device.h   | 10 ++++++++++
 2 files changed, 15 insertions(+)

diff --git a/drivers/core/device.c b/drivers/core/device.c
index 269087a084cf..61af70efcef7 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -673,6 +673,11 @@ fdt_addr_t dev_get_addr(struct udevice *dev)
 	return 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 dad7591dfacb..0d3e3ed34870 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -454,6 +454,16 @@ int device_find_next_child(struct udevice **devp);
 fdt_addr_t dev_get_addr(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
  *
  * @dev: Pointer to a device
-- 
2.8.1



More information about the U-Boot mailing list