From 13f3fcac533ae7d86083ed9eefb36f78ee851f10 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Wed, 30 Nov 2016 07:24:47 +0100 Subject: dm: core: Add dev_get_addr_size_index() to retrieve addr and size The currently available functions accessing the 'reg' property of a device only retrieve the address. Sometimes its also necessary to retrieve the size described by the 'reg' property. This patch adds the new function dev_get_addr_size_index() which retrieves both, the address and the size described by the 'reg' property. Signed-off-by: Stefan Roese Cc: Simon Glass Acked-by: Simon Glass --- include/dm/device.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include/dm') diff --git a/include/dm/device.h b/include/dm/device.h index babf8ac8f0..9948bd49fa 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -496,6 +496,22 @@ void *dev_map_physmem(struct udevice *dev, unsigned long size); */ fdt_addr_t dev_get_addr_index(struct udevice *dev, int index); +/** + * dev_get_addr_size_index() - Get the indexed reg property of a device + * + * Returns the address and size specified in the 'reg' property of a device. + * + * @dev: Pointer to a device + * @index: the 'reg' property can hold a list of pairs + * and @index is used to select which one is required + * @size: Pointer to size varible - this function returns the size + * specified in the 'reg' property here + * + * @return addr + */ +fdt_addr_t dev_get_addr_size_index(struct udevice *dev, int index, + fdt_size_t *size); + /** * dev_get_addr_name() - Get the reg property of a device, indexed by name * -- cgit