Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3374049pxv; Sun, 18 Jul 2021 21:00:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvCBXQfcQ4NOp+e3/j02YzhkB0qogc2dmCBlG7hVUiERypAzIZ7JJYf+fztHPjpBybFVh5 X-Received: by 2002:a5d:8602:: with SMTP id f2mr17223704iol.61.1626667244071; Sun, 18 Jul 2021 21:00:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626667244; cv=none; d=google.com; s=arc-20160816; b=Vb57Lcxlxhdvv1MUtXN/D/EwVUs3Vp8ReOVV8rbdl4aSmIWZuNfcupSYxdo8e4zklB vhPrS2X2igBEp8kPAPFkqncGPJPtemN7wGjbc5T4OT0x8wG34MxqrFajyUNXafx4Fo2T cPtXwrQoEDxzCqnOFDzrAJAeFQoHzlrRgvJiITEMR9zzS+4K1Wb/SgYlA7kVTgmOcsVN cRzXdYhbRGQJwlg6wPWmCaUnh5RBP/piDgZ+z5Z6+jENGJBoSH4fXoBCVyPnRW2WPFkc B3gXasUYcI+zTb3I3SHaV0uUc+pT2U+VauW4rxmAWGT4oThHuBSOz0FSBpYHkE80CSbQ zRIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=+LbuH1gv0Z8p8POEk6Rwg6KtJYOHpK1pv64iTmdjHlE=; b=os9J1EKoQ+uUgeMp2wQgblzNZUrVee/LN6HZxkg5RZ92k/BYiZeXgSN3/hYchkCiBp EmW4IEs7rr+Lgwh0Vkk3b9WDkPQwy0VBTAFAgDGg45XhyNgY58evErNvAmd9RCjNwRbO zQ4BJhfr/dAQziPCCkFtqfndUTz+IFZ4mdzQYO0x29SuIYvbTVhPMeY59nF5rIH6QQCG BaIK6wRDUsSESexvaFXt0wlEFLbhbFP9P8CO5i7VOolAs4S2Mw+XLfbuTcnsqFOHQcev bLVlY7Z16MZjncfgYui2grz4rruqJFN8WjBztvqaTL28Nsi2rsysr/1AZ7Zg8XmjmAve KZqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@endlessos.org header.s=google header.b=bry3jTPP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=endlessos.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j5si17479141iom.105.2021.07.18.21.00.31; Sun, 18 Jul 2021 21:00:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@endlessos.org header.s=google header.b=bry3jTPP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=endlessos.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229512AbhGSEBn (ORCPT + 99 others); Mon, 19 Jul 2021 00:01:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229664AbhGSEBk (ORCPT ); Mon, 19 Jul 2021 00:01:40 -0400 Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 766D0C061765 for ; Sun, 18 Jul 2021 20:58:41 -0700 (PDT) Received: by mail-ot1-x32a.google.com with SMTP id i12-20020a05683033ecb02903346fa0f74dso16856083otu.10 for ; Sun, 18 Jul 2021 20:58:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endlessos.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=+LbuH1gv0Z8p8POEk6Rwg6KtJYOHpK1pv64iTmdjHlE=; b=bry3jTPPmqQhz2Q74H5M5/vitP9J/jj90PFDihnrkuWNpbrWX7/sKASXNKdiv884pk 8UbSz64yrusucvdZ/ja1JJmJrG/sbEKzxbxOhlx0b/kl2NcHjzB5xW2W8VBvfUjgMPPc l+NUHtdDsbT5ydV3Tf4ap5AvXpBFXV75L7gmFGaKekuA87/LRJceX9PJFSp9RdgRUyP5 7BV1UZXvnyezH8d684/9a6r+Ol1GAyTxAfrkk2LWJAHHBrswjPbSjw6CnP6+b/B1FLDg 44pw93hfUDqQsJcQ71vsdszUfKIZtX+AwOTxfiSh+905Sp9+qwi7K8fYRScJbLbwpzQJ 8ovA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=+LbuH1gv0Z8p8POEk6Rwg6KtJYOHpK1pv64iTmdjHlE=; b=JoPvo55bR2GCfzgROKTO0QywGrBct922bF5mm9ccfqiMCZ9OidasbwoMKtv94xB7HP H66kaZyFzqs0Ii4ERWukFErpaRjluell2Rck299U9vES9UzFRqqe/m7G8JvBsbEI16E/ N9XoqnpzLm7sKNRXz8uAm6h9z2CTE700937xLeFzNvst0GhN6qYArWBCnzhnPoQVl3RB m8mTjImf6y+z2zzGsoxXLLUC5QqHrR6GH13gcjw0HSpBR//WfXu45VyfdICdQ4PNxJE/ A5LlH3B4MG8yQYRl/b5AZOCsyPQ1jzTfdmhdYJQwnpwhFrlgLv0Gwab2NNSA31txuznl OfMA== X-Gm-Message-State: AOAM533xo1ko0mlZ/MN0y6Nf6qCP8OYi++gWn6l+6PBki8fGH8n1zvSD HS3cEubjtGJwvwPCMNtP6j/JW/4zo3c+GpI4SqUp7A== X-Received: by 2002:a9d:61d9:: with SMTP id h25mr13512153otk.81.1626667120443; Sun, 18 Jul 2021 20:58:40 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jian-Hong Pan Date: Mon, 19 Jul 2021 11:57:49 +0800 Message-ID: Subject: Re: [BUG] U-Boot makes Linux kernel boot failed with "mmc1: invalid bus width" on RPi 400 To: Matthias Brugger , nsaenz@kernel.org, Stefan Wahren 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@endlessos.org, devicetree Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jian-Hong Pan =E6=96=BC 2021=E5=B9=B47=E6=9C=887=E6=97= =A5 =E9=80=B1=E4=B8=89 =E4=B8=8B=E5=8D=8812:23=E5=AF=AB=E9=81=93=EF=BC=9A > > 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: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D SDHCI RE= GISTER DUMP =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > [ 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: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > [ 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-u= boot-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/dec6e6ee627f19c2d291f3ff973b06= fa#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/t= ree/drivers/mmc/core/sd.c?h=3Dnext-20210701#n239 > [3] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/t= ree/drivers/mmc/core/sd_ops.c?h=3Dnext-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=3D213753 BR. Jian-Hong Pan