From c131c8bca86b428daef7a25c26a96af42658be21 Mon Sep 17 00:00:00 2001 From: Philipp Tomsich Date: Mon, 11 Sep 2017 22:04:12 +0200 Subject: 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 Acked-by: Philipp Tomsich Reviewed-by: Simon Glass --- include/dm/read.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include/dm') diff --git a/include/dm/read.h b/include/dm/read.h index 49d69c9..e7f7125 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -113,6 +113,16 @@ fdt_addr_t dev_read_addr_index(struct udevice *dev, int index); fdt_addr_t dev_read_addr(struct udevice *dev); /** + * dev_read_addr_ptr() - Get the reg property of a device + * as a pointer + * + * @dev: Device to read from + * + * @return pointer or NULL if not found + */ +void *dev_read_addr_ptr(struct udevice *dev); + +/** * dev_read_addr_size() - get address and size from a device property * * This does no address translation. It simply reads an property that contains @@ -417,6 +427,11 @@ static inline fdt_addr_t dev_read_addr(struct udevice *dev) return devfdt_get_addr(dev); } +static inline void *dev_read_addr_ptr(struct udevice *dev) +{ + return devfdt_get_addr_ptr(dev); +} + static inline fdt_addr_t dev_read_addr_size(struct udevice *dev, const char *propname, fdt_size_t *sizep) -- cgit v1.1