summaryrefslogtreecommitdiff
path: root/include/dm/read.h
diff options
context:
space:
mode:
authorMario Six <mario.six@gdsys.cc>2018-01-15 13:07:19 +0300
committerSimon Glass <sjg@chromium.org>2018-01-21 20:01:02 +0300
commit147c6074482ed57fe43348ce15fc3dbc3e2c9db7 (patch)
treeab32fdb8846cab9098f4ff5f0d7118980bac83c4 /include/dm/read.h
parent83a462a5e3560800b3cdfd7253d2de7791968331 (diff)
downloadu-boot-147c6074482ed57fe43348ce15fc3dbc3e2c9db7.tar.xz
core: Add {ofnode, dev}_translate_address functions
Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Mario Six <mario.six@gdsys.cc>
Diffstat (limited to 'include/dm/read.h')
-rw-r--r--include/dm/read.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/dm/read.h b/include/dm/read.h
index 8114037e97..2551e5f0dc 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -410,6 +410,18 @@ int dev_read_resource(struct udevice *dev, uint index, struct resource *res);
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_default(struct udevice *dev,
@@ -582,6 +594,11 @@ static inline int dev_read_resource_byname(struct udevice *dev,
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 */
/**