All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zong Li <zong.li@sifive.com>
To: bmeng.cn@gmail.com, ycliang@andestech.com,
	paul.walmsley@sifive.com, rick@andestech.com,
	green.wan@sifive.com, sjg@chromium.org, u-boot@lists.denx.de
Cc: Zong Li <zong.li@sifive.com>
Subject: [PATCH 2/2] board: sifive: overwrite board_fdt_blob_setup in u-boot proper
Date: Tue, 27 Jul 2021 17:06:59 +0800	[thread overview]
Message-ID: <20210727090659.7525-2-zong.li@sifive.com> (raw)
In-Reply-To: <20210727090659.7525-1-zong.li@sifive.com>

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>
---
 board/sifive/unleashed/unleashed.c | 11 +++++++++++
 board/sifive/unmatched/unmatched.c | 11 +++++++++++
 2 files changed, 22 insertions(+)

diff --git a/board/sifive/unleashed/unleashed.c b/board/sifive/unleashed/unleashed.c
index a4e78220cb..fa65fcade0 100644
--- a/board/sifive/unleashed/unleashed.c
+++ b/board/sifive/unleashed/unleashed.c
@@ -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;
diff --git a/board/sifive/unmatched/unmatched.c b/board/sifive/unmatched/unmatched.c
index 6d60559588..da23a6ce24 100644
--- a/board/sifive/unmatched/unmatched.c
+++ b/board/sifive/unmatched/unmatched.c
@@ -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)
 {
-- 
2.32.0


  reply	other threads:[~2021-07-27  9:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27  9:06 [PATCH 1/2] board: sifive: compile stuff only related to SPL in SPL build Zong Li
2021-07-27  9:06 ` Zong Li [this message]
2021-08-02  9:07   ` [PATCH 2/2] board: sifive: overwrite board_fdt_blob_setup in u-boot proper Leo Liang
2021-08-02  8:54 ` [PATCH 1/2] board: sifive: compile stuff only related to SPL in SPL build Leo Liang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210727090659.7525-2-zong.li@sifive.com \
    --to=zong.li@sifive.com \
    --cc=bmeng.cn@gmail.com \
    --cc=green.wan@sifive.com \
    --cc=paul.walmsley@sifive.com \
    --cc=rick@andestech.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=ycliang@andestech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.