If the fw_boot_param saved at an early stage points to a valid FDT
blob, let's expose it in ${fw_fdt_addr}.

Signed-off-by: Cédric Schieli <cschi...@gmail.com>
---

 board/raspberrypi/rpi/rpi.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index 6245b36..7261bc5 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -285,6 +285,24 @@ static void set_fdtfile(void)
        setenv("fdtfile", fdtfile);
 }
 
+/*
+ * If the firmware provided us with a valid FDT at boot time, let's expose it
+ * in ${fw_fdt_addr} so it may be passed unmodified to the kernel.
+ */
+static void set_fw_fdt_addr(void)
+{
+       char s[3 + 2 * sizeof(fw_boot_param)];
+
+       if (getenv("fw_fdt_addr"))
+               return;
+
+       if (fdt_magic(fw_boot_param) != FDT_MAGIC)
+               return;
+
+       snprintf(s, sizeof(s), "0x%X", (unsigned int)fw_boot_param);
+       setenv("fw_fdt_addr", s);
+}
+
 static void set_usbethaddr(void)
 {
        ALLOC_CACHE_ALIGN_BUFFER(struct msg_get_mac_address, msg, 1);
@@ -356,6 +374,7 @@ static void set_serial_number(void)
 
 int misc_init_r(void)
 {
+       set_fw_fdt_addr();
        set_fdtfile();
        set_usbethaddr();
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-- 
2.7.3

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to