From: =?UTF-8?q?C=C3=A9dric=20Schieli?= Date: Wed, 2 Nov 2016 19:06:13 +0100 Subject: [U-Boot] [PATCH 2/2] rpi: expose the firmware provided FDT blob in ${fw_fdt_addr} In-Reply-To: <1478109973-15322-1-git-send-email-cschieli@gmail.com> References: <1478109973-15322-1-git-send-email-cschieli@gmail.com> Message-ID: <1478109973-15322-3-git-send-email-cschieli@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- 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