[BUG] U-Boot makes Linux kernel boot failed with "mmc1: invalid bus width" on RPi 400

Jian-Hong Pan jhp at endlessos.org
Wed Jul 7 06:23:38 CEST 2021


Hi,

I tried to boot Linux next kernel at tag 5.13.0-next-20210701 from
latest U-Boot at commit 1311dd37ec ("Merge branch
'2021-07-01-update-CI-containers'") 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 next kernel goes with the corresponding
bcm2711-rpi-400.dtb at tag 5.13.0-next-20210701.
However, the Linux kernel is stuck at failed mmc, which keeps showing
"mmc1: invalid bus width":

[    7.776752] mmc1: invalid bus width
[    7.781398] mmc1: error -22 whilst initialising SD card
[   17.891183] mmc1: Timeout waiting for hardware cmd interrupt.
[   17.900265] mmc1: sdhci: ============ SDHCI REGISTER DUMP ===========
[   17.910046] mmc1: sdhci: Sys addr:  0x00000000 | Version:  0x00001002
[   17.919829] mmc1: sdhci: Blk size:  0x00000000 | Blk cnt:  0x00000000
[   17.929595] mmc1: sdhci: Argument:  0x80000c08 | Trn mode: 0x00000000
[   17.939337] mmc1: sdhci: Present:   0x1fff0001 | Host ctl: 0x00000001
[   17.949092] mmc1: sdhci: Power:     0x0000000f | Blk gap:  0x00000080
[   17.958827] mmc1: sdhci: Wake-up:   0x00000000 | Clock:    0x0000f447
[   17.968531] mmc1: sdhci: Timeout:   0x00000000 | Int stat: 0x00000000
[   17.978201] mmc1: sdhci: Int enab:  0x00ff1003 | Sig enab: 0x00ff1003
[   17.987850] mmc1: sdhci: ACmd stat: 0x00000000 | Slot int: 0x00000000
[   17.997456] mmc1: sdhci: Caps:      0x45ee6432 | Caps_1:   0x0000a525
[   18.007044] mmc1: sdhci: Cmd:       0x0000341a | Max curr: 0x00080008
[   18.016622] mmc1: sdhci: Resp[0]:   0x00000000 | Resp[1]:  0x00000000
[   18.026157] mmc1: sdhci: Resp[2]:   0x00000000 | Resp[3]:  0x00000000
[   18.035650] mmc1: sdhci: Host ctl2: 0x00000000
[   18.043066] mmc1: sdhci: ADMA Err:  0x00000000 | ADMA Ptr: 0x00000000
[   18.052540] mmc1: sdhci: ============================================
[   18.139162] mmc1: invalid bus width
[   18.144682] mmc1: error -22 whilst initialising SD card
[   19.498785] mmc1: invalid bus width
[   19.503344] mmc1: error -22 whilst initialising SD card

The full log can be foud at
https://gist.github.com/starnight/dec6e6ee627f19c2d291f3ff973b06fa#file-uboot-kernel-log

In Linux kernel, SD card driver checks the bus_width bits for
validation [2] in mmc_decode_scr(). The value of bus_width comes from
the resp, which is assigned from mmc_card's raw_scr.
However, the values of resp[0..3] are 0, which means no
SD_SCR_BUS_WIDTH_1, nor SD_SCR_BUS_WIDTH_4.
After studied the call trace of mmc_decode_scr(), learned that
mmc_sd_init_card() -> mmc_app_send_scr() gets and assigns mmc_card's
raw_scr value [3] with "DMA" mechanism.

Therefore, I try to boot the same Linux next kernel with the same
corresponding bcm2711-rpi-400.dtb at tag 5.13.0-next-20210701
directly, without u-boot.
The system boots up and the mmc works correctly.  The full log can be
found at https://gist.github.com/starnight/dec6e6ee627f19c2d291f3ff973b06fa#file-kernel-without-uboot-log

Is there something special that should be done in U-Boot for Raspberry Pi 400?

[1] https://github.com/raspberrypi/firmware/blob/1.20210527/boot/bcm2711-rpi-400.dtb
[2] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/mmc/core/sd.c?h=next-20210701#n239
[3] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/mmc/core/sd_ops.c?h=next-20210701#n297

Thanks,
Jian-Hong Pan


More information about the U-Boot mailing list