diff options
author | Stefan Roese <sr@denx.de> | 2015-12-14 15:18:15 (GMT) |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2016-01-12 17:19:09 (GMT) |
commit | 66eaea6cd152a0dae5964930483f68d92047b2f5 (patch) | |
tree | 725a81c3cb8c4a31acc58ea706e735b8e1171573 /drivers/core/device.c | |
parent | 9b20519887ab39b389cd3e178c11d5bdb19c92e6 (diff) | |
download | u-boot-66eaea6cd152a0dae5964930483f68d92047b2f5.tar.xz |
dm: core: Add option to configure an offset for the address translation
Some platforms need to ability to configure an offset to the standard
addresses extracted from the device-tree. This patch allows this by
adding a function to DM to configure this offset (if needed).
Signed-off-by: Stefan Roese <sr@denx.de>
Acked-by: Simon Glass <sjg@chromium.org>
Cc: Simon Glass <sjg@chromium.org>
Fixed space before tab:
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/device.c')
-rw-r--r-- | drivers/core/device.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c index 758f390..7a02a93 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -597,22 +597,31 @@ fdt_addr_t dev_get_addr(struct udevice *dev) * Use the full-fledged translate function for complex * bus setups. */ - return fdt_translate_address((void *)gd->fdt_blob, + addr = fdt_translate_address((void *)gd->fdt_blob, dev->of_offset, reg); + } else { + /* + * 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", + 0, NULL); + if (CONFIG_IS_ENABLED(SIMPLE_BUS) && addr != FDT_ADDR_T_NONE) { + if (device_get_uclass_id(dev->parent) == + UCLASS_SIMPLE_BUS) + addr = simple_bus_translate(dev->parent, addr); + } } /* - * Use the "simple" translate function for less complex - * bus setups. + * Some platforms need a special address translation. Those + * platforms (e.g. mvebu in SPL) can configure a translation + * offset in the DM by calling dm_set_translation_offset() that + * will get added to all addresses returned by dev_get_addr(). */ - addr = fdtdec_get_addr_size_auto_parent(gd->fdt_blob, - dev->parent->of_offset, - dev->of_offset, "reg", - 0, NULL); - if (CONFIG_IS_ENABLED(SIMPLE_BUS) && addr != FDT_ADDR_T_NONE) { - if (device_get_uclass_id(dev->parent) == UCLASS_SIMPLE_BUS) - addr = simple_bus_translate(dev->parent, addr); - } + addr += dm_get_translation_offset(); return addr; #else |