}
#ifndef CONFIG_DM_DEV_READ_INLINE
+/**
+ * dev_read_u32() - read a 32-bit integer from a device's DT property
+ *
+ * @dev: device to read DT property from
+ * @propname: name of the property to read from
+ * @outp: place to put value (if found)
+ * @return 0 if OK, -ve on error
+ */
+int dev_read_u32(struct udevice *dev, const char *propname, u32 *outp);
+
/**
* dev_read_u32_default() - read a 32-bit integer from a device's DT property
*
* This walks back up the tree to find the closest #address-cells property
* which controls the given node.
*
- * @dev: devioe to check
+ * @dev: device to check
* @return number of address cells this node uses
*/
int dev_read_addr_cells(struct udevice *dev);
* This walks back up the tree to find the closest #size-cells property
* which controls the given node.
*
- * @dev: devioe to check
+ * @dev: device to check
* @return number of size cells this node uses
*/
int dev_read_size_cells(struct udevice *dev);
*
* This function matches fdt_address_cells().
*
- * @dev: devioe to check
+ * @dev: device to check
* @return number of address cells this node uses
*/
int dev_read_simple_addr_cells(struct udevice *dev);
*
* This function matches fdt_size_cells().
*
- * @dev: devioe to check
+ * @dev: device to check
* @return number of size cells this node uses
*/
int dev_read_simple_size_cells(struct udevice *dev);
int dev_read_resource_byname(struct udevice *dev, const char *name,
struct resource *res);
+/**
+ * dev_translate_address() - Tranlate a device-tree address
+ *
+ * Translate an address from the device-tree into a CPU physical address. This
+ * function walks up the tree and applies the various bus mappings along the
+ * way.
+ *
+ * @dev: device giving the context in which to translate the address
+ * @in_addr: pointer to the address to translate
+ * @return the translated address; OF_BAD_ADDR on error
+ */
+u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr);
#else /* CONFIG_DM_DEV_READ_INLINE is enabled */
+static inline int dev_read_u32(struct udevice *dev,
+ const char *propname, u32 *outp)
+{
+ return ofnode_read_u32(dev_ofnode(dev), propname, outp);
+}
+
static inline int dev_read_u32_default(struct udevice *dev,
const char *propname, int def)
{
return ofnode_read_resource_byname(dev_ofnode(dev), name, res);
}
+static inline u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr)
+{
+ return ofnode_translate_address(dev_ofnode(dev), in_addr);
+}
+
#endif /* CONFIG_DM_DEV_READ_INLINE */
/**