It is possible to boot U-Boot proper from a different storage medium than the one used by the BOOTROM to load the SPL. This information is stored in the u-boot,spl-boot-device Device Tree property and is accessible from U-Boot proper so that it has knowledge at runtime where it was loaded from.
This is already supported on rk3399 and px30 but with duplicated code, so this patch series also factor out all of this into spl-boot-order of Rockchip platforms. Finally, let's invert the logic used to define the BOOT_DEVICE_ value in a different function so that /chosen/u-boot,spl-boot-device can be transparently added without any further work for existing and future SoCs. While at it, let's do some cleanups for Rockchip platforms. Tested on RK3399 Puma, PX30 Ringneck and (upcoming) RK3588 Jaguar. Signed-off-by: Quentin Schulz <quentin.sch...@theobroma-systems.com> --- Changes in v4: - use spl_image_fdt_addr() instead of accessing (possibly non-existing) fdt_addr member of spl_image_info to fix build issues on some Aarch32 Rockchip platforms, - add Rbs - Link to v3: https://lore.kernel.org/r/20240117-rk3588-spl-boot-dev-v3-0-72cb989e6...@theobroma-systems.com Changes in v3: - revamp spl_decode_boot_device to not necessitate hardcoded arrays, instead, the info is gotten from the inverted logic from spl_node_to_boot_device where the BOOT_DEVICE_* is set - add Rbs - Link to v2: https://lore.kernel.org/r/20231108-rk3588-spl-boot-dev-v2-0-e67e26202...@theobroma-systems.com Changes in v2: - add factoring into spl-boot-order - rework rk3588 support to use the factored out function - add global data ptr cleanup - remove rk3128 main SoC file (useless content) - Link to v1: https://lore.kernel.org/r/20230502-rk3588-spl-boot-dev-v1-1-071722a85...@theobroma-systems.com --- Quentin Schulz (6): rockchip: rk3399: simplify logic for getting SPL boot medium DT node rockchip: px30: simplify logic for getting SPL boot medium DT node rockchip: factor out spl_perform_fixups into common spl-boot-order rockchip: find U-boot proper boot device by inverting the logic that sets it rockchip: remove unused global data ptr rockchip: rk3128: remove noop file arch/arm/mach-rockchip/board.c | 3 - arch/arm/mach-rockchip/px30/px30.c | 49 --------------- arch/arm/mach-rockchip/rk3128/Makefile | 1 - arch/arm/mach-rockchip/rk3128/rk3128.c | 16 ----- arch/arm/mach-rockchip/rk3308/rk3308.c | 3 - arch/arm/mach-rockchip/rk3328/rk3328.c | 3 - arch/arm/mach-rockchip/rk3368/rk3368.c | 3 - arch/arm/mach-rockchip/rk3399/rk3399.c | 51 ---------------- arch/arm/mach-rockchip/rk3588/rk3588.c | 2 - arch/arm/mach-rockchip/spl-boot-order.c | 104 ++++++++++++++++++++++++++++++++ 10 files changed, 104 insertions(+), 131 deletions(-) --- base-commit: 106332d6cc583c4339e07020989d09b567900a59 change-id: 20230502-rk3588-spl-boot-dev-efa2777cc21b Best regards, -- Quentin Schulz <quentin.sch...@theobroma-systems.com>