From fc37a73e667916e15e01e0f9d189da792df2b351 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 2 Nov 2024 11:49:42 -0600 Subject: fdt: Swap the signature for board_fdt_blob_setup() This returns a devicetree and updates a parameter with an error code. Swap it, since this fits better with the way U-Boot normally works. It also (more easily) allows leaving the existing pointer unchanged. No yaks were harmed in this change, but there is a very small code-size reduction. For sifive, the OF_BOARD option must be set for the function to be called, so there is no point in checking it again. Also OF_SEPARATE is defined always. Signed-off-by: Simon Glass Reviewed-by: Matthias Brugger Reviewed-by: Patrice Chotard [trini: Update total_compute] Signed-off-by: Tom Rini --- board/xilinx/common/board.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'board/xilinx/common/board.c') diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index a12dccd4c51..deea6c71103 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -358,17 +358,17 @@ __maybe_unused int xilinx_read_eeprom(void) } #if defined(CONFIG_OF_BOARD) -void *board_fdt_blob_setup(int *err) +int board_fdt_blob_setup(void **fdtp) { void *fdt_blob; - *err = 0; - if (IS_ENABLED(CONFIG_TARGET_XILINX_MBV)) { fdt_blob = (void *)CONFIG_XILINX_OF_BOARD_DTB_ADDR; - if (fdt_magic(fdt_blob) == FDT_MAGIC) - return fdt_blob; + if (fdt_magic(fdt_blob) == FDT_MAGIC) { + *fdtp = fdt_blob; + return 0; + } } if (!IS_ENABLED(CONFIG_XPL_BUILD) && @@ -376,8 +376,10 @@ void *board_fdt_blob_setup(int *err) !IS_ENABLED(CONFIG_ZYNQMP_NO_DDR)) { fdt_blob = (void *)CONFIG_XILINX_OF_BOARD_DTB_ADDR; - if (fdt_magic(fdt_blob) == FDT_MAGIC) - return fdt_blob; + if (fdt_magic(fdt_blob) == FDT_MAGIC) { + *fdtp = fdt_blob; + return 0; + } debug("DTB is not passed via %p\n", fdt_blob); } @@ -396,13 +398,15 @@ void *board_fdt_blob_setup(int *err) fdt_blob = (ulong *)_end; } - if (fdt_magic(fdt_blob) == FDT_MAGIC) - return fdt_blob; + if (fdt_magic(fdt_blob) == FDT_MAGIC) { + *fdtp = fdt_blob; + + return 0; + } debug("DTB is also not passed via %p\n", fdt_blob); - *err = -EINVAL; - return NULL; + return -EINVAL; } #endif -- cgit v1.2.3