diff options
author | Stefan Roese <sr@denx.de> | 2015-09-02 05:41:12 (GMT) |
---|---|---|
committer | Luka Perkov <luka.perkov@sartura.hr> | 2015-10-21 00:25:01 (GMT) |
commit | ef5cd33064f83db6f6cfe774ecdb36e32ac1d232 (patch) | |
tree | 3796637b5662df34940d24fcd25f54ecf6300db8 /drivers/core/device.c | |
parent | 42cc034f19d30a3e0f1a63788347e039315806a0 (diff) | |
download | u-boot-ef5cd33064f83db6f6cfe774ecdb36e32ac1d232.tar.xz |
dm: core: Enable optional use of fdt_translate_address()
The current "simple" address translation simple_bus_translate() is not
working on some platforms (e.g. MVEBU). As here more complex "ranges"
properties are used in many nodes (multiple tuples etc). This patch
enables the optional use of the common fdt_translate_address() function
which handles this translation correctly.
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'drivers/core/device.c')
-rw-r--r-- | drivers/core/device.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c index 833a803..a3dc2ca 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -11,6 +11,7 @@ #include <common.h> #include <fdtdec.h> +#include <fdt_support.h> #include <malloc.h> #include <dm/device.h> #include <dm/device-internal.h> @@ -585,6 +586,25 @@ fdt_addr_t dev_get_addr(struct udevice *dev) #if CONFIG_IS_ENABLED(OF_CONTROL) fdt_addr_t addr; + if (CONFIG_IS_ENABLED(OF_TRANSLATE)) { + const fdt32_t *reg; + + reg = fdt_getprop(gd->fdt_blob, dev->of_offset, "reg", NULL); + if (!reg) + return FDT_ADDR_T_NONE; + + /* + * Use the full-fledged translate function for complex + * bus setups. + */ + return fdt_translate_address((void *)gd->fdt_blob, + dev->of_offset, reg); + } + + /* + * Use the "simple" translate function for less complex + * bus setups. + */ addr = fdtdec_get_addr_size_auto_parent(gd->fdt_blob, dev->parent->of_offset, dev->of_offset, "reg", |