[PATCH v2 2/2] fdt: Swap the signature for board_fdt_blob_setup()

Matthias Brugger mbrugger at suse.com
Mon Nov 11 12:06:23 CET 2024



On 02/11/2024 18:49, Simon Glass wrote:
> 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 <sjg at chromium.org>
> ---
> 
> Changes in v2:
> - Set up the existing FDT in case the board wants to check it
> - Update snapdragon to return -EEXIST
> - Set the existing FDT before calling board_fd_blob_setup()
> - Update sandbox to return -EEXIST if an fdt comes from a bloblist
> - Update do_go_uboot() to set the existing FDT
> - Drop unnecessary setting of FDT in vexpress64
> - Tidy up redundant RISC-V code
> 
>   arch/arm/mach-apple/board.c                   |  7 ++--
>   arch/arm/mach-snapdragon/board.c              |  9 ++---
>   arch/arm/mach-stm32mp/boot_params.c           | 19 ++++++-----
>   arch/sandbox/cpu/cpu.c                        | 34 +++++++++----------
>   board/Marvell/octeontx/board-fdt.c            | 12 +++----
>   board/Marvell/octeontx2/board-fdt.c           | 12 +++----
>   board/Marvell/octeontx2/board.c               |  3 +-
>   board/andestech/ae350/ae350.c                 | 23 +++++++------
>   board/armltd/vexpress64/vexpress64.c          | 33 ++++++++----------
>   board/broadcom/bcmstb/bcmstb.c                |  7 ++--
>   board/emulation/qemu-arm/qemu-arm.c           |  7 ++--
>   board/emulation/qemu-ppce500/qemu-ppce500.c   | 12 +++----
>   board/emulation/qemu-riscv/qemu-riscv.c       |  7 ++--
>   board/highbank/highbank.c                     |  7 ++--
>   board/raspberrypi/rpi/rpi.c                   | 13 ++++---
>   board/sifive/unleashed/unleashed.c            | 12 +++----
>   board/sifive/unmatched/unmatched.c            | 11 +++---
>   .../visionfive2/starfive_visionfive2.c        | 11 +++---
>   board/xen/xenguest_arm64/xenguest_arm64.c     | 14 ++++----
>   board/xilinx/common/board.c                   | 26 ++++++++------
>   include/fdtdec.h                              |  9 ++---
>   lib/fdtdec.c                                  | 14 +++++---
>   22 files changed, 152 insertions(+), 150 deletions(-)
> 
[...]
> diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
> index 9122f33d88d..c46fe4b2350 100644
> --- a/board/raspberrypi/rpi/rpi.c
> +++ b/board/raspberrypi/rpi/rpi.c
> @@ -508,15 +508,14 @@ int board_init(void)
>   /*
>    * If the firmware passed a device tree use it for U-Boot.
>    */
> -void *board_fdt_blob_setup(int *err)
> +int board_fdt_blob_setup(void **fdtp)
>   {
> -	*err = 0;
> -	if (fdt_magic(fw_dtb_pointer) != FDT_MAGIC) {
> -		*err = -ENXIO;
> -		return NULL;
> -	}
> +	if (fdt_magic(fw_dtb_pointer) != FDT_MAGIC)
> +		return -ENXIO;
>   
> -	return (void *)fw_dtb_pointer;
> +	*fdtp = (void *)fw_dtb_pointer;
> +
> +	return 0;
>   }
>   
>   int copy_property(void *dst, void *src, char *path, char *property)

For Raspberry Pi:

Reviewed-by: Matthias Brugger <mbrugger at suse.com>


More information about the U-Boot mailing list