summaryrefslogtreecommitdiff
path: root/include/dm/read.h
diff options
context:
space:
mode:
authorSekhar Nori <nsekhar@ti.com>2019-08-01 19:12:56 +0530
committerTom Rini <trini@konsulko.com>2019-08-12 13:33:39 -0400
commitf5b904796fa876bbfdf6eb9d2b311f9d01d80f5a (patch)
tree696d7835d6784adde746d196fcd455ca59a59401 /include/dm/read.h
parentacbb7cd4d34caec36ff6d044a8f55325fa27459f (diff)
dm: core: add support for getting register address and size
Current dev_read_*() API lacks support to get address and size of a "reg" property by name or index. Add support for the same. Livetree support has been added but not tested on real hardware. The existing unit tests testing reading address from device-tree have been updated to test address as well as size. Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Diffstat (limited to 'include/dm/read.h')
-rw-r--r--include/dm/read.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/include/dm/read.h b/include/dm/read.h
index 6ecd062e20..0c62d62f11 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -145,6 +145,19 @@ int dev_read_size(struct udevice *dev, const char *propname);
fdt_addr_t dev_read_addr_index(struct udevice *dev, int index);
/**
+ * dev_read_addr_size_index() - Get the indexed reg property of a device
+ *
+ * @dev: Device to read from
+ * @index: the 'reg' property can hold a list of <addr, size> pairs
+ * and @index is used to select which one is required
+ * @size: place to put size value (on success)
+ *
+ * @return address or FDT_ADDR_T_NONE if not found
+ */
+fdt_addr_t dev_read_addr_size_index(struct udevice *dev, int index,
+ fdt_size_t *size);
+
+/**
* dev_remap_addr_index() - Get the indexed reg property of a device
* as a memory-mapped I/O pointer
*
@@ -169,6 +182,20 @@ void *dev_remap_addr_index(struct udevice *dev, int index);
fdt_addr_t dev_read_addr_name(struct udevice *dev, const char* name);
/**
+ * dev_read_addr_size_name() - Get the reg property of a device, indexed by name
+ *
+ * @dev: Device to read from
+ * @name: the 'reg' property can hold a list of <addr, size> pairs, with the
+ * 'reg-names' property providing named-based identification. @index
+ * indicates the value to search for in 'reg-names'.
+ * @size: place to put size value (on success)
+ *
+ * @return address or FDT_ADDR_T_NONE if not found
+ */
+fdt_addr_t dev_read_addr_size_name(struct udevice *dev, const char *name,
+ fdt_size_t *size);
+
+/**
* dev_remap_addr_name() - Get the reg property of a device, indexed by name,
* as a memory-mapped I/O pointer
*
@@ -601,12 +628,26 @@ static inline fdt_addr_t dev_read_addr_index(struct udevice *dev, int index)
return devfdt_get_addr_index(dev, index);
}
+static inline fdt_addr_t dev_read_addr_size_index(struct udevice *dev,
+ int index,
+ fdt_size_t *size)
+{
+ return devfdt_get_addr_size_index(dev, index, size);
+}
+
static inline fdt_addr_t dev_read_addr_name(struct udevice *dev,
const char *name)
{
return devfdt_get_addr_name(dev, name);
}
+static inline fdt_addr_t dev_read_addr_size_name(struct udevice *dev,
+ const char *name,
+ fdt_size_t *size)
+{
+ return devfdt_get_addr_size_name(dev, name, size);
+}
+
static inline fdt_addr_t dev_read_addr(struct udevice *dev)
{
return devfdt_get_addr(dev);