Bug 213753 - Kernel boots failed with "mmc1: invalid bus width" on Raspberry Pi 400
Summary: Kernel boots failed with "mmc1: invalid bus width" on Raspberry Pi 400
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: MMC/SD (show other bugs)
Hardware: ARM Linux
: P1 normal
Assignee: drivers_mmc-sd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-16 04:25 UTC by Jian-Hong Pan
Modified: 2024-02-19 03:54 UTC (History)
4 users (show)

See Also:
Kernel Version: 5.14-rc1
Subsystem:
Regression: No
Bisected commit-id:


Attachments
U-Boot & kernel 5.14-rc1 dmesg log (29.13 KB, text/plain)
2021-07-16 04:25 UTC, Jian-Hong Pan
Details
The kernel build config for comment #0 (193.10 KB, text/plain)
2021-07-16 04:27 UTC, Jian-Hong Pan
Details

Description Jian-Hong Pan 2021-07-16 04:25:28 UTC
Created attachment 297889 [details]
U-Boot & kernel 5.14-rc1 dmesg log

I tried to boot Linux kernel 5.14-rc1 from U-Boot on Raspberry Pi 400.

* U-Boot goes with the bcm2711-rpi-400.dtb from Raspberry Pi OS firmware at tag 1.20210527 [1].  U-Boot is built with the rpi_4_defconfig.
* The Linux kernel goes with the corresponding bcm2711-rpi-400.dtb from kernel.

U-Boot boots the kernel up.  However, the kernel is stuck at failed mmc, which keeps showing "mmc1: invalid bus width":

[   11.139052] mmc1: error -22 whilst initialising SD card
[   21.215515] mmc1: Timeout waiting for hardware cmd interrupt.
[   21.224497] mmc1: sdhci: ============ SDHCI REGISTER DUMP ===========
[   21.234173] mmc1: sdhci: Sys addr:  0x00000000 | Version:  0x00001002
[   21.243842] mmc1: sdhci: Blk size:  0x00000000 | Blk cnt:  0x00000000
[   21.253479] mmc1: sdhci: Argument:  0x80000c08 | Trn mode: 0x00000000
[   21.263099] mmc1: sdhci: Present:   0x1fff0001 | Host ctl: 0x00000001
[   21.272705] mmc1: sdhci: Power:     0x0000000f | Blk gap:  0x00000080
[   21.282332] mmc1: sdhci: Wake-up:   0x00000000 | Clock:    0x0000f447
[   21.291939] mmc1: sdhci: Timeout:   0x00000000 | Int stat: 0x00000000
[   21.301519] mmc1: sdhci: Int enab:  0x00ff1003 | Sig enab: 0x00ff1003
[   21.311079] mmc1: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
[   21.320631] mmc1: sdhci: Caps:      0x45ee6432 | Caps_1:   0x0000a525
[   21.330179] mmc1: sdhci: Cmd:       0x0000341a | Max curr: 0x00080008
[   21.339686] mmc1: sdhci: Resp[0]:   0x00000000 | Resp[1]:  0x00000000
[   21.349146] mmc1: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000000
[   21.358549] mmc1: sdhci: Host ctl2: 0x00000000
[   21.365868] mmc1: sdhci: ADMA Err:  0x00000000 | ADMA Ptr: 0x00000000
[   21.375220] mmc1: sdhci: ============================================
[   21.456329] mmc1: invalid bus width
[   21.461567] mmc1: error -22 whilst initialising SD card
[   22.704472] mmc1: invalid bus width
[   22.708966] mmc1: error -22 whilst initialising SD card

Because of the failed MMC SD card, system fails to boot on RPi 400.

PS. The same SD card, same U-Boot & same kernel boot on RPi 4B correctly.

[1] https://github.com/raspberrypi/firmware/blob/1.20210527/boot/bcm2711-rpi-400.dtb
Comment 1 Jian-Hong Pan 2021-07-16 04:27:10 UTC
Created attachment 297891 [details]
The kernel build config for comment #0
Comment 2 Jian-Hong Pan 2021-07-19 02:18:05 UTC
Forgot to mention that both U-Boot and Linux kernel are built with aarch64 toolchain.
Comment 3 Jian-Hong Pan 2021-07-19 03:42:37 UTC
Tested with kernel 5.14-rc2.  This issue still can be reproduced.
Comment 4 Jian-Hong Pan 2021-07-29 09:39:49 UTC
Actually, kernel gets "mmc1: invalid bus width", because mmc_decode_scr() decodes the SCR register failed which is read in mmc_app_send_scr().
And, mmc_app_send_scr() sends the command "MMC_APP_CMD" + "SD_APP_SEND_SCR" to the SD card. The SD card should return the value of its SCR register via the data line. So, mmc_app_send_scr() uses DMA mechanism to get the value from data lines.

However, it only reads data with value zero from DMA.
Comment 5 gsmolders 2021-08-03 11:54:15 UTC
This issue also affects my Raspberry Pi 4 (4gb) using kernel 5.11.4. There are some reports on the internet linking this error to hardware issues with the used sdcards.
Comment 6 Jian-Hong Pan 2021-08-24 06:23:04 UTC
Tested with Linux kernel 5.14-rc7 again.  But, still get the same error issue.
Comment 7 Arthur 2021-10-22 00:15:22 UTC
I'm having the same issue on a raspberry pi 4 b 8gb as well as a cm4 module.
Comment 8 voidshine 2021-11-25 01:00:59 UTC
+1 having the same issue with AArch64 on this CPU:

Hardware        : BCM2711
Revision        : c03114
Model           : Raspberry Pi 4 Model B Rev 1.4

Tried a few different SD cards, a mix of Samsung and SanDisk @ 16GB, 32GB, 256GB... all fail with the same messages when using AArch64 builds, and they all run ARMv7 builds successfully on the same machine.

I haven't found evidence of a hardware issue yet, it seems to be this kernel/CPU/architecture combination specifically.
Comment 9 Jian-Hong Pan 2022-10-28 09:05:11 UTC
Found the patch series for U-Boot helps this issue:
"rpi: Copy eth PHY address from fw DT to loaded DT"
https://lore.kernel.org/u-boot/20220819085646.341575-1-antoine@karthanis.net/

Note You need to log in before you can comment on or make changes to this bug.