public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 0/2] Extend board_fdt_blob_setup() to support OF_SEPARATE
@ 2019-12-19 17:00 Michal Simek
  2019-12-19 17:00 ` [PATCH 1/2] arm64: zynqmp: Rename fw_dtb variable to fdt_blob Michal Simek
  2019-12-19 17:00 ` [PATCH 2/2] arm64: zynqmp: Add support for OF_SEPARATE with board DTB Michal Simek
  0 siblings, 2 replies; 3+ messages in thread
From: Michal Simek @ 2019-12-19 17:00 UTC (permalink / raw)
  To: u-boot

Hi,

it is simply series which align board_fdt_blob_setup() with fdtdec with
highest priority on default location where external DTB can be found.

Thanks,
Michal


Michal Simek (2):
  arm64: zynqmp: Rename fw_dtb variable to fdt_blob
  arm64: zynqmp: Add support for OF_SEPARATE with board DTB

 board/xilinx/Kconfig        |  2 +-
 board/xilinx/common/board.c | 31 ++++++++++++++++++++++++-------
 2 files changed, 25 insertions(+), 8 deletions(-)

-- 
2.24.0

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

* [PATCH 1/2] arm64: zynqmp: Rename fw_dtb variable to fdt_blob
  2019-12-19 17:00 [PATCH 0/2] Extend board_fdt_blob_setup() to support OF_SEPARATE Michal Simek
@ 2019-12-19 17:00 ` Michal Simek
  2019-12-19 17:00 ` [PATCH 2/2] arm64: zynqmp: Add support for OF_SEPARATE with board DTB Michal Simek
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Simek @ 2019-12-19 17:00 UTC (permalink / raw)
  To: u-boot

The reason for this change is just get in sync with board_fdt_blob_setup()
available at lib/fdtdec.c.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 board/xilinx/common/board.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 1c28263cb889..62dafe0f9058 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -40,13 +40,13 @@ int zynq_board_read_rom_ethaddr(unsigned char *ethaddr)
 #if defined(CONFIG_OF_BOARD)
 void *board_fdt_blob_setup(void)
 {
-	static void *fw_dtb = (void *)CONFIG_XILINX_OF_BOARD_DTB_ADDR;
+	static void *fdt_blob = (void *)CONFIG_XILINX_OF_BOARD_DTB_ADDR;
 
-	if (fdt_magic(fw_dtb) != FDT_MAGIC) {
-		printf("DTB is not passed via %p\n", fw_dtb);
+	if (fdt_magic(fdt_blob) != FDT_MAGIC) {
+		printf("DTB is not passed via %p\n", fdt_blob);
 		return NULL;
 	}
 
-	return fw_dtb;
+	return fdt_blob;
 }
 #endif
-- 
2.24.0

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

* [PATCH 2/2] arm64: zynqmp: Add support for OF_SEPARATE with board DTB
  2019-12-19 17:00 [PATCH 0/2] Extend board_fdt_blob_setup() to support OF_SEPARATE Michal Simek
  2019-12-19 17:00 ` [PATCH 1/2] arm64: zynqmp: Rename fw_dtb variable to fdt_blob Michal Simek
@ 2019-12-19 17:00 ` Michal Simek
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Simek @ 2019-12-19 17:00 UTC (permalink / raw)
  To: u-boot

OF_BOARD and OF_SEPARATE can use board specific board_fdt_blob_setup().

OF_BOARD option is mostly used for picking up DTB from certain location.

OF_SEPARATE option is used when DTB is appended after u-boot binary.

This board specific function is aligned with current version in
lib/fdtdec.c with checking CONFIG_XILINX_OF_BOARD_DTB_ADDR address first.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 board/xilinx/Kconfig        |  2 +-
 board/xilinx/common/board.c | 29 +++++++++++++++++++++++------
 2 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/board/xilinx/Kconfig b/board/xilinx/Kconfig
index 7833b11767c4..73fc1be0141e 100644
--- a/board/xilinx/Kconfig
+++ b/board/xilinx/Kconfig
@@ -44,7 +44,7 @@ config XILINX_OF_BOARD_DTB_ADDR
 	hex
 	default 0x1000 if ARCH_VERSAL
 	default 0x100000 if ARCH_ZYNQ || ARCH_ZYNQMP
-	depends on OF_BOARD
+	depends on OF_BOARD || OF_SEPARATE
 	help
 	  Offset in the memory where the board configuration DTB is placed.
 
diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 62dafe0f9058..03d836feff9a 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <asm/sections.h>
 #include <dm/uclass.h>
 #include <i2c.h>
 
@@ -37,16 +38,32 @@ int zynq_board_read_rom_ethaddr(unsigned char *ethaddr)
 	return ret;
 }
 
-#if defined(CONFIG_OF_BOARD)
+#if defined(CONFIG_OF_BOARD) || defined(CONFIG_OF_SEPARATE)
 void *board_fdt_blob_setup(void)
 {
 	static void *fdt_blob = (void *)CONFIG_XILINX_OF_BOARD_DTB_ADDR;
 
-	if (fdt_magic(fdt_blob) != FDT_MAGIC) {
-		printf("DTB is not passed via %p\n", fdt_blob);
-		return NULL;
-	}
+	if (fdt_magic(fdt_blob) == FDT_MAGIC)
+		return fdt_blob;
 
-	return fdt_blob;
+	debug("DTB is not passed via 0x%llx\n", (u64)fdt_blob);
+
+#ifdef CONFIG_SPL_BUILD
+	/* FDT is at end of BSS unless it is in a different memory region */
+	if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS))
+		fdt_blob = (ulong *)&_image_binary_end;
+	else
+		fdt_blob = (ulong *)&__bss_end;
+#else
+	/* FDT is at end of image */
+	fdt_blob = (ulong *)&_end;
+#endif
+
+	if (fdt_magic(fdt_blob) == FDT_MAGIC)
+		return fdt_blob;
+
+	debug("DTB is also not passed via 0x%llx\n", (u64)fdt_blob);
+
+	return NULL;
 }
 #endif
-- 
2.24.0

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

end of thread, other threads:[~2019-12-19 17:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-19 17:00 [PATCH 0/2] Extend board_fdt_blob_setup() to support OF_SEPARATE Michal Simek
2019-12-19 17:00 ` [PATCH 1/2] arm64: zynqmp: Rename fw_dtb variable to fdt_blob Michal Simek
2019-12-19 17:00 ` [PATCH 2/2] arm64: zynqmp: Add support for OF_SEPARATE with board DTB Michal Simek

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