arm64: versal: Move common board dtb search
Move the exisiting function of getting board dtb from versal to a common
Xilinx folder.
Signed-off-by: Ibai Erkiaga <ibai.erkiaga-elorza@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
diff --git a/board/xilinx/Kconfig b/board/xilinx/Kconfig
index 37bec5f..4f29033 100644
--- a/board/xilinx/Kconfig
+++ b/board/xilinx/Kconfig
@@ -39,3 +39,10 @@
before the build.
endif
+
+config VERSAL_OF_BOARD_DTB_ADDR
+ hex
+ default 0x1000
+ depends on OF_BOARD
+ 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 7e6340b..f66973b 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -36,3 +36,17 @@
return ret;
}
+
+#if defined(CONFIG_OF_BOARD)
+void *board_fdt_blob_setup(void)
+{
+ static void *fw_dtb = (void *)CONFIG_VERSAL_OF_BOARD_DTB_ADDR;
+
+ if (fdt_magic(fw_dtb) != FDT_MAGIC) {
+ printf("DTB is not passed via %p\n", fw_dtb);
+ return NULL;
+ }
+
+ return fw_dtb;
+}
+#endif
diff --git a/board/xilinx/versal/Makefile b/board/xilinx/versal/Makefile
index 2b81276..e9307d7 100644
--- a/board/xilinx/versal/Makefile
+++ b/board/xilinx/versal/Makefile
@@ -5,3 +5,4 @@
#
obj-y := board.o
+obj-y += ../common/board.o