summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/spl/spl.c45
-rw-r--r--common/spl/spl_fit.c1
2 files changed, 38 insertions, 8 deletions
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 82e7f58e80..da10c3b1c5 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -249,17 +249,13 @@ struct boot_device_name boot_name_table[] = {
{ BOOT_DEVICE_NONE, "unknown boot device" },
};
-static void announce_boot_device(u32 boot_device)
+static const char* boot_device_name(u32 boot_device)
{
- int i;
-
- puts("Trying to boot from ");
+ int i;
#ifdef CONFIG_SPL_BOARD_LOAD_IMAGE
if (boot_device == BOOT_DEVICE_BOARD) {
- spl_board_announce_boot_device();
- puts("\n");
- return;
+ return "";
}
#endif
for (i = 0; i < ARRAY_SIZE(boot_name_table) - 1; i++) {
@@ -267,7 +263,12 @@ static void announce_boot_device(u32 boot_device)
break;
}
- printf("%s\n", boot_name_table[i].name);
+ return boot_name_table[i].name;
+}
+
+static void announce_boot_device(u32 boot_device)
+{
+ printf("Trying to boot from %s\n", boot_device_name(boot_device));
}
#else
static inline void announce_boot_device(u32 boot_device) { }
@@ -381,6 +382,34 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
hang();
}
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+ if (spl_image.fdt)
+ {
+ int err;
+ int nodeoffset;
+
+ /* I don't feel happy with having a u32 for spl_image.fdt (considering ARMv8)... */
+ void* fdt = (void*)spl_image.fdt;
+
+ fdt_set_totalsize(fdt, fdt_totalsize(fdt) + 4096);
+ nodeoffset = fdt_path_offset(fdt, "/");
+ if (nodeoffset < 0) {
+ debug("FDT postprocess: did not find '/'\n");
+ } else {
+ const char* device_name = boot_device_name(spl_boot_list[i]);
+ if (device_name) {
+ err = fdt_setprop(fdt, nodeoffset, "boot-device",
+ device_name, strlen(device_name) + 1);
+
+ if (err < 0)
+ debug("ERROR on setprop: %s\n", fdt_strerror(err));
+ }
+
+ debug("FDT @ 0x%p\n", fdt);
+ }
+ }
+#endif
+
switch (spl_image.os) {
case IH_OS_U_BOOT:
debug("Jumping to U-Boot\n");
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index be86072c24..4eecafbea4 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -251,6 +251,7 @@ int spl_load_simple_fit(struct spl_load_info *info, ulong sector, void *fit)
#endif
memcpy(dst, src, fdt_len);
+ spl_image.fdt = (u32)dst;
return 0;
}