All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jian-Hong Pan <jhp@endlessos.org>
To: Matthias Brugger <mbrugger@suse.com>,
	nsaenz@kernel.org, Stefan Wahren <stefan.wahren@i2se.com>
Cc: bcm-kernel-feedback-list@broadcom.com, u-boot@lists.denx.de,
	linux-rpi-kernel@lists.infradead.org, linux-mmc@vger.kernel.org,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	linux@endlessos.org, devicetree <devicetree@vger.kernel.org>
Subject: Re: [BUG] U-Boot makes Linux kernel boot failed with "mmc1: invalid bus width" on RPi 400
Date: Mon, 19 Jul 2021 11:57:49 +0800	[thread overview]
Message-ID: <CAPpJ_eepsLfehv5xkk1Eu+LVrOZpU7-EBobuds3hsqSFzd6RGw@mail.gmail.com> (raw)
In-Reply-To: <CAPpJ_ecx4byFQ+SJL3ZgFyf1q2HvGfLHhdf1khM9Znib_8iwEw@mail.gmail.com>

Jian-Hong Pan <jhp@endlessos.org> 於 2021年7月7日 週三 下午12:23寫道:
>
> 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

I notice that mainline kernel 5.14-rc* includes the Raspberry Pi 400
device tree commits.  So, I build latest kernel 5.14-rc2.  The kernel
still boot failed at "mmc1: invalid bus width" on RPi 400.

To make it easy to track, I filed this bug on kernel's bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=213753

BR.
Jian-Hong Pan

  reply	other threads:[~2021-07-19  3:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07  4:23 [BUG] U-Boot makes Linux kernel boot failed with "mmc1: invalid bus width" on RPi 400 Jian-Hong Pan
2021-07-07  4:23 ` Jian-Hong Pan
2021-07-19  3:57 ` Jian-Hong Pan [this message]
2021-07-19  3:57   ` Jian-Hong Pan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPpJ_eepsLfehv5xkk1Eu+LVrOZpU7-EBobuds3hsqSFzd6RGw@mail.gmail.com \
    --to=jhp@endlessos.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux@endlessos.org \
    --cc=mbrugger@suse.com \
    --cc=nsaenz@kernel.org \
    --cc=stefan.wahren@i2se.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.