PATCH mmc: sunxi: fix MACH_SUN9I typo in get_mclk_offset()
Omar Ivan Fardjoume
ivan.fardjoume at gmail.com
Tue May 26 23:28:59 CEST 2026
Hi, first thanks for everything you do.
I was working on reviving a cubieboard4 a80 board and I found and fix
two issues that prevented eMMC from working on sun9i-A80 boards:
1. The get_mclk_offset() function used the non-existent Kconfig symbol
CONFIG_MACH_SUN9I_A80 instead of CONFIG_MACH_SUN9I, causing the
MMC2 clock register to be written at 0x06000090 instead of
0x06000418. This corrupted the CMD2 response and made eMMC
completely unresponsive.
2. The legacy (SPL) sunxi_mmc_init() did not include CONFIG_MACH_SUN9I
in the 8-bit bus width condition, so MMC2 (eMMC) would only use
4-bit mode in the SPL, which is insufficient for reliable boot.
Tested on a Cubieboard4 A80: with both fixes, SPL loads U-Boot proper
and boots Debian 12 from eMMC with no SD card present.
Signed-off-by: Omar Ivan Fardjoume <ivan.fardjoume at email.com>
---
drivers/mmc/sunxi_mmc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index 4c5fbf8960f..3d5e7c1a234 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -546,7 +546,7 @@ struct mmc *sunxi_mmc_init(int sdc_no)
cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
cfg->host_caps = MMC_MODE_4BIT;
- if ((IS_ENABLED(CONFIG_MACH_SUN50I) || IS_ENABLED(CONFIG_MACH_SUN8I) ||
+ if ((IS_ENABLED(CONFIG_MACH_SUN50I) || IS_ENABLED(CONFIG_MACH_SUN8I)
|| IS_ENABLED(CONFIG_MACH_SUN9I) ||
IS_ENABLED(CONFIG_SUN50I_GEN_H6) ||
IS_ENABLED(CONFIG_MACH_SUN55I_A523)) &&
(sdc_no == 2))
cfg->host_caps = MMC_MODE_8BIT;
@@ -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))
More information about the U-Boot
mailing list