From: Jan Kiszka Date: Thu, 11 Dec 2025 16:34:58 +0000 (+0100) Subject: arch: arm: mach-socfpga: Adjust a raw sectors for MMC loading of U-Boot from SPL X-Git-Tag: v2026.04-rc1~52^2~12^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1cf1b504f412121aa5929d12beb3d7f6cf3ac50e;p=thirdparty%2Fu-boot.git arch: arm: mach-socfpga: Adjust a raw sectors for MMC loading of U-Boot from SPL If U-Boot is located on MMC, SPL and U-Boot proper are glued together. More precisely, SPL is stored 4 times. Take this and its padding into account and adjust sector number via board_spl_mmc_get_uboot_raw_sector. This allows loading from a partition, without the need to hard-code the offset via SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR Signed-off-by: Jan Kiszka Reviewed-by: Tien Fong Chee --- diff --git a/arch/arm/mach-socfpga/board.c b/arch/arm/mach-socfpga/board.c index 28554b7a109..7f65aed4540 100644 --- a/arch/arm/mach-socfpga/board.c +++ b/arch/arm/mach-socfpga/board.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -209,3 +210,13 @@ void lmb_arch_add_memory(void) } } #endif + +#if (defined(CONFIG_TARGET_SOCFPGA_ARRIA10) || \ + defined(CONFIG_TARGET_SOCFPGA_GEN5)) && defined(CONFIG_XPL_BUILD) +unsigned long board_spl_mmc_get_uboot_raw_sector(struct mmc *mmc, + unsigned long raw_sect) +{ + /* offset of u-boot proper inside u-boot-with-spl.sfp image */ + return (CONFIG_SPL_PAD_TO * 4) / 512 + raw_sect; +} +#endif