Skip to contentSkip to conversation

ast2600: spl: Use readl for reading mmio

PATCH In review Joel Stanley 2 participants 2 messages Nov 18, 2024 – Nov 25, 2024

Subsystems (3)
lore
Share & tools
lore

Joel Stanley

author maintainer
#0 lore raw

PATCH 1/1 ast2600: spl: Use readl for reading mmio

u-boot was crashing in qemu as the modeled hardware enforced overly strict memory reads.

While this code will work on existing hardware, fix to avoid future issues.

Fixes 12770d0df0e8 ("ast2600: spl: Add boot mode detection")

---
GCC 14 was using this sequence to read the value, leading to the crash:

ldrbpl.w r0, [r0, #1280] @ 0x500

 arch/arm/mach-aspeed/ast2600/spl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-aspeed/ast2600/spl.c +2 -2
index 05390c16f3af..0c5a82ed0947 100644
@@ -45,10 +45,10 @@ u32 spl_boot_device(void)
 	}
 
 	/* boot from UART has higher priority */
-	if (scu->hwstrap2 & SCU_HWSTRAP2_BOOT_UART)
+	if (readl(&scu->hwstrap2) & SCU_HWSTRAP2_BOOT_UART)
 		return BOOT_DEVICE_UART;
 
-	if (scu->hwstrap1 & SCU_HWSTRAP1_BOOT_EMMC)
+	if (readl(&scu->hwstrap1) & SCU_HWSTRAP1_BOOT_EMMC)
 		return BOOT_DEVICE_MMC1;
 
 out:
Signature · 1 line
2.45.2
#1 lore raw
Quoted 6 lines · Joel Stanley

u-boot was crashing in qemu as the modeled hardware enforced overly strict memory reads.

While this code will work on existing hardware, fix to avoid future issues.

Applied to u-boot/master, thanks!

Signature · 1 line
Tom