spl: split spl_board_fixups to arch/board specific

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>
This commit is contained in:
Anshul Dalal
2025-10-17 18:45:30 +05:30
committed by Tom Rini
parent 856480eef0
commit 16ffcff028
20 changed files with 36 additions and 24 deletions

View 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;
}

View 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);

View 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;

View 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))

View 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));
}

View 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);

View 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);

View 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;

View 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)

View 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))

View 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))

View 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))

View 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))

View 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))

View 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);
}

View 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))

View 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))

View 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))

View 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) {

View 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