public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 1/2] board: sifive: compile stuff only related to SPL in SPL build
@ 2021-07-27  9:06 Zong Li
  2021-07-27  9:06 ` [PATCH 2/2] board: sifive: overwrite board_fdt_blob_setup in u-boot proper Zong Li
  2021-08-02  8:54 ` [PATCH 1/2] board: sifive: compile stuff only related to SPL in SPL build Leo Liang
  0 siblings, 2 replies; 4+ messages in thread
From: Zong Li @ 2021-07-27  9:06 UTC (permalink / raw)
  To: bmeng.cn, ycliang, paul.walmsley, rick, green.wan, sjg, u-boot; +Cc: Zong Li

As (3581811dc26f "riscv: sifive/fu540: Move SPL related functions to spl.c"),
we put the SPL stuff in spl.c, we don't need to compile unleashed.c and
unmatched.c in SPL build.

Signed-off-by: Zong Li <zong.li@sifive.com>
---
 board/sifive/unleashed/Makefile | 4 ++--
 board/sifive/unmatched/Makefile | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/board/sifive/unleashed/Makefile b/board/sifive/unleashed/Makefile
index 5821679dd9..98e9111cbc 100644
--- a/board/sifive/unleashed/Makefile
+++ b/board/sifive/unleashed/Makefile
@@ -2,8 +2,8 @@
 #
 # Copyright (c) 2019 Western Digital Corporation or its affiliates.
 
-obj-y	+= unleashed.o
-
 ifdef CONFIG_SPL_BUILD
 obj-y += spl.o
+else
+obj-y += unleashed.o
 endif
diff --git a/board/sifive/unmatched/Makefile b/board/sifive/unmatched/Makefile
index e00b330e8c..1345330089 100644
--- a/board/sifive/unmatched/Makefile
+++ b/board/sifive/unmatched/Makefile
@@ -2,9 +2,10 @@
 #
 # Copyright (c) 2020-2021 SiFive, Inc
 
-obj-y   += unmatched.o
 obj-$(CONFIG_ID_EEPROM) += hifive-platform-i2c-eeprom.o
 
 ifdef CONFIG_SPL_BUILD
 obj-y += spl.o
+else
+obj-y += unmatched.o
 endif
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] board: sifive: overwrite board_fdt_blob_setup in u-boot proper
  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
  2021-08-02  9:07   ` Leo Liang
  2021-08-02  8:54 ` [PATCH 1/2] board: sifive: compile stuff only related to SPL in SPL build Leo Liang
  1 sibling, 1 reply; 4+ messages in thread
From: Zong Li @ 2021-07-27  9:06 UTC (permalink / raw)
  To: bmeng.cn, ycliang, paul.walmsley, rick, green.wan, sjg, u-boot; +Cc: Zong Li

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] board: sifive: compile stuff only related to SPL in SPL build
  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 ` [PATCH 2/2] board: sifive: overwrite board_fdt_blob_setup in u-boot proper Zong Li
@ 2021-08-02  8:54 ` Leo Liang
  1 sibling, 0 replies; 4+ messages in thread
From: Leo Liang @ 2021-08-02  8:54 UTC (permalink / raw)
  To: Zong Li; +Cc: u-boot

On Tue, Jul 27, 2021 at 05:06:58PM +0800, Zong Li wrote:
> As (3581811dc26f "riscv: sifive/fu540: Move SPL related functions to spl.c"),
> we put the SPL stuff in spl.c, we don't need to compile unleashed.c and
> unmatched.c in SPL build.
> 
> Signed-off-by: Zong Li <zong.li@sifive.com>
> ---
>  board/sifive/unleashed/Makefile | 4 ++--
>  board/sifive/unmatched/Makefile | 3 ++-
>  2 files changed, 4 insertions(+), 3 deletions(-)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] board: sifive: overwrite board_fdt_blob_setup in u-boot proper
  2021-07-27  9:06 ` [PATCH 2/2] board: sifive: overwrite board_fdt_blob_setup in u-boot proper Zong Li
@ 2021-08-02  9:07   ` Leo Liang
  0 siblings, 0 replies; 4+ messages in thread
From: Leo Liang @ 2021-08-02  9:07 UTC (permalink / raw)
  To: Zong Li; +Cc: u-boot

On Tue, Jul 27, 2021 at 05:06:59PM +0800, Zong Li wrote:
> 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(+)

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-02  9:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 2/2] board: sifive: overwrite board_fdt_blob_setup in u-boot proper Zong Li
2021-08-02  9:07   ` Leo Liang
2021-08-02  8:54 ` [PATCH 1/2] board: sifive: compile stuff only related to SPL in SPL build Leo Liang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox