diff options
author | Stefan Roese | 2015-12-14 16:18:15 +0100 |
---|---|---|
committer | Simon Glass | 2016-01-12 10:19:09 -0700 |
commit | 66eaea6cd152a0dae5964930483f68d92047b2f5 (patch) | |
tree | 725a81c3cb8c4a31acc58ea706e735b8e1171573 /drivers/core/root.c | |
parent | 9b20519887ab39b389cd3e178c11d5bdb19c92e6 (diff) |
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/root.c')
-rw-r--r-- | drivers/core/root.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/core/root.c b/drivers/core/root.c index e7b1f249682..13c2713e615 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -23,6 +23,10 @@ DECLARE_GLOBAL_DATA_PTR; +struct root_priv { + fdt_addr_t translation_offset; /* optional translation offset */ +}; + static const struct driver_info root_info = { .name = "root_driver", }; @@ -37,6 +41,22 @@ struct udevice *dm_root(void) return gd->dm_root; } +fdt_addr_t dm_get_translation_offset(void) +{ + struct udevice *root = dm_root(); + struct root_priv *priv = dev_get_priv(root); + + return priv->translation_offset; +} + +void dm_set_translation_offset(fdt_addr_t offs) +{ + struct udevice *root = dm_root(); + struct root_priv *priv = dev_get_priv(root); + + priv->translation_offset = offs; +} + #if defined(CONFIG_NEEDS_MANUAL_RELOC) void fix_drivers(void) { @@ -228,6 +248,7 @@ int dm_init_and_scan(bool pre_reloc_only) U_BOOT_DRIVER(root_driver) = { .name = "root_driver", .id = UCLASS_ROOT, + .priv_auto_alloc_size = sizeof(struct root_priv), }; /* This is the root uclass */ |