PATCH mmc: sunxi: fix MACH_SUN9I typo in get_mclk_offset()

Andre Przywara andre.przywara at arm.com
Mon Jun 8 11:36:35 CEST 2026


Hi Omar,

On 5/26/26 23:28, Omar Ivan Fardjoume wrote:
> 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:

ah, very nice, thanks for taking care and posting stuff upstream!
I have some patches to enable Ethernet on the board (or rather all A80 
boards), I should probably post them now there is at least one user ;-)

> 1. The get_mclk_offset() function used the non-existent Kconfig symbol
>     CONFIG_MACH_SUN9I_A80 instead of CONFIG_MACH_SUN9I, causing the

Ouch, nice catch. While at it, I grep'ed the whole tree, seems to be the 
only occurrence of that mishap, though.

>     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.

Ah, yeah, seems right.
While looking at it, I am wondering if we should rephrase that 
statement, for instance to just exclude the older ones. Though I am 
wondering why we have this filter anyway: I see that we have at least 
one sun6i board with 8-bit eMMC.
Need to have a deeper look into this.

> Tested on a Cubieboard4 A80: with both fixes, SPL loads U-Boot proper
> and boots Debian 12 from eMMC with no SD card present.

I tested this briefly (though just in U-Boot proper), and it indeed was 
broken before and works now.
Have you tested the eMMC boot partitions? Then we should add 
CONFIG_SUPPORT_EMMC_BOOT=y to the defconfig. Will have a look myself 
tonight.

Btw: the patch seems mangled (tabs converted into just a few spaces), 
but I can fix this up before merging.

Thanks,
Andre

> 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