Hi Sören,
thanks for sending this!
On 7/22/26 18:21, Sören Hantel wrote:
get_mclk_offset() checks CONFIG_MACH_SUN9I_A80, but no such Kconfig
symbol exists - the A80 is covered by CONFIG_MACH_SUN9I. The check
Ouch, it's not the first time we have this issue, I remember fixing a
misspelled guard in the past. And recently found another one.
So since you have a tireless and non-complaining helper at hand, can you
ask Claude to hunt for those misspelled/non-existing config options, in
the sunxi code? So all drivers used by sunxi and the board/sunxi and
arch/arm/mach-sunxi directories. Maybe also look for CONFIG_MACH_SUN.*I
like symbols. It's hard to do this with just grep and friends.
As a motivation: it should find at least one ... ;-)
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.
Ah, that's a good find, I was already wondering about that, since I
think I briefly tested eMMC on my A80 board ...
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 <[email protected]>
Signed-off-by: Sören Hantel <[email protected]>
Thanks, looks correct. Will take it ASAP.
Reviewed-by: Andre Przywara <[email protected]>
Cheers,
Andre
---
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))