summaryrefslogtreecommitdiff
path: root/drivers/core/read.c
diff options
context:
space:
mode:
authorPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>2017-09-11 22:04:12 +0200
committerPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>2017-09-18 20:40:33 +0200
commitc131c8bca86b428daef7a25c26a96af42658be21 (patch)
tree6c1c54186ec70dfb19f6d41c925fdc78bc65f4cc /drivers/core/read.c
parentaf823151641b1a9a8eae8c3b111f5fa27e6873ac (diff)
downloadu-boot-c131c8bca86b428daef7a25c26a96af42658be21.tar.gz
dm: core: add dev_read_addr_ptr()
The dev_read_addr_ptr() mimics the behaviour of the devfdt_get_addr_ptr(), retrieving the first address of the node's reg-property and returning it as a pointer (or NULL on failure). Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/read.c')
-rw-r--r--drivers/core/read.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/core/read.c b/drivers/core/read.c
index 6acb33388f..065589a6ab 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -57,6 +57,13 @@ fdt_addr_t dev_read_addr(struct udevice *dev)
return dev_read_addr_index(dev, 0);
}
+void *dev_read_addr_ptr(struct udevice *dev)
+{
+ fdt_addr_t addr = dev_read_addr(dev);
+
+ return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)addr;
+}
+
fdt_addr_t dev_read_addr_size(struct udevice *dev, const char *property,
fdt_size_t *sizep)
{