U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: sunxi: Fix mod clock register offset for the A80
@ 2026-07-22 16:21 Sören Hantel
  2026-07-26 22:41 ` Andre Przywara
  0 siblings, 1 reply; 4+ messages in thread
From: Sören Hantel @ 2026-07-22 16:21 UTC (permalink / raw)
  To: u-boot
  Cc: Peng Fan, Jaehoon Chung, Andre Przywara, Tom Rini,
	Sören Hantel, Claude Fable 5

get_mclk_offset() checks CONFIG_MACH_SUN9I_A80, but no such Kconfig
symbol exists - the A80 is covered by CONFIG_MACH_SUN9I. The check
therefore always fails and the function falls through to the default
offset 0x88, which lies in a reserved region of the A80 CCU. All mod
clock writes from U-Boot proper end up there and are silently lost,
so the SD/MMC controllers keep running at whatever clock the
SPL/BROM left behind.

For the eMMC on SDC2 that means card identification runs at the
~48 MHz the SPL used for loading U-Boot instead of 400 kHz: short
responses still limp along, but long (R2) responses are received as
all-ones, CMD2/ALL_SEND_CID fails and mmc_init() returns -110. This
went unnoticed for years because the SPL uses the legacy code path
with a hardcoded mclk address, so booting *from* eMMC still worked -
only U-Boot proper could never access the eMMC on sun9i.

Use the correct Kconfig symbol so the mod clock writes reach the SDC
clock registers at CCU offset 0x410.

Tested on a Cubietech Cubieboard4: eMMC identification now succeeds
and distro boot from the eMMC works.

Fixes: 0237b3047e25 ("mmc: sunxi: Refactor mod clock register offset")
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Sören Hantel <fugininsane@googlemail.com>
---
 drivers/mmc/sunxi_mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index e28c81af..623393fc 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -663,7 +663,7 @@ static const struct dm_mmc_ops sunxi_mmc_ops = {
 
 static unsigned get_mclk_offset(void)
 {
-	if (IS_ENABLED(CONFIG_MACH_SUN9I_A80))
+	if (IS_ENABLED(CONFIG_MACH_SUN9I))
 		return 0x410;
 
 	if (IS_ENABLED(CONFIG_SUN50I_GEN_H6) || IS_ENABLED(CONFIG_SUNXI_GEN_NCAT2))
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread
[parent not found: <20260722162126.2790195-1-fugininsane@googlemail.com_quarantine>]

end of thread, other threads:[~2026-07-27  2:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-22 16:21 [PATCH] mmc: sunxi: Fix mod clock register offset for the A80 Sören Hantel
2026-07-26 22:41 ` Andre Przywara
2026-07-27  0:32   ` Sören Hantel
     [not found] <20260722162126.2790195-1-fugininsane@googlemail.com_quarantine>
2026-07-23 10:26 ` Andre Przywara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox