summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-uniphier
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2019-07-10 20:07:48 +0900
committerMasahiro Yamada <yamada.masahiro@socionext.com>2019-07-10 22:42:07 +0900
commit3cc936d8ab508855b095bbd7fecb02b21cf82f32 (patch)
tree3f6d78a628db83704009792325c71e3a0afeedd4 /arch/arm/mach-uniphier
parent72cd83ab81969b970247c6c74e710cdce2c2bdae (diff)
downloadu-boot-3cc936d8ab508855b095bbd7fecb02b21cf82f32.tar.gz
u-boot-3cc936d8ab508855b095bbd7fecb02b21cf82f32.tar.xz
u-boot-3cc936d8ab508855b095bbd7fecb02b21cf82f32.zip
ARM: uniphier: set loadaddr at boot-time
The base of DRAM will be changed for the next generation SoC. To support it along with existing SoCs in the single defconfig, set 'loadaddr' at boot-time by adding the offset to the DRAM base. CONFIG_SYS_LOAD_ADDR is still hard-coded for compilation, but the value from environment variable 'loadaddr' should be used. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'arch/arm/mach-uniphier')
-rw-r--r--arch/arm/mach-uniphier/board_late_init.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/arch/arm/mach-uniphier/board_late_init.c b/arch/arm/mach-uniphier/board_late_init.c
index 37b375c019..dbd1f17e83 100644
--- a/arch/arm/mach-uniphier/board_late_init.c
+++ b/arch/arm/mach-uniphier/board_late_init.c
@@ -66,6 +66,36 @@ fail:
pr_warn("\"fdt_file\" environment variable was not set correctly\n");
}
+static void uniphier_set_env_addr(const char *env, const char *offset_env)
+{
+ unsigned long offset = 0;
+ const char *str;
+ char *end;
+ int ret;
+
+ if (env_get(env))
+ return; /* do nothing if it is already set */
+
+ if (offset_env) {
+ str = env_get(offset_env);
+ if (!str)
+ goto fail;
+
+ offset = simple_strtoul(str, &end, 16);
+ if (*end)
+ goto fail;
+ }
+
+ ret = env_set_hex(env, gd->ram_base + offset);
+ if (ret)
+ goto fail;
+
+ return;
+
+fail:
+ pr_warn("\"%s\" environment variable was not set correctly\n", env);
+}
+
int board_late_init(void)
{
puts("MODE: ");
@@ -105,5 +135,7 @@ int board_late_init(void)
uniphier_set_env_fdt_file();
+ uniphier_set_env_addr("loadaddr", "loadaddr_offset");
+
return 0;
}