OF_BOARD allows to choose the internal device tree in runtime. Use it to
pass the external FDT as an internal one if it is not present. This
approach is also used by qcom-phone, and it reduces boot image size. It
is expected that an external FDT is present as U-Boot is packaged as an
Android boot image.

Signed-off-by: Kaustabh Chakraborty <[email protected]>
---
 board/samsung/exynos-mobile/exynos-mobile.c | 9 +++++++++
 configs/exynos-mobile_defconfig             | 1 +
 2 files changed, 10 insertions(+)

diff --git a/board/samsung/exynos-mobile/exynos-mobile.c 
b/board/samsung/exynos-mobile/exynos-mobile.c
index 412dfa7555c..1f61f28de5f 100644
--- a/board/samsung/exynos-mobile/exynos-mobile.c
+++ b/board/samsung/exynos-mobile/exynos-mobile.c
@@ -231,6 +231,15 @@ static int exynos_fastboot_setup(void)
        return 0;
 }
 
+int board_fdt_blob_setup(void **fdtp)
+{
+       /* If internal FDT is not available, use the external FDT instead. */
+       if (fdt_check_header(*fdtp))
+               *fdtp = (void *)get_prev_bl_fdt_addr();
+
+       return 0;
+}
+
 int timer_init(void)
 {
        ofnode timer_node;
diff --git a/configs/exynos-mobile_defconfig b/configs/exynos-mobile_defconfig
index ead4ea4493e..846f9e24bd3 100644
--- a/configs/exynos-mobile_defconfig
+++ b/configs/exynos-mobile_defconfig
@@ -25,6 +25,7 @@ CONFIG_CMD_POWEROFF=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_EFI_PARTITION=y
 CONFIG_OF_UPSTREAM=y
+CONFIG_OF_BOARD=y
 CONFIG_BUTTON=y
 CONFIG_BUTTON_REMAP_PHONE_KEYS=y
 CONFIG_CLK_EXYNOS7870=y

-- 
2.52.0

Reply via email to