From: Mahmoud Komaiha <mlpkos@gmail.com>
To: Marek Vasut <marex@denx.de>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>,
Tien Fong Chee <tien.fong.chee@altera.com>,
u-boot@lists.denx.de, Mahmoud Komaiha <mkomaiha@umich.edu>
Subject: [PATCH] ARM: socfpga: fix dead guard on board_spl_mmc_get_uboot_raw_sector()
Date: Mon, 3 Aug 2026 21:38:58 -0400 [thread overview]
Message-ID: <20260804013858.23721-1-mlpkos@gmail.com> (raw)
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)
next reply other threads:[~2026-08-04 2:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 1:38 Mahmoud Komaiha [this message]
2026-08-04 3:38 ` [PATCH] ARM: socfpga: fix dead guard on board_spl_mmc_get_uboot_raw_sector() Marek Vasut via U-Boot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260804013858.23721-1-mlpkos@gmail.com \
--to=mlpkos@gmail.com \
--cc=marex@denx.de \
--cc=mkomaiha@umich.edu \
--cc=simon.k.r.goldschmidt@gmail.com \
--cc=tien.fong.chee@altera.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.