aboutsummaryrefslogtreecommitdiff
path: root/include/dm
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias.schiffer@ew.tq-group.com>2023-09-27 15:33:32 +0200
committerSimon Glass <sjg@chromium.org>2023-10-13 10:15:41 -0700
commitbc8fa1cbfd429138ebd894a170ce36b07f86b150 (patch)
treeff4ca06372ea8711b4c9ce8f2b5b4e754e5edb81 /include/dm
parente367305769d091bc8a0026d69136eb77fd055784 (diff)
downloadu-boot-bc8fa1cbfd429138ebd894a170ce36b07f86b150.zip
u-boot-bc8fa1cbfd429138ebd894a170ce36b07f86b150.tar.gz
u-boot-bc8fa1cbfd429138ebd894a170ce36b07f86b150.tar.bz2
core: introduce dev_read_addr_name[_size]_ptr() functions
Same as dev_read_addr_name[_size](), but returns a pointer, cast through map_sysmem(). Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/dm')
-rw-r--r--include/dm/fdtaddr.h31
-rw-r--r--include/dm/read.h41
2 files changed, 72 insertions, 0 deletions
diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
index c577d43..bf8132d 100644
--- a/include/dm/fdtaddr.h
+++ b/include/dm/fdtaddr.h
@@ -147,6 +147,19 @@ void *devfdt_get_addr_size_index_ptr(const struct udevice *dev, int index,
fdt_addr_t devfdt_get_addr_name(const struct udevice *dev, const char *name);
/**
+ * devfdt_get_addr_name_ptr() - Get the reg property of a device as a pointer,
+ * indexed by name
+ *
+ * @dev: Pointer to a device
+ * @name: the 'reg' property can hold a list of <addr, size> pairs, with the
+ * 'reg-names' property providing named-based identification. @name
+ * indicates the value to search for in 'reg-names'.
+ *
+ * Return: Pointer to addr, or NULL if there is no such property
+ */
+void *devfdt_get_addr_name_ptr(const struct udevice *dev, const char *name);
+
+/**
* devfdt_get_addr_size_name() - Get the reg property and its size for a device,
* indexed by name
*
@@ -165,6 +178,24 @@ fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev,
const char *name, fdt_size_t *size);
/**
+ * devfdt_get_addr_size_name_ptr() - Get the reg property for a device as a
+ * pointer, indexed by name
+ *
+ * Returns the address and size specified in the 'reg' property of a device.
+ *
+ * @dev: Pointer to a device
+ * @name: the 'reg' property can hold a list of <addr, size> pairs, with the
+ * 'reg-names' property providing named-based identification. @name
+ * indicates the value to search for in 'reg-names'.
+ * @size: Pointer to size variable - this function returns the size
+ * specified in the 'reg' property here
+ *
+ * Return: Pointer to addr, or NULL if there is no such property
+ */
+void *devfdt_get_addr_size_name_ptr(const struct udevice *dev,
+ const char *name, fdt_size_t *size);
+
+/**
* devfdt_get_addr_pci() - Read an address and handle PCI address translation
*
* @dev: Device to read from
diff --git a/include/dm/read.h b/include/dm/read.h
index 517795c..894bc69 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -285,6 +285,19 @@ void *dev_remap_addr_index(const struct udevice *dev, int index);
fdt_addr_t dev_read_addr_name(const struct udevice *dev, const char *name);
/**
+ * dev_read_addr_name_ptr() - Get the reg property of a device as a pointer,
+ * 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. @name
+ * indicates the value to search for in 'reg-names'.
+ *
+ * Return: pointer or NULL if not found
+ */
+void *dev_read_addr_name_ptr(const 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
@@ -299,6 +312,21 @@ fdt_addr_t dev_read_addr_size_name(const struct udevice *dev, const char *name,
fdt_size_t *size);
/**
+ * dev_read_addr_size_name_ptr() - Get the reg property of a device as a pointer,
+ * 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. @name
+ * indicates the value to search for in 'reg-names'.
+ * @size: place to put size value (on success)
+ *
+ * Return: pointer or NULL if not found
+ */
+void *dev_read_addr_size_name_ptr(const 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
*
@@ -980,6 +1008,12 @@ static inline fdt_addr_t dev_read_addr_name(const struct udevice *dev,
return devfdt_get_addr_name(dev, name);
}
+static inline void *dev_read_addr_name_ptr(const struct udevice *dev,
+ const char *name)
+{
+ return devfdt_get_addr_name_ptr(dev, name);
+}
+
static inline fdt_addr_t dev_read_addr_size_name(const struct udevice *dev,
const char *name,
fdt_size_t *size)
@@ -987,6 +1021,13 @@ static inline fdt_addr_t dev_read_addr_size_name(const struct udevice *dev,
return devfdt_get_addr_size_name(dev, name, size);
}
+static inline void *dev_read_addr_size_name_ptr(const struct udevice *dev,
+ const char *name,
+ fdt_size_t *size)
+{
+ return devfdt_get_addr_size_name_ptr(dev, name, size);
+}
+
static inline fdt_addr_t dev_read_addr(const struct udevice *dev)
{
return devfdt_get_addr(dev);