aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMario Six <mario.six@gdsys.cc>2018-01-15 11:07:19 +0100
committerSimon Glass <sjg@chromium.org>2018-01-21 10:01:02 -0700
commit147c6074482ed57fe43348ce15fc3dbc3e2c9db7 (patch)
treeab32fdb8846cab9098f4ff5f0d7118980bac83c4 /drivers
parent83a462a5e3560800b3cdfd7253d2de7791968331 (diff)
downloadu-boot-147c6074482ed57fe43348ce15fc3dbc3e2c9db7.zip
u-boot-147c6074482ed57fe43348ce15fc3dbc3e2c9db7.tar.gz
u-boot-147c6074482ed57fe43348ce15fc3dbc3e2c9db7.tar.bz2
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 'drivers')
-rw-r--r--drivers/core/ofnode.c8
-rw-r--r--drivers/core/read.c5
2 files changed, 13 insertions, 0 deletions
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index e0428e2..98f4b53 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -649,3 +649,11 @@ int ofnode_read_resource_byname(ofnode node, const char *name,
return ofnode_read_resource(node, index, res);
}
+
+u64 ofnode_translate_address(ofnode node, const fdt32_t *in_addr)
+{
+ if (ofnode_is_np(node))
+ return of_translate_address(ofnode_to_np(node), in_addr);
+ else
+ return fdt_translate_address(gd->fdt_blob, ofnode_to_offset(node), in_addr);
+}
diff --git a/drivers/core/read.c b/drivers/core/read.c
index aba8747..ce33ecd 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -195,3 +195,8 @@ int dev_read_resource_byname(struct udevice *dev, const char *name,
{
return ofnode_read_resource_byname(dev_ofnode(dev), name, res);
}
+
+u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr)
+{
+ return ofnode_translate_address(dev_ofnode(dev), in_addr);
+}