u-boot error: "switch failed"

Hello,

I have noticed that u-boot comes with BSP 5.7.6 (reference multimedia image) produces an error before jumping to linux kernel for the internal mmc. The error can be seen in the following log:

U-Boot 2020.04-5.7.6+git.e72d2f7c00a1 (Mar 08 2024 - 14:31:38 +0000)

CPU:   i.MX8MP[8] rev1.1 1600 MHz (running at 1200 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 50C
Reset cause: POR
DRAM:  4 GiB
MMC:   FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC... OK
In:    serial
Out:   serial
Err:   serial
Model: Toradex Verdin iMX8M Plus Quad 4GB Wi-Fi / BT IT V1.1B, Serial# 15287933
Carrier: Toradex Dahlia V1.1C, Serial# 10952624

 BuildInfo:
  - ATF 2fa8c63
  - U-Boot 2020.04-5.7.6+git.e72d2f7c00a1

Setting variant to wifi
flash target is MMC:2
Net:   eth1: ethernet@30be0000, eth0: ethernet@30bf0000 [PRIME]
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot:  0 
MMC: no card present
switch to partitions #0, OK
mmc2(part 0) is current device
Scanning mmc 2:1...
Found U-Boot script /boot.scr
5964 bytes read in 7 ms (832 KiB/s)
## Executing script at 47000000
Loading DeviceTree: imx8mp-verdin-wifi-dev.dtb
88891 bytes read in 13 ms (6.5 MiB/s)
86 bytes read in 6 ms (13.7 KiB/s)
Applying Overlay: verdin-imx8mp_native-hdmi_overlay.dtbo
1860 bytes read in 11 ms (165 KiB/s)
Applying Overlay: verdin-imx8mp_lt8912_overlay.dtbo
1987 bytes read in 13 ms (148.4 KiB/s)
10717259 bytes read in 101 ms (101.2 MiB/s)
Uncompressed size: 25831936 = 0x18A2A00
Bootargs: root=PARTUUID=a5a15bf4-02 ro rootwait console=tty1 console=ttymxc2,115200 consoleblank=0 earlycon
## Flattened Device Tree blob at 44000000
   Booting using the fdt blob at 0x44000000
   Loading Device Tree to 00000000fdbba000, end 00000000fdbf2fff ... OK

Starting kernel ...

switch failed 1/183/0x2 !
switch failed 1/183/0x0 !
switch failed 1/183/0x2 !
switch failed 1/183/0x0 !
switch failed 1/183/0x1 !
switch failed 1/183/0x0 !
switch failed 1/183/0x0 !
switch failed 1/183/0x0 !
switch failed 1/183/0x2 !
switch failed 1/183/0x0 !
switch failed 1/183/0x1 !
switch failed 1/183/0x0 !
switch failed 1/183/0x0 !
switch failed 1/183/0x0 !
switch failed 1/183/0x2 !
switch failed 1/183/0x0 !
switch failed 1/183/0x1 !
switch failed 1/183/0x0 !
switch failed 1/183/0x0 !
switch failed 1/183/0x0 !
unable to select a mode
device_remove: Device 'mmc@30b60000.blk' failed to remove, but children are gone
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 5.4.193-5.7.6+git.cf754d7aaa94 (oe-user@oe-host) (gcc version 9.5.0 (GCC)) #1 SMP PREEMPT Wed Jan 31 20:07:14 UTC 2024

The same error is not available with BSP 6.7.0 (reference multimedia image), here is the log for it:

U-Boot 2022.04-6.7.0+git.7588eb559ca2 (May 28 2024 - 11:19:14 +0000)

CPU:   i.MX8MP[8] rev1.1 1600 MHz (running at 1200 MHz)
CPU:   Industrial temperature grade (-40C to 105C) at 50C
Reset cause: POR
DRAM:  4 GiB
Core:  89 devices, 23 uclasses, devicetree: separate
WDT:   Started watchdog@30280000 with servicing (60s timeout)
MMC:   FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC... OK
In:    serial
Out:   serial
Err:   serial
Model: Toradex 0058 Verdin iMX8M Plus Quad 4GB WB IT V1.1B
Serial#: 15287933
Carrier: Toradex Dahlia V1.1C, Serial# 10952624
SEC0:  RNG instantiated

 BuildInfo:
  - ATF 3c1583b

Setting variant to wifi
flash target is MMC:2
Net:   eth1: ethernet@30be0000, eth0: ethernet@30bf0000 [PRIME]
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot:  0 
MMC: no card present
switch to partitions #0, OK
mmc2(part 0) is current device
Scanning mmc 2:1...
Found U-Boot script /boot.scr
6010 bytes read in 1 ms (5.7 MiB/s)
## Executing script at 50280000
Loading DeviceTree: imx8mp-verdin-wifi-dev.dtb
90278 bytes read in 1 ms (86.1 MiB/s)
118 bytes read in 1 ms (115.2 KiB/s)
Applying Overlay: verdin-imx8mp_hdmi_overlay.dtbo
2219 bytes read in 1 ms (2.1 MiB/s)
Applying Overlay: verdin-imx8mp_dsi-to-hdmi_overlay.dtbo
3652 bytes read in 1 ms (3.5 MiB/s)
Applying Overlay: verdin-imx8mp_spidev_overlay.dtbo
561 bytes read in 1 ms (547.9 KiB/s)
11675535 bytes read in 42 ms (265.1 MiB/s)
Bootargs: root=PARTUUID=4cbdc672-02 ro rootwait console=tty1 console=ttymxc2,115200 consoleblank=0 earlycon
   Uncompressing Kernel Image
## Flattened Device Tree blob at 50200000
   Booting using the fdt blob at 0x50200000
   Loading Device Tree to 00000000ffac0000, end 00000000ffaf9fff ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 5.15.148-6.7.0+git.bfdbfb2c85fb (oe-user@oe-host) (aarch64-tdx-linux-gcc (GCC) 11.4.0, GNU ld (GNU Binutils) 2.38.20220708) #1 SMP PREEMPT Thu Jun 20 15:59:41 UTC 2024

Did you investigate this error before?
Is it harmful for the production?

Thank you.

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


The error message “switch failed” that you are seeing in U-Boot 2020.04-5.7.6+git.e72d2f7c00a1 before jumping to the Linux kernel on the internal MMC is not present in the newer BSP 6.7.0. This suggests that the issue might have been resolved in the newer BSP version.

Analysis:

  1. Error Message: The “switch failed” messages indicate that U-Boot is attempting to switch something (likely MMC partitions or devices) and failing to do so.
  2. BSP Version Difference: The absence of the error in BSP 6.7.0 suggests that there have been fixes or changes in the U-Boot code or configuration that address this issue.

Potential Causes:

  • MMC Initialization: There might be an issue with how the MMC is initialized or accessed in the older U-Boot version.
  • Device Tree Overlays: The application of device tree overlays might be causing issues in the older version.
  • Kernel Compatibility: There might be compatibility issues between the U-Boot version and the Linux kernel version being used.

Recommendations:

  1. Upgrade to BSP 6.7.0: Since the issue is not present in BSP 6.7.0, it is recommended to upgrade to this version if possible. This will ensure you have the latest fixes and improvements.
  2. Check U-Boot Configuration: Compare the U-Boot configuration (defconfig) between the two BSP versions to identify any significant changes that might be related to MMC handling.
  3. Review Device Tree Overlays: Ensure that the device tree overlays being applied are correct and compatible with your hardware setup.

Harmfulness for Production:

  • Potential Impact: If the “switch failed” errors are related to MMC initialization or partition switching, it could potentially lead to issues with accessing the MMC, which might affect booting or data integrity.
  • Testing: Thoroughly test the system to ensure that the error does not cause any functional issues. If the system boots and operates correctly despite the error, it might be benign, but this cannot be guaranteed without detailed testing.

Conclusion:

While the error might not immediately appear harmful if the system boots and operates correctly, it is advisable to upgrade to BSP 6.7.0 to avoid potential issues in production. If upgrading is not feasible, further investigation into the U-Boot configuration and device tree overlays for BSP 5.7.6 is necessary to identify and resolve the root cause of the error.

Please, also check if these links can help you solve your problem:

Verdin iMX8M Plus: Enabling ecspi1 in u-boot.

Hi @Fide!

As far as I know, it was not investigated.

If, from your tests, the boot is successful, it should not be an issue. After U-Boot is done loading the kernel, the later takes over and U-Boot should have no impact.

If you want to dive into why the message is printed, you can check it on U-Boot’s source code:

https://git.toradex.com/cgit/u-boot-toradex.git/tree/drivers/mmc/mmc.c?h=toradex_imx_v2020.04_5.4.70_2.3.0#n805

Best regards,