mmc: "unable to select a mode: -5" on i.MX8M/AM62 platforms
Hi,
U-Boot 2026.01 fails to initialize MMC devices on multiple platforms with "unable to select a mode: -5" during mmc_select_mode().
Affected platforms:
- Verdin iMX8M Mini (SPL boot failure - cannot boot at all)
- Verdin iMX8M Plus (MMC init fails in U-Boot proper - cannot boot)
- SMARC iMX8M Plus (MMC init fails in U-Boot proper)
- Verdin AM62 (boot failure, no output)
All platforms use eMMC and worked correctly prior to this regression.
Bisect results:
- Last known good commit: 228810d0bac3
- Known bad commit: 36aeeb591b0d
Between these commits, several MMC-related changes were merged. These seem particularly relevant:
commit aebb523a2381 ("mmc: mmc-uclass: Use max-frequency from device tree with default handling")
commit 1e40e419aeb2 ("mmc: sdhci-cadence: Use max-frequency property from device tree")
commit fa7e82127fad ("mmc: sdhci-cadence: Set controller and PHY speed modes for SD and eMMC cards")
Could someone familiar with these recent changes help identify what might have changed in the mode selection logic?
=== Example logs ===
Verdin iMX8M Mini (SPL failure):
U-Boot SPL 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000)
WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout) SEC0: RNG instantiated
Trying to boot from MMC1
unable to select a mode: -5
spl: mmc init failed with error: -524
Error: -524
SPL: Unsupported Boot Device!
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###
---
Verdin iMX8M Plus (U-Boot proper failure):
U-Boot SPL 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000) DDR configured as dual rank
WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout) SEC0: RNG instantiated
Normal Boot
Trying to boot from BOOTROM
Boot Stage: Primary boot
Find img info 0x?, size 1208151552
Need continue download 1024
load_simple_fit: Skip load 'tee': image size is 0! NOTICE: Do not release JR0 to NS as it can be used by HAB NOTICE: BL31: v2.12.0(release):lf-6.12.20-2.0.0-dirty NOTICE: BL31: Built : 08:15:07, May 9 2025
U-Boot 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000)
CPU: NXP i.MX8MP[8] Rev1.1 A53 at 1200 MHz CPU: Industrial temperature grade (-40C to 105C) at 23C DRAM: 8 GiB Core: 309 devices, 31 uclasses, devicetree: separate WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout) MMC: FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC... unable to select a mode: -5
Verdin iMX8MP # saveenv
Saving Environment to MMC... unable to select a mode: -5 No block device
Failed (1)
---
SMARC iMX8M Plus:
U-Boot SPL 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000) Training FAILED
DDR configured as single rank
SEC0: RNG instantiated
Normal Boot
Trying to boot from BOOTROM
Boot Stage: Primary boot
Find img info 0x?, size 1208152064
Need continue download 1024
load_simple_fit: Skip load 'tee': image size is 0! NOTICE: Do not release JR0 to NS as it can be used by HAB NOTICE: BL31: v2.12.0(release):lf-6.12.20-2.0.0-dirty NOTICE: BL31: Built : 08:15:07, May 9 2025
U-Boot 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000)
CPU: NXP i.MX8MP[8] Rev1.1 A53 at 1200 MHz CPU: Industrial temperature grade (-40C to 105C) at 23C DRAM: 4 GiB Core: 317 devices, 32 uclasses, devicetree: separate WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout) MMC: FSL_SDHC: 1, FSL_SDHC: 0
Loading Environment from MMC... unable to select a mode: -5 *** Warning - No block device, using default environment unable to select a mode: -5
MMC init failed
---
I'm available to test patches or provide additional debug output if needed.
Best regards,
Vitor Soares
Quoted 5 lines · Vitor Soares
Verdin iMX8M Mini (SPL failure):
U-Boot SPL 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000)
WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout) SEC0: RNG instantiated
Quoted 7 lines
Trying to boot from MMC1
unable to select a mode: -5
spl: mmc init failed with error: -524
Error: -524
SPL: Unsupported Boot Device!
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###
Please run 'git bisect' to identify the guilty commit.
Am 08.01.26 um 00:15 schrieb Vitor Soares:
Quoted 109 lines
Hi,
U-Boot 2026.01 fails to initialize MMC devices on multiple platforms with "unable to select a mode: -5" during
mmc_select_mode().Affected platforms:
- Verdin iMX8M Mini (SPL boot failure - cannot boot at all)
- Verdin iMX8M Plus (MMC init fails in U-Boot proper - cannot boot)
- SMARC iMX8M Plus (MMC init fails in U-Boot proper)
- Verdin AM62 (boot failure, no output)All platforms use eMMC and worked correctly prior to this regression.
Bisect results:
- Last known good commit:228810d0bac3
- Known bad commit:36aeeb591b0dBetween these commits, several MMC-related changes were merged. These seem particularly relevant:
commitaebb523a2381("mmc: mmc-uclass: Use max-frequency from device tree with default handling")
commit1e40e419aeb2("mmc: sdhci-cadence: Use max-frequency property from device tree")
commitfa7e82127fad("mmc: sdhci-cadence: Set controller and PHY speed modes for SD and eMMC cards")Could someone familiar with these recent changes help identify what might have changed in the mode selection logic?
=== Example logs ===
Verdin iMX8M Mini (SPL failure):
U-Boot SPL 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000)
WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout) SEC0: RNG instantiatedTrying to boot from MMC1
unable to select a mode: -5
spl: mmc init failed with error: -524
Error: -524
SPL: Unsupported Boot Device!
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###---
Verdin iMX8M Plus (U-Boot proper failure):
U-Boot SPL 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000) DDR configured as dual rank
WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout) SEC0: RNG instantiatedNormal Boot
Trying to boot from BOOTROM
Boot Stage: Primary boot
Find img info 0x?, size 1208151552
Need continue download 1024load_simple_fit: Skip load 'tee': image size is 0! NOTICE: Do not release JR0 to NS as it can be used by HAB NOTICE: BL31: v2.12.0(release):lf-6.12.20-2.0.0-dirty NOTICE: BL31: Built : 08:15:07, May 9 2025U-Boot 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000)
CPU: NXP i.MX8MP[8] Rev1.1 A53 at 1200 MHz CPU: Industrial temperature grade (-40C to 105C) at 23C DRAM: 8 GiB Core: 309 devices, 31 uclasses, devicetree: separate WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout) MMC: FSL_SDHC: 1, FSL_SDHC: 2Loading Environment from MMC... unable to select a mode: -5
Verdin iMX8MP # saveenv
Saving Environment to MMC... unable to select a mode: -5 No block device
Failed (1)---
SMARC iMX8M Plus:
U-Boot SPL 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000) Training FAILED
DDR configured as single rank
SEC0: RNG instantiated
Normal Boot
Trying to boot from BOOTROM
Boot Stage: Primary boot
Find img info 0x?, size 1208152064
Need continue download 1024load_simple_fit: Skip load 'tee': image size is 0! NOTICE: Do not release JR0 to NS as it can be used by HAB NOTICE: BL31: v2.12.0(release):lf-6.12.20-2.0.0-dirty NOTICE: BL31: Built : 08:15:07, May 9 2025U-Boot 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000)
CPU: NXP i.MX8MP[8] Rev1.1 A53 at 1200 MHz CPU: Industrial temperature grade (-40C to 105C) at 23C DRAM: 4 GiB Core: 317 devices, 32 uclasses, devicetree: separate WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout) MMC: FSL_SDHC: 1, FSL_SDHC: 0Loading Environment from MMC... unable to select a mode: -5 *** Warning - No block device, using default environment unable to select a mode: -5
MMC init failed
---
Quoted 4 lines
I'm available to test patches or provide additional debug output if needed.
Best regards,
Vitor Soares
Hi Victor,
what frequencies are output when you enable DEBUG output in mmc.c?
I'm currently trying to find a solution for why the SD card and MMC in U-Boot (they work fine in SPL) are only running at a minimum frequency on the TQMa6 (iMX6) and TQMa6UL (iMX6UL).
My problem comes from commit aebb523a2381 ("mmc: mmc-uclass: Use max-frequency from device tree with.
=== Example logs ===
U-Boot SPL 2026.01+g6955caf8885+p13111 (Jan 07 2026 - 15:26:17 +0100) SD
Trying to boot from MMC2
clock is disabled (0Hz)
clock is enabled (400000Hz)
clock is enabled (50000000Hz)
Device tree: imx6q-mba6a
U-Boot 2026.01+g6955caf8885+p13111 (Jan 07 2026 - 15:26:17 +0100)
CPU: Freescale i.MX6D rev1.3 at 792MHz CPU: Industrial temperature grade (-40C to 105C) at 20C Reset cause: POR Model: TQ TQMa6Q on MBa6x Board: TQMa6D on a MBa6x Enet workaround: Unknown DRAM: 1 GiB Core: 104 devices, 27 uclasses, devicetree: separate WDT: Started watchdog@20bc000 with servicing every 1000ms (128s timeout) MMC: FSL_SDHC: 1, FSL_SDHC: 0
Loading Environment from MMC... clock is disabled (0Hz) clock is enabled (400000Hz)
clock is enabled (400000Hz)
Reading from redundant MMC(1)... OK
In: serial@21e8000 Out: serial@21e8000 Err: serial@21e8000
clock is disabled (0Hz)
clock is enabled (400000Hz)
clock is enabled (400000Hz)
switch to partitions #0, OK
mmc1 is current device
Signature · 7 lines
Best regards, Max TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider http://www.tq-group.com/
Quoted 155 lines · Max Merchel
Am 08.01.26 um 00:15 schrieb Vitor Soares:
Quoted 111 lines
Hi,
U-Boot 2026.01 fails to initialize MMC devices on multiple platforms with "unable to select a mode: -5" during
mmc_select_mode().Affected platforms:
- Verdin iMX8M Mini (SPL boot failure - cannot boot at all)
- Verdin iMX8M Plus (MMC init fails in U-Boot proper - cannot boot)
- SMARC iMX8M Plus (MMC init fails in U-Boot proper)
- Verdin AM62 (boot failure, no output)All platforms use eMMC and worked correctly prior to this regression.
Bisect results:
- Last known good commit:228810d0bac3
- Known bad commit:36aeeb591b0dBetween these commits, several MMC-related changes were merged. These seem particularly relevant:
commitaebb523a2381("mmc: mmc-uclass: Use max-frequency from device tree with default handling")
commit1e40e419aeb2("mmc: sdhci-cadence: Use max-frequency property from device tree")
commitfa7e82127fad("mmc: sdhci-cadence: Set controller and PHY speed modes for SD and eMMC cards")Could someone familiar with these recent changes help identify what might have changed in the mode selection logic?
=== Example logs ===
Verdin iMX8M Mini (SPL failure):
U-Boot SPL 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000) WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout) SEC0: RNG instantiated
Trying to boot from MMC1
unable to select a mode: -5
spl: mmc init failed with error: -524
Error: -524
SPL: Unsupported Boot Device!
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###---
Verdin iMX8M Plus (U-Boot proper failure):
U-Boot SPL 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000) DDR configured as dual rank
WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout) SEC0: RNG instantiated
Normal Boot
Trying to boot from BOOTROM
Boot Stage: Primary boot
Find img info 0x?, size 1208151552
Need continue download 1024load_simple_fit: Skip load 'tee': image size is 0!
NOTICE: Do not release JR0 to NS as it can be used by HAB NOTICE: BL31: v2.12.0(release):lf-6.12.20-2.0.0-dirty
NOTICE: BL31: Built : 08:15:07, May 9 2025U-Boot 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000)
CPU: NXP i.MX8MP[8] Rev1.1 A53 at 1200 MHz
CPU: Industrial temperature grade (-40C to 105C) at 23C DRAM: 8 GiB
Core: 309 devices, 31 uclasses, devicetree: separate
WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout) MMC:FSL_SDHC: 1,FSL_SDHC: 2
Loading Environment from MMC... unable to select a mode: -5Verdin iMX8MP # saveenv
Saving Environment to MMC... unable to select a mode: -5 No block device
Failed (1)---
SMARC iMX8M Plus:
U-Boot SPL 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000) Training FAILED
DDR configured as single rank
SEC0: RNG instantiated
Normal Boot
Trying to boot from BOOTROM
Boot Stage: Primary boot
Find img info 0x?, size 1208152064
Need continue download 1024load_simple_fit: Skip load 'tee': image size is 0!
NOTICE: Do not release JR0 to NS as it can be used by HAB NOTICE: BL31: v2.12.0(release):lf-6.12.20-2.0.0-dirty
NOTICE: BL31: Built : 08:15:07, May 9 2025U-Boot 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000)
CPU: NXP i.MX8MP[8] Rev1.1 A53 at 1200 MHz
CPU: Industrial temperature grade (-40C to 105C) at 23C DRAM: 4 GiB
Core: 317 devices, 32 uclasses, devicetree: separate
WDT: Started watchdog@30280000 with servicing every 1000ms (60s timeout) MMC:FSL_SDHC: 1,FSL_SDHC: 0
Loading Environment from MMC... unable to select a mode: -5 *** Warning - No block device, using default environment unable to select a mode: -5
MMC init failed
---Quoted 4 lines
I'm available to test patches or provide additional debug output if needed.
Best regards,
Vitor SoaresHi Victor,
what frequencies are output when you enable DEBUG output in
mmc.c?I'm currently trying to find a solution for why the SD card and MMC in U-Boot (they work fine in SPL) are only running at a minimum frequency on the TQMa6 (iMX6) and TQMa6UL (iMX6UL).
My problem comes from commit
aebb523a2381("mmc: mmc-uclass: Use max- frequency from device tree with.=== Example logs ===
U-Boot SPL 2026.01+g6955caf8885+p13111 (Jan 07 2026 - 15:26:17 +0100) SD
Trying to boot from MMC2
clock is disabled (0Hz)
clock is enabled (400000Hz)
clock is enabled (50000000Hz)
Device tree: imx6q-mba6aU-Boot 2026.01+g6955caf8885+p13111 (Jan 07 2026 - 15:26:17 +0100)
CPU: Freescale i.MX6D rev1.3 at 792MHz
CPU: Industrial temperature grade (-40C to 105C) at 20C Reset cause: POR
Model: TQ TQMa6Q on MBa6x
Board: TQMa6D on a MBa6x
Enet workaround: Unknown
DRAM: 1 GiB
Core: 104 devices, 27 uclasses, devicetree: separate
WDT: Started watchdog@20bc000 with servicing every 1000ms (128s timeout) MMC:FSL_SDHC: 1,FSL_SDHC: 0
Loading Environment from MMC... clock is disabled (0Hz)
clock is enabled (400000Hz)
clock is enabled (400000Hz)
Reading from redundant MMC(1)... OK
Quoted 9 lines
In: serial@21e8000
Out: serial@21e8000
Err: serial@21e8000
clock is disabled (0Hz)
clock is enabled (400000Hz)
clock is enabled (400000Hz)
switch to partitions #0, OK
mmc1 is current device
Hi Vitor,
Thanks for the detailed report and bisect results. I've looked into the issue, and it appears the regression is introduced by commit aebb523a2381 ("mmc: mmc-uclass: Use max-frequency from device tree with default handling"). The problem stems from the probe function in the FSL eSDHC driver (fsl_esdhc_probe). Here's a breakdown:
First, fsl_esdhc_init is called, which sets cfg->f_max to the minimum of the controller's sdhc_clk and a hardcoded 200 MHz limit:cfg->f_max = min(priv->sdhc_clk, (u32)200000000);
Subsequently, mmc_of_parse is invoked, where in the commit if the "max-frequency" property is not specified in the device tree node for the MMC controller, this function overrides cfg->f_max to 0.
This results in f_max being set to 0, which prevents proper mode selection during MMC initialization and leads to the "unable to select a mode: -5" error you're seeing across those platforms.
A potential fix could involve either:
Adding the "max-frequency" property to the relevant device tree nodes (e.g., setting it to 200000000 or the appropriate value based on the hardware).
Or Revert the commit aebb523a2381, since platform data from dev_get_plat() is calloc-allocated (zeroed), so prior behavior left f_max at 0 until the driver set it—restoring the hardcoded limit.
Let me know if this aligns with what you're observing.
Regards,
Tanmay
Quoted 28 lines · Tanmay Kathpalia
Quoted 27 lines · Max Merchel
Am 08.01.26 um 00:15 schrieb Vitor Soares:
Quoted 26 lines
U-Boot 2026.01 fails to initialize MMC devices on multiple platforms with "unable to select a mode: -5" during
mmc_select_mode().Affected platforms:
- Verdin iMX8M Mini (SPL boot failure - cannot boot at all)
- Verdin iMX8M Plus (MMC init fails in U-Boot proper - cannot boot)
- SMARC iMX8M Plus (MMC init fails in U-Boot proper)
- Verdin AM62 (boot failure, no output)All platforms use eMMC and worked correctly prior to this regression.
Bisect results:
- Last known good commit:228810d0bac3
- Known bad commit:36aeeb591b0dBetween these commits, several MMC-related changes were merged. These seem particularly relevant:
commitaebb523a2381("mmc: mmc-uclass: Use max-frequency from device tree with
default handling")
commit1e40e419aeb2("mmc: sdhci-cadence: Use max-frequency property from device
tree")
commitfa7e82127fad("mmc: sdhci-cadence: Set controller and PHY speed modes for
SD and eMMC cards")
...
Quoted 14 lines
Thanks for the detailed report and bisect results. I've looked into the issue, and it appears the regression is introduced by commit
aebb523a2381("mmc: mmc-uclass: Use max-frequency from device tree with default handling").
The problem stems from the probe function in the FSL eSDHC driver (fsl_esdhc_probe). Here's a breakdown:First,
fsl_esdhc_initis called, which setscfg->f_maxto the minimum of the controller'ssdhc_clkand a hardcoded 200 MHz limit:cfg->f_max=min(priv->sdhc_clk, (u32)200000000);
Subsequently,mmc_of_parseis invoked, where in the commit if the "max-frequency" property is not specified in the device tree node for the MMC controller, this function overridescfg->f_maxto 0.
Quoted 8 lines
This results in
f_maxbeing set to 0, which prevents proper mode selection during MMC initialization and leads to the "unable to select a mode: -5" error you're seeing across those platforms.A potential fix could involve either:
Adding the "max-frequency" property to the relevant device tree nodes (e.g., setting it to 200000000 or the appropriate value based on the hardware).
In general solving a regression in code, adjusting the DT is not ok in Linux, not sure if the same reasoning would apply in the U-Boot use case (considering that both U-Boot and DT are firmware).
Francesco
Hi All,
Quoted 61 lines
Subject: Re: [REGRESSION] mmc: "unable to select a mode: -5" on i.MX8M/AM62 platforms
Quoted 4 lines · Tanmay Kathpalia
Quoted 3 lines · Max Merchel
Am 08.01.26 um 00:15 schrieb Vitor Soares:
Quoted 2 lines
U-Boot 2026.01 fails to initialize MMC devices on multiple platforms with "unable to select a mode: -5" during
mmc_select_mode().Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Affected platforms:
- Verdin iMX8M Mini (SPL boot failure - cannot boot at all)
- Verdin iMX8M Plus (MMC init fails in U-Boot proper - cannot boot)
- SMARC iMX8M Plus (MMC init fails in U-Boot proper)
- Verdin AM62 (boot failure, no output)All platforms use eMMC and worked correctly prior to this
regression.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Bisect results:
- Last known good commit:228810d0bac3
- Known bad commit:36aeeb591b0dBetween these commits, several MMC-related changes were
merged.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
These seem particularly relevant:
commitaebb523a2381("mmc: mmc-uclass: Use max-frequencyfrom
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
device tree with default handling") commit
1e40e419aeb2("mmc:
sdhci-cadence: Use max-frequency property from device tree")
commitfa7e82127fad("mmc: sdhci-cadence: Set controller andPHY
Quoted 1 line
Quoted 1 line
Quoted 1 line
speed modes for SD and eMMC cards")
...
Quoted 4 lines
Thanks for the detailed report and bisect results. I've looked into the issue, and it appears the regression is introduced by commit
aebb523a2381
("mmc: mmc-uclass: Use max-frequency from device tree withdefault
Quoted 11 lines
handling").
The problem stems from the probe function in the FSL eSDHC driver (fsl_esdhc_probe). Here's a breakdown:First,
fsl_esdhc_initis called, which setscfg->f_maxto the minimum of the controller'ssdhc_clkand a hardcoded 200 MHz limit:cfg->f_max=min(priv->sdhc_clk, (u32)200000000); Subsequently,mmc_of_parseis invoked, where in the commit if the "max-frequency" property is not specified in the device tree node for the MMC controller, this function overridescfg->f_maxto 0.Quoted 2 lines
This results in
f_maxbeing set to 0, which prevents proper mode selection during MMC initialization and leads to the "unable to selecta mode: -5"
Quoted 4 lines
error you're seeing across those platforms.
A potential fix could involve either:
Quoted 8 lines
Quoted 1 line
Adding the "max-frequency" property to the relevant device tree
nodes
Quoted 1 line
(e.g., setting it to 200000000 or the appropriate value based on the
hardware).
In general solving a regression in code, adjusting the DT is not ok in Linux, not sure if the same reasoning would apply in the U-Boot use case (considering that both U-Boot and DT are firmware).
Please see whether below changes could work on your platforms or not. It works on i.MX93.
drivers/mmc/mmc-uclass.c +2 -1
@@ -249,7 +249,8 @@ int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg)* will set the MMC configuration maximum frequency to the host controller's * maximum base clock frequency from capabilities register. */ - cfg->f_max =dev_read_u32_default (dev,"max-frequency" ,0 ); +if (!cfg->f_max) + cfg->f_max =dev_read_u32_default (dev,"max-frequency" ,0 );if (dev_read_bool (dev,"cap-sd-highspeed" )) cfg->host_caps |=MMC_CAP (SD_HS );
Quoted 2 lines
Francesco
Am 08.01.26 um 11:33 schrieb Peng Fan:
Quoted 81 lines
Hi All,
Quoted 61 lines
Subject: Re: [REGRESSION] mmc: "unable to select a mode: -5" on i.MX8M/AM62 platforms
Quoted 4 lines · Tanmay Kathpalia
Quoted 3 lines · Max Merchel
Am 08.01.26 um 00:15 schrieb Vitor Soares:
Quoted 2 lines
U-Boot 2026.01 fails to initialize MMC devices on multiple platforms with "unable to select a mode: -5" during
mmc_select_mode().Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Affected platforms:
- Verdin iMX8M Mini (SPL boot failure - cannot boot at all)
- Verdin iMX8M Plus (MMC init fails in U-Boot proper - cannot boot)
- SMARC iMX8M Plus (MMC init fails in U-Boot proper)
- Verdin AM62 (boot failure, no output)All platforms use eMMC and worked correctly prior to this
regression.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Bisect results:
- Last known good commit:228810d0bac3
- Known bad commit:36aeeb591b0dBetween these commits, several MMC-related changes were
merged.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
These seem particularly relevant:
commitaebb523a2381("mmc: mmc-uclass: Use max-frequencyfrom
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
device tree with default handling") commit
1e40e419aeb2("mmc:
sdhci-cadence: Use max-frequency property from device tree")
commitfa7e82127fad("mmc: sdhci-cadence: Set controller andPHY
Quoted 1 line
Quoted 1 line
Quoted 1 line
speed modes for SD and eMMC cards")
...
Quoted 4 lines
Thanks for the detailed report and bisect results. I've looked into the issue, and it appears the regression is introduced by commit
aebb523a2381
("mmc: mmc-uclass: Use max-frequency from device tree withdefault
Quoted 11 lines
handling").
The problem stems from the probe function in the FSL eSDHC driver (fsl_esdhc_probe). Here's a breakdown:First,
fsl_esdhc_initis called, which setscfg->f_maxto the minimum of the controller'ssdhc_clkand a hardcoded 200 MHz limit:cfg->f_max=min(priv->sdhc_clk, (u32)200000000); Subsequently,mmc_of_parseis invoked, where in the commit if the "max-frequency" property is not specified in the device tree node for the MMC controller, this function overridescfg->f_maxto 0.Quoted 2 lines
This results in
f_maxbeing set to 0, which prevents proper mode selection during MMC initialization and leads to the "unable to selecta mode: -5"
Quoted 4 lines
error you're seeing across those platforms.
A potential fix could involve either:
Quoted 8 lines
Quoted 1 line
Adding the "max-frequency" property to the relevant device tree
nodes
Quoted 1 line
(e.g., setting it to 200000000 or the appropriate value based on the
hardware).
In general solving a regression in code, adjusting the DT is not ok in Linux, not sure if the same reasoning would apply in the U-Boot use case (considering that both U-Boot and DT are firmware).
Please see whether below changes could work on your platforms or not. It works on i.MX93.
drivers/mmc/mmc-uclass.c +0
-0
drivers/mmc/mmc-uclass.c int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg) · line 256
Quoted 9 lines
drivers/mmc/mmc-uclass.c +2
-1@@ -249,7 +249,8 @@ int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg)* will set the MMC configuration maximum frequency to the host controller's * maximum base clock frequency from capabilities register. */ - cfg->f_max =dev_read_u32_default (dev,"max-frequency" ,0 ); +if (!cfg->f_max) + cfg->f_max =dev_read_u32_default (dev,"max-frequency" ,0 );if (dev_read_bool (dev,"cap-sd-highspeed" )) cfg->host_caps |=MMC_CAP (SD_HS );
Hi Pan,
the change prevents the function from being carried out on the iMX6.
Settings of max-frequency in dt are ignored because cfg->f_max has already been set initially.
Signature · 7 lines
Best regards, Max TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider http://www.tq-group.com/
Hi Tanmay,
Quoted 8 lines · Tanmay Kathpalia
A potential fix could involve either:
Adding the "max-frequency" property to the relevant device tree nodes (e.g., setting it to 200000000 or the appropriate value based on the hardware).
Or Revert the commitaebb523a2381, since platform data fromdev_get_plat()is calloc-allocated (zeroed), so prior behavior leftf_maxat 0 until the driver set it—restoring the hardcoded limit.
Could you please send a revert?
Hi Fabio,
Quoted 1 line · Fabio Estevam
Could you please send a revert?
Here is the revert patch for commit aebb523a2381 ("mmc: mmc-uclass: Use max-frequency from device tree with default handling"):
drivers/mmc/mmc-uclass.c +2 -7
@@ -243,13 +243,8 @@ int mmc_of_parse(struct udevice *dev, struct mmc_config *cfg)return -EINVAL ; } -/* -* Maximum frequency is obtained from the optional "max-frequency" property. -* If not specified in device tree, defaults to 0 and sdhci_setup_cfg() -* will set the MMC configuration maximum frequency to the host controller's -* maximum base clock frequency from capabilities register. -*/ - cfg->f_max =dev_read_u32_default (dev,"max-frequency" ,0 ); +/* f_max is obtained from the optional "max-frequency" property */ +dev_read_u32 (dev,"max-frequency" , &cfg->f_max);if (dev_read_bool (dev,"cap-sd-highspeed" )) cfg->host_caps |=MMC_CAP (SD_HS );
Hi Tanmay,
Quoted 9 lines · Tanmay Kathpalia
Hi Fabio,
Quoted 1 line · Fabio Estevam
Could you please send a revert?
Here is the revert patch for commit
aebb523a2381("mmc: mmc-uclass: Use max-frequency from device tree with default handling"):
I meant a formal revert patch sent to the U-Boot mailing list.
Thanks
Hi Fabio,
Quoted 9 lines · Fabio Estevam
Hi Tanmay,
Quoted 5 lines · Tanmay Kathpalia
Hi Fabio,
On 1/8/2026 4:38 PM, Fabio Estevam wrote:
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Could you please send a revert?
Here is the revert patch for commit
aebb523a2381("mmc: mmc-uclass: Use max-frequency from device tree with default handling"):I meant a formal revert patch sent to the U-Boot mailing list.
Thanks
As requested, I have sent a revert patch to the U-Boot mailing list.
Thanks
Hi Vitor,
Quoted 20 lines
Subject: [REGRESSION] mmc: "unable to select a mode: -5" on i.MX8M/AM62 platforms
Hi,
U-Boot 2026.01 fails to initialize MMC devices on multiple platforms with "unable to select a mode: -5" during
mmc_select_mode().Affected platforms:
- Verdin iMX8M Mini (SPL boot failure - cannot boot at all)
- Verdin iMX8M Plus (MMC init fails in U-Boot proper - cannot boot)
- SMARC iMX8M Plus (MMC init fails in U-Boot proper)
- Verdin AM62 (boot failure, no output)All platforms use eMMC and worked correctly prior to this regression.
Bisect results:
- Last known good commit:228810d0bac3
- Known bad commit:36aeeb591b0d
Quoted 8 lines
Between these commits, several MMC-related changes were merged. These seem particularly relevant:
commitaebb523a2381("mmc: mmc-uclass: Use max-frequency from device tree with default handling") commit1e40e419aeb2("mmc:
sdhci-cadence: Use max-frequency property from device tree")
commitfa7e82127fad("mmc: sdhci-cadence: Set controller and PHY speed modes for SD and eMMC cards")
Thanks for the report. I meet same issue on i.MX93, checking..
Thanks,
Peng.
Quoted 93 lines
Could someone familiar with these recent changes help identify what might have changed in the mode selection logic?
=== Example logs ===
Verdin iMX8M Mini (SPL failure):
U-Boot SPL 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000)
WDT: Started watchdog@30280000 with servicing every 1000ms
(60s timeout)
SEC0: RNG instantiated
Trying to boot from MMC1
unable to select a mode: -5
spl: mmc init failed with error: -524
Error: -524
SPL: Unsupported Boot Device!
SPL: failed to boot from all boot devices ### ERROR ### Please RESET the board ###---
Verdin iMX8M Plus (U-Boot proper failure):
U-Boot SPL 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000) DDR configured as dual rank
WDT: Started watchdog@30280000 with servicing every 1000ms
(60s timeout)
SEC0: RNG instantiated
Normal Boot
Trying to boot from BOOTROM
Boot Stage: Primary boot
Find img info 0x?, size 1208151552
Need continue download 1024load_simple_fit: Skip load 'tee': image size is 0! NOTICE: Do not release JR0 to NS as it can be used by HAB NOTICE: BL31: v2.12.0(release):lf-6.12.20-2.0.0-dirty NOTICE: BL31: Built : 08:15:07, May 9 2025U-Boot 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000)
CPU: NXP i.MX8MP[8] Rev1.1 A53 at 1200 MHz CPU: Industrial temperature grade (-40C to 105C) at 23C DRAM: 8 GiB Core: 309 devices, 31 uclasses, devicetree: separate WDT: Started watchdog@30280000 with servicing every 1000ms(60s timeout)
MMC:FSL_SDHC: 1,FSL_SDHC: 2
Loading Environment from MMC... unable to select a mode: -5Verdin iMX8MP # saveenv
Saving Environment to MMC... unable to select a mode: -5 No block device Failed (1)---
SMARC iMX8M Plus:
U-Boot SPL 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000) Training FAILED DDR configured as single rank
SEC0: RNG instantiated
Normal Boot
Trying to boot from BOOTROM
Boot Stage: Primary boot
Find img info 0x?, size 1208152064
Need continue download 1024load_simple_fit: Skip load 'tee': image size is 0! NOTICE: Do not release JR0 to NS as it can be used by HAB NOTICE: BL31: v2.12.0(release):lf-6.12.20-2.0.0-dirty NOTICE: BL31: Built : 08:15:07, May 9 2025U-Boot 2026.01-0.0.0-devel+git.53c0d5b38795 (Jan 06 2026 - 20:44:27 +0000)
CPU: NXP i.MX8MP[8] Rev1.1 A53 at 1200 MHz CPU: Industrial temperature grade (-40C to 105C) at 23C DRAM: 4 GiB Core: 317 devices, 32 uclasses, devicetree: separate WDT: Started watchdog@30280000 with servicing every 1000ms(60s timeout)
MMC:FSL_SDHC: 1,FSL_SDHC: 0
Loading Environment from MMC... unable to select a mode: -5 *** Warning - No block device, using default environment unable to select a mode: -5 MMC init failed
---I'm available to test patches or provide additional debug output if needed.
Best regards,
Vitor Soares