]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
spl: split spl_board_fixups to arch/board specific
authorAnshul Dalal <anshuld@ti.com>
Fri, 17 Oct 2025 13:15:30 +0000 (18:45 +0530)
committerTom Rini <trini@konsulko.com>
Wed, 22 Oct 2025 18:05:52 +0000 (12:05 -0600)
The current spl_board_fixups API allows for modification of spl_image
before the SPL jumps to it. This can be used to modify the DT for the
next boot stage, however the current API only allows either the machine
arch or the board to use it.

This limits the utility of the API as there might be certain fixups that
should be applied to all boards sharing the same machine architecture
with others being board specific.

For TI's K3 specifically, this prevents us from performing architecture
level fixups since a lot of TI boards are already making use of the
spl_board_fixups API.

Therefore this patch splits the API into two to allow both board and the
architecture specific fixups. The order is kept as arch then board to
give board specific fixups the precedence.

Reviewed-by: Dhruva Gole <d-gole@ti.com>
Signed-off-by: Anshul Dalal <anshuld@ti.com>
Tested-by: Wadim Egorov <w.egorov@phytec.de>
20 files changed:
arch/arm/cpu/armv7m/cpu.c
arch/arm/mach-rockchip/spl-boot-order.c
arch/arm/mach-socfpga/spl_soc64.c
board/beagle/beagley-ai/beagley-ai.c
board/dhelectronics/dh_stm32mp1/board.c
board/phytec/phycore_am62x/phycore-am62x.c
board/phytec/phycore_am64x/phycore-am64x.c
board/renesas/sparrowhawk/sparrowhawk.c
board/starfive/visionfive2/spl.c
board/ti/am62ax/evm.c
board/ti/am62dx/evm.c
board/ti/am62px/evm.c
board/ti/am62x/evm.c
board/ti/am64x/evm.c
board/ti/j721e/evm.c
board/ti/j721s2/evm.c
board/ti/j722s/evm.c
board/ti/j784s4/evm.c
common/spl/spl.c
include/spl.h

index b4440d3f3f8481d5a94aca819b07a66cb2fc5ca3..bea0e1d3263f1be958fc6b6709aee441f6ee18dc 100644 (file)
@@ -57,7 +57,7 @@ void reset_cpu(void)
                | V7M_AIRCR_SYSRESET, &V7M_SCB->aircr);
 }
 
-void spl_perform_fixups(struct spl_image_info *spl_image)
+void spl_perform_arch_fixups(struct spl_image_info *spl_image)
 {
        spl_image->entry_point |= 0x1;
 }
index 1bfd120adc46d4c847fc81112033bcf193be96d3..561bddd12a6d44a7be3d3d7e55b78994cc9c98a9 100644 (file)
@@ -240,7 +240,7 @@ int spl_decode_boot_device(u32 boot_device, char *buf, size_t buflen)
 #endif
 }
 
