summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2016-04-21 07:11:34 +0200
committerHeiko Schocher <hs@denx.de>2016-04-25 07:30:16 +0200
commit28027521be95d27fcb83669e09ce3563bb4dd977 (patch)
treea44443906fe48409bf8ad117d04ea33b273c2484 /include
parent65341967ce9ef2656c61dcd3126536e8865c349d (diff)
downloadu-boot-28027521be95d27fcb83669e09ce3563bb4dd977.tar.gz
dm: core: Add dev_get_addr_ptr() to return a pointer to the reg address
On some platforms (e.g. x86), the return value of dev_get_addr() can't be assigned to a pointer type variable directly. As there might be a difference between the size of fdt_addr_t and the pointer type. On x86 for example, "fdt_addr_t" is 64bit but "void *" only 32bit. So assigning the register base directly in dev_get_addr() results in this compilation warning: warning: cast to pointer from integer of different size This patch introduces the new function dev_get_addr_ptr() that returns a pointer to the 'reg' address that can be used by drivers in this case. Signed-off-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/dm/device.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/dm/device.h b/include/dm/device.h
index dad7591dfa..8970fc015c 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_get_addr_ptr() - Return pointer to the address of the reg property
+ * of a device
+ *
+ * @dev: Pointer to a device
+ *
+ * @return Pointer to addr, or NULL if there is no such property
+ */
+void *dev_get_addr_ptr(struct udevice *dev);
+
+/**
* dev_get_addr_index() - Get the indexed reg property of a device
*
* @dev: Pointer to a device