* [PATCH] ARM: socfpga: fix dead guard on board_spl_mmc_get_uboot_raw_sector()
@ 2026-08-04 1:38 Mahmoud Komaiha
2026-08-04 3:38 ` Marek Vasut via U-Boot
0 siblings, 1 reply; 2+ messages in thread
From: Mahmoud Komaiha @ 2026-08-04 1:38 UTC (permalink / raw)
To: Marek Vasut; +Cc: Simon Goldschmidt, Tien Fong Chee, u-boot, Mahmoud Komaiha
From: Mahmoud Komaiha <mkomaiha@umich.edu>
board_spl_mmc_get_uboot_raw_sector() is guarded on
CONFIG_TARGET_SOCFPGA_ARRIA10 and CONFIG_TARGET_SOCFPGA_GEN5. Neither
symbol exists in Kconfig: the family symbols are ARCH_SOCFPGA_ARRIA10 and
ARCH_SOCFPGA_GEN5, while the per-board symbols are of the form
TARGET_SOCFPGA_ARRIA10_SOCDK / TARGET_SOCFPGA_TERASIC_DE10_NANO. These two
lines are the only references to either symbol in the tree.
The guard is therefore never true and the function is dead code on every
SoCFPGA board, so the offset of u-boot proper inside u-boot-with-spl.sfp
is never applied.
When SPL loads u-boot proper from the 0xa2 partition
(SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE) the resulting load address
is the start of that partition, which holds SPL itself rather than u-boot
proper. SPL then hangs with no diagnostic after printing
"spl: mmc boot mode: raw".
Observed on a Terasic DE10-Nano (Cyclone V, GEN5) booting from SD with the
standard layout (0xa2 partition at sector 1024). Instrumenting
mmc_load_image_raw_partition() showed the computed load sector as 1024
instead of 1536. With the guard corrected the offset is applied, the load
sector becomes 1536, and the board boots to the U-Boot prompt.
Signed-off-by: Mahmoud Komaiha <mkomaiha@umich.edu>
---
arch/arm/mach-socfpga/board.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-socfpga/board.c b/arch/arm/mach-socfpga/board.c
index 4d7f0b9a..fd7f15b3 100644
--- a/arch/arm/mach-socfpga/board.c
+++ b/arch/arm/mach-socfpga/board.c
@@ -211,8 +211,8 @@ void lmb_arch_add_memory(void)
}
#endif
-#if (defined(CONFIG_TARGET_SOCFPGA_ARRIA10) || \
- defined(CONFIG_TARGET_SOCFPGA_GEN5)) && defined(CONFIG_XPL_BUILD)
+#if (defined(CONFIG_ARCH_SOCFPGA_ARRIA10) || \
+ defined(CONFIG_ARCH_SOCFPGA_GEN5)) && defined(CONFIG_XPL_BUILD)
unsigned long board_spl_mmc_get_uboot_raw_sector(struct mmc *mmc,
unsigned long raw_sect)
{
--
2.50.1 (Apple Git-155)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ARM: socfpga: fix dead guard on board_spl_mmc_get_uboot_raw_sector()
2026-08-04 1:38 [PATCH] ARM: socfpga: fix dead guard on board_spl_mmc_get_uboot_raw_sector() Mahmoud Komaiha
@ 2026-08-04 3:38 ` Marek Vasut via U-Boot
0 siblings, 0 replies; 2+ messages in thread
From: Marek Vasut via U-Boot @ 2026-08-04 3:38 UTC (permalink / raw)
To: Mahmoud Komaiha
Cc: Simon Goldschmidt, Tien Fong Chee, u-boot, Mahmoud Komaiha
On 8/4/26 3:38 AM, Mahmoud Komaiha wrote:
> From: Mahmoud Komaiha <mkomaiha@umich.edu>
>
> board_spl_mmc_get_uboot_raw_sector() is guarded on
> CONFIG_TARGET_SOCFPGA_ARRIA10 and CONFIG_TARGET_SOCFPGA_GEN5. Neither
> symbol exists in Kconfig: the family symbols are ARCH_SOCFPGA_ARRIA10 and
> ARCH_SOCFPGA_GEN5, while the per-board symbols are of the form
> TARGET_SOCFPGA_ARRIA10_SOCDK / TARGET_SOCFPGA_TERASIC_DE10_NANO. These two
> lines are the only references to either symbol in the tree.
>
> The guard is therefore never true and the function is dead code on every
> SoCFPGA board, so the offset of u-boot proper inside u-boot-with-spl.sfp
> is never applied.
>
> When SPL loads u-boot proper from the 0xa2 partition
> (SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE) the resulting load address
> is the start of that partition, which holds SPL itself rather than u-boot
> proper. SPL then hangs with no diagnostic after printing
> "spl: mmc boot mode: raw".
>
> Observed on a Terasic DE10-Nano (Cyclone V, GEN5) booting from SD with the
> standard layout (0xa2 partition at sector 1024). Instrumenting
> mmc_load_image_raw_partition() showed the computed load sector as 1024
> instead of 1536. With the guard corrected the offset is applied, the load
> sector becomes 1536, and the board boots to the U-Boot prompt.
>
> Signed-off-by: Mahmoud Komaiha <mkomaiha@umich.edu>
Reviewed-by: Marek Vasut <marek.vasut+socfpga@mailbox.org>
Fixes: 62f7a9460209 ("Replace TARGET namespace and cleanup properly")
Thanks !
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-04 3:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-04 1:38 [PATCH] ARM: socfpga: fix dead guard on board_spl_mmc_get_uboot_raw_sector() Mahmoud Komaiha
2026-08-04 3:38 ` Marek Vasut via U-Boot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.