-void spl_perform_fixups(struct spl_image_info *spl_image)
+void spl_perform_arch_fixups(struct spl_image_info *spl_image)
 {
        const char *bootrom_ofpath = board_spl_was_booted_from();
        void *blob = spl_image_fdt_addr(spl_image);
index 651d9fc9cb88b1c611adc379e71802c3df526fb0..fa7b1506ce67f9b2e80c5fdf64c8cfa1154b61c0 100644 (file)
@@ -130,7 +130,7 @@ u32 spl_boot_mode(const u32 boot_device)
 #endif
 
 /* board specific function prior loading SSBL / U-Boot */
-void spl_perform_fixups(struct spl_image_info *spl_image)
+void spl_perform_arch_fixups(struct spl_image_info *spl_image)
 {
        int ret;
        struct udevice *dev;
index 26fa54e27bbe8735c605851cc82cb349ee773869..500cc3060c3c602a18a51eefadafe055add0dc9d 100644 (file)
@@ -32,7 +32,7 @@ int dram_init_banksize(void)
 }
 
 #if defined(CONFIG_XPL_BUILD)
-void spl_perform_fixups(struct spl_image_info *spl_image)
+void spl_perform_board_fixups(struct spl_image_info *spl_image)
 {
        if (IS_ENABLED(CONFIG_K3_DDRSS)) {
                if (IS_ENABLED(CONFIG_K3_INLINE_ECC))
index bd9326d6b1b30af21d0e9a6e37869b2591a36586..d98b2c6e80972b42aa36ea9191f500dced515418 100644 (file)
@@ -776,7 +776,7 @@ int ft_board_setup(void *blob, struct bd_info *bd)
 #endif
 
 #if defined(CONFIG_XPL_BUILD)
-void spl_perform_fixups(struct spl_image_info *spl_image)
+void spl_perform_board_fixups(struct spl_image_info *spl_image)
 {
        dh_stm32_ks8851_fixup(spl_image_fdt_addr(spl_image));
 }
index 51da864aa80961f647c88008af7ff496baa31e30..3cdcbf2ecc973ffe11768fde4857a957d316f68f 100644 (file)
@@ -199,7 +199,7 @@ int do_board_detect(void)
 #endif
 
 #if IS_ENABLED(CONFIG_XPL_BUILD)
-void spl_perform_fixups(struct spl_image_info *spl_image)
+void spl_perform_board_fixups(struct spl_image_info *spl_image)
 {
        if (IS_ENABLED(CONFIG_K3_DDRSS) && IS_ENABLED(CONFIG_K3_INLINE_ECC))
                fixup_ddr_driver_for_ecc(spl_image);
index 33c39376ceb9238b9f7fd0695c9fd4b1dee6ef8b..114aa2170235fc44b2e6f0bd3cc71f6c9e143ea4 100644 (file)
@@ -118,7 +118,7 @@ int do_board_detect(void)
 #endif
 
 #if IS_ENABLED(CONFIG_XPL_BUILD)
-void spl_perform_fixups(struct spl_image_info *spl_image)
+void spl_perform_board_fixups(struct spl_image_info *spl_image)
 {
        if (IS_ENABLED(CONFIG_K3_DDRSS) && IS_ENABLED(CONFIG_K3_INLINE_ECC))
                fixup_ddr_driver_for_ecc(spl_image);
index a4eda8527433acf06cdee1ce828b43bb8edc869c..f5b1a5614b108fc0486447025a8e1278ffc4a728 100644 (file)
@@ -134,7 +134,7 @@ unsigned int spl_spi_get_uboot_offs(struct spi_flash *flash)
        return CONFIG_SYS_SPI_U_BOOT_OFFS;
 }
 
-void spl_perform_fixups(struct spl_image_info *spl_image)
+void spl_perform_board_fixups(struct spl_image_info *spl_image)
 {
        void *blob = spl_image_fdt_addr(spl_image);
        int err, offs;
index 420a8cf8d91876b649f32e5c127f17830a907c7b..48b034af305a80ac6cc11eaa71ea19e5bcf9ff0a 100644 (file)
@@ -20,7 +20,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define JH7110_CLK_CPU_ROOT_SHIFT              24
 #define JH7110_CLK_CPU_ROOT_MASK               GENMASK(29, 24)
 
-void spl_perform_fixups(struct spl_image_info *spl_image)
+void spl_perform_board_fixups(struct spl_image_info *spl_image)
 {
        /* Update the memory size which read from eeprom or DT */
        if (spl_image->fdt_addr)
index a445f9832555977db3ac57bc46f3af691dc529ea..da6c31176cd0a30ec1b59132c2ac49cf1d4b1693 100644 (file)
@@ -17,7 +17,7 @@
 #include "../common/fdt_ops.h"
 
 #if defined(CONFIG_XPL_BUILD)
-void spl_perform_fixups(struct spl_image_info *spl_image)
+void spl_perform_board_fixups(struct spl_image_info *spl_image)
 {
        if (IS_ENABLED(CONFIG_K3_DDRSS)) {
                if (IS_ENABLED(CONFIG_K3_INLINE_ECC))
index 1d8216128c94e63db1e9b56fdc3f2f8567ca0207..0924954c738c0fde24d966fd98831df8bfe8c5ab 100644 (file)
@@ -17,7 +17,7 @@
 #include "../common/fdt_ops.h"
 
 #if defined(CONFIG_XPL_BUILD)
-void spl_perform_fixups(struct spl_image_info *spl_image)
+void spl_perform_board_fixups(struct spl_image_info *spl_image)
 {
        if (IS_ENABLED(CONFIG_K3_DDRSS)) {
                if (IS_ENABLED(CONFIG_K3_INLINE_ECC))
index c06e3878d67dd84c9434f5e5b782840bf0062403..85c332b9339ba3143f81cf53a4cd4351af5fe41f 100644 (file)
@@ -50,7 +50,7 @@ void spl_board_init(void)
 #endif
 
 #if defined(CONFIG_XPL_BUILD)
-void spl_perform_fixups(struct spl_image_info *spl_image)
+void spl_perform_board_fixups(struct spl_image_info *spl_image)
 {
        if (IS_ENABLED(CONFIG_K3_DDRSS)) {
                if (IS_ENABLED(CONFIG_K3_INLINE_ECC))
index d7b07a0d34dd6aed5d0857ea485595d7fbed86ad..c2c7a0216b9ffbe5478a9034d0092c74c9716909 100644 (file)
@@ -91,7 +91,7 @@ void spl_board_init(void)
 
 }
 
-void spl_perform_fixups(struct spl_image_info *spl_image)
+void spl_perform_board_fixups(struct spl_image_info *spl_image)
 {
        if (IS_ENABLED(CONFIG_K3_DDRSS)) {
                if (IS_ENABLED(CONFIG_K3_INLINE_ECC))
index 8e89b3b15df20d77ccaa4aec18c01888219621bc..f9bb593e4c6f9a33e559214ba19479a5c7922817 100644 (file)
@@ -98,7 +98,7 @@ static int fixup_usb_boot(const void *fdt_blob)
 }
 #endif
 
-void spl_perform_fixups(struct spl_image_info *spl_image)
+void spl_perform_board_fixups(struct spl_image_info *spl_image)
 {
        if (IS_ENABLED(CONFIG_K3_DDRSS)) {
                if (IS_ENABLED(CONFIG_K3_INLINE_ECC))
index 1527eaf1e16688c411749a0b4d5bfc50b3214b85..e030fe7dc874fa573befd67ff75eeb36fe8aa4c4 100644 (file)
@@ -127,7 +127,7 @@ static void __maybe_unused detect_enable_hyperflash(void *blob)
 
 #if defined(CONFIG_XPL_BUILD) && (defined(CONFIG_TARGET_J7200_A72_EVM) || defined(CONFIG_TARGET_J7200_R5_EVM) || \
                                        defined(CONFIG_TARGET_J721E_A72_EVM) || defined(CONFIG_TARGET_J721E_R5_EVM))
-void spl_perform_fixups(struct spl_image_info *spl_image)
+void spl_perform_board_fixups(struct spl_image_info *spl_image)
 {
        detect_enable_hyperflash(spl_image->fdt_addr);
 }
index 5d3b84607d82e3fe3cbf9d4f447279762edd5600..b6d1964146d178c565fa645be101a1cabc8cfc37 100644 (file)
@@ -40,7 +40,7 @@ phys_addr_t board_get_usable_ram_top(phys_size_t total_size)
 }
 
 #if defined(CONFIG_XPL_BUILD)
-void spl_perform_fixups(struct spl_image_info *spl_image)
+void spl_perform_board_fixups(struct spl_image_info *spl_image)
 {
        if (IS_ENABLED(CONFIG_K3_DDRSS)) {
                if (IS_ENABLED(CONFIG_K3_INLINE_ECC))
index 32d767cb7d2cd04ce79f58fb137dcc27736ca4c9..1173adc072be023faa533f7e2b4e50b2f122807b 100644 (file)
@@ -24,7 +24,7 @@ void spl_board_init(void)
 #endif
 
 #if defined(CONFIG_XPL_BUILD)
-void spl_perform_fixups(struct spl_image_info *spl_image)
+void spl_perform_board_fixups(struct spl_image_info *spl_image)
 {
        if (IS_ENABLED(CONFIG_K3_DDRSS)) {
                if (IS_ENABLED(CONFIG_K3_INLINE_ECC))
index 6335676081ac2f5e53fe301d0982405cb4bb1327..cabb3017ee142d8bf572c75b24813c9080d982cd 100644 (file)
@@ -42,7 +42,7 @@ struct efi_capsule_update_info update_info = {
 };
 
 #if defined(CONFIG_XPL_BUILD)
-void spl_perform_fixups(struct spl_image_info *spl_image)
+void spl_perform_board_fixups(struct spl_image_info *spl_image)
 {
        if (IS_ENABLED(CONFIG_K3_DDRSS)) {
                if (IS_ENABLED(CONFIG_K3_INLINE_ECC))
index 8c20b75b178cee8d96149911f43391b2f895969e..64313cb8dfe1a401078882564b69890480c9894d 100644 (file)
@@ -120,8 +120,13 @@ int __weak booti_setup(ulong image, ulong *relocated_addr, ulong *size, bool for
 }
 #endif
 
-/* Weak default function for arch/board-specific fixups to the spl_image_info */
-void __weak spl_perform_fixups(struct spl_image_info *spl_image)
+/* Weak default function for arch specific fixups to the spl_image_info */
+void __weak spl_perform_arch_fixups(struct spl_image_info *spl_image)
+{
+}
+
+/* Weak default function for board specific fixups to the spl_image_info */
+void __weak spl_perform_board_fixups(struct spl_image_info *spl_image)
 {
 }
 
@@ -776,7 +781,8 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
                hang();
        }
 
-       spl_perform_fixups(&spl_image);
+       spl_perform_arch_fixups(&spl_image);
+       spl_perform_board_fixups(&spl_image);
 
        os = spl_image.os;
        if (os == IH_OS_U_BOOT) {
index 7c10c7f792e578f29110079d367a1eba4f5ba750..cf45d411ecba0ce746e0bc7d5a5d2fd02144ccdd 100644 (file)
@@ -1116,10 +1116,16 @@ int board_return_to_bootrom(struct spl_image_info *spl_image,
 ulong board_spl_fit_size_align(ulong size);
 
 /**
- * spl_perform_fixups() - arch/board-specific callback before processing
- *                        the boot-payload
+ * spl_perform_arch_fixups() - arch specific callback before processing the
+ *                        boot-payload
  */
-void spl_perform_fixups(struct spl_image_info *spl_image);
+void spl_perform_arch_fixups(struct spl_image_info *spl_image);
+
+/**
+ * spl_perform_board_fixups() - board specific callback before processing the
+ *                        boot-payload
+ */
+void spl_perform_board_fixups(struct spl_image_info *spl_image);
 
 /*
  * spl_get_load_buffer() - get buffer for loading partial image data