]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board: sifive: overwrite board_fdt_blob_setup in u-boot proper
authorZong Li <zong.li@sifive.com>
Tue, 27 Jul 2021 09:06:59 +0000 (17:06 +0800)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Tue, 17 Aug 2021 11:28:37 +0000 (19:28 +0800)
Add board_fdt_blob_setup to return the device tree location which is
passed by prior stage in u-boot proper. The generic board_fdt_blob_setup
always returns _end, it mignt be ok because u-boot SPL would currently
put the dtb there, but it would be broken if we put the dtb to another
place and assigned the location into a1 register for u-boot proper. Use
the location passed by prior stage would make more sence, because we
actually pass the location to u-boot proper and want to use that one,
rather than the dtb which in _end.

We can't use CONFIG_OF_PRIOR_STAGE because it doens't distinguish the
implementation of u-boot SPL and u-boot proper, so u-boot SPL need to
reply on the prior stage to pass device tree location as well, but we
don't pass the DT from boot rom now. In addition, when
CONFIG_OF_PRIOR_STAGE is enabled, the u-boot-spl.bin and u-boot.itb won't
include the device tree.

Signed-off-by: Zong Li <zong.li@sifive.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
board/sifive/unleashed/unleashed.c
board/sifive/unmatched/unmatched.c

index a4e78220cbaefc582c42357ac98b13e1d6d17b0b..fa65fcade086fe64a21102f2a7744ce17613941b 100644 (file)
@@ -16,6 +16,7 @@
 #include <misc.h>
 #include <spl.h>
 #include <asm/arch/cache.h>
+#include <asm/sections.h>
 
 /*
  * This define is a value used for error/unknown serial.
@@ -113,6 +114,16 @@ int misc_init_r(void)
 
 #endif
 
+void *board_fdt_blob_setup(void)
+{
+       if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
+               if (gd->arch.firmware_fdt_addr)
+                       return (ulong *)gd->arch.firmware_fdt_addr;
+               else
+                       return (ulong *)&_end;
+       }
+}
+
 int board_init(void)
 {
        int ret;
index 6d605595889b053af6cf4952c9b420564794f6c0..da23a6ce246cef61aead72f5227348bdbb496fe6 100644 (file)
@@ -9,6 +9,17 @@
 #include <common.h>
 #include <dm.h>
 #include <asm/arch/cache.h>
+#include <asm/sections.h>
+
+void *board_fdt_blob_setup(void)
+{
+       if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
+               if (gd->arch.firmware_fdt_addr)
+                       return (ulong *)gd->arch.firmware_fdt_addr;
+               else
+                       return (ulong *)&_end;
+       }
+}
 
 int board_init(void)
 {