From: Stephan Gerhold <stephan.gerhold@linaro.org>
To: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
Cc: Sumit Garg <sumit.garg@kernel.org>, Peng Fan <peng.fan@nxp.com>,
Jaehoon Chung <jh80.chung@samsung.com>,
Tanmay Kathpalia <tanmay.kathpalia@altera.com>,
u-boot-qcom@groups.io, u-boot@lists.u-boot-project.org,
Casey Connolly <casey.connolly@linaro.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Tom Rini <trini@konsulko.com>, Sam Day <me@samcday.com>,
Jorge Ramirez-Ortiz <jorge.ramirez.ortiz@gmail.com>,
Dzmitry Sankouski <dsankouski@gmail.com>,
Varadarajan Narayanan <varadarajan.narayanan@oss.qualcomm.com>,
Aswin Murugan <aswin.murugan@oss.qualcomm.com>,
Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>
Subject: Re: [PATCH v2 0/2] mmc: msm_sdhci: drop the 1 ms delay after every command
Date: Mon, 23 Nov 2026 14:25:48 +0100 [thread overview]
Message-ID: <awQ-3DFUawyuoJjT@linaro.org> (raw)
In-Reply-To: <20261123-msm-sdhci-wait-send-cmd-v2-0-5de53eb34ff6@oss.qualcomm.com>
On Mon, Nov 23, 2026 at 09:57:00AM +0100, Igor Opaniuk wrote:
> msm_sdhci sets SDHCI_QUIRK_WAIT_SEND_CMD, a 1 ms sleep after most
> commands. It costs 2 ms per multi-block read and caps USB mass storage
> on an Arduino UNO Q at 46 MB/s instead of 201 MB/s.
>
> v1 only dropped the quirk. Stephan Gerhold found that this breaks SD
> card detection on DB410c, DB820c and RB3 Gen 2: the CMD55 after the
> first ACMD41 fails with a response CRC error.
>
> Root cause:
>
> The same failure exists on eMMC, where MMC_QUIRK_RETRY_SEND_CID hides
> it: the CMD2 after the last CMD1 fails on its first status read with
> INT_STATUS 0x00028000. Both cases are a CRC-checked command that
> follows an R3 response.
>
> After an R3 response the controller keeps a latent command CRC error:
>
> - it is not visible: INT_STATUS reads 0 before the next command;
> - it does not expire: the next command fails even 10 ms later;
> - it is removed by a status clear issued a few SD clock cycles after
> the R3 command has completed. The clear sdhci_send_command() does at
> completion is too early.
>
> The quirk worked because it delayed that clear by 1 ms.
>
> Testing results:
>
> Arduino UNO Q (QRB2210, qcom,sdhci-msm-v5, eMMC, ADMA). A status trace
> was added to sdhci_send_command(); the identification clock is
> 188 kHz, 5.3 us per cycle. Each line is the first CMD2 of "mmc rescan"
> with the quirk dropped:
>
> Without patch 1 CMD2 result
> as is fails 6/6
> 50 us .. 10 ms wait before the CMD2 fails 3/3 each
> final clear of the CMD1 delayed by 1 .. 8 us fails 6/6 each
> final clear of the CMD1 delayed by 12 .. 32 us passes 6/6 each
>
> With patch 1 (85 us at this clock)
> as is passes 30/30
> 1 ms wait before the CMD2 passes 10/10
> 10 ms wait before the CMD2 passes 10/10
>
> The 1 ms case has the gap of the SD ACMD41 loop. With patch 1 the CMD2
> is sent once per initialisation, without the retry.
>
> Both patches, no trace:
>
> eMMC mode HS400 (200 MHz)
> 1 GiB "mmc read" 302 MiB/s
> CRC32 of the first 128 MiB same in U-Boot and Linux
> Linux boot from the eMMC ok
>
> Not tested:
>
> - SD cards: the UNO Q has no slot, so it is not confirmed that patch 1
> fixes the reported failure. Stephan's alternative, retrying that
> CMD55 through MMC_QUIRK_RETRY_APP_CMD, works on his boards and can be
> added if needed.
> - v4 controllers.
> - Other SDHCI hosts: patch 1 is in the common sdhci.c.
>
> ---
> Changes in v2:
> - New patch 1: delay the status clear after a response without CRC
> (SD detection failure reported by Stephan).
> - Patch 2: commit message reworded ("after most commands", Tanmay) and
> shortened. The code is unchanged.
> - The Reviewed-by tags from Aswin and Tanmay are not carried over: the
> patch now depends on a new sdhci.c change that they have not seen.
> - Rebased on snapdragon/qcom-next.
> - Cc the maintainers of the boards that use the driver.
> - Link to v1: https://lore.kernel.org/r/20261030-msm-sdhci-wait-send-cmd-v1-1-6ef678db1585@oss.qualcomm.com
>
> ---
> Igor Opaniuk (2):
> mmc: sdhci: delay the status clear after a response without CRC
> mmc: msm_sdhci: drop SDHCI_QUIRK_WAIT_SEND_CMD
>
> drivers/mmc/msm_sdhci.c | 2 +-
> drivers/mmc/sdhci.c | 13 +++++++++++++
> 2 files changed, 14 insertions(+), 1 deletion(-)
> ---
> base-commit: 36d2b7b46c77b44021f0a6f36684a123e5560492
> change-id: 20261030-msm-sdhci-wait-send-cmd-4383f2792022
>
Not 100% sure if this is the best way to fix it, but it works fine in my
tests and is certainly better than the unconditional 1ms delay we had
before so FWIW:
Tested-by: Stephan Gerhold <stephan.gerhold@linaro.org> # DB410c eMMC/SD
Thanks,
Stephan
prev parent reply other threads:[~2026-11-23 13:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 8:57 [PATCH v2 0/2] mmc: msm_sdhci: drop the 1 ms delay after every command Igor Opaniuk
2026-11-23 8:57 ` [PATCH v2 1/2] mmc: sdhci: delay the status clear after a response without CRC Igor Opaniuk
2026-11-23 13:27 ` Stephan Gerhold
2026-11-23 8:57 ` [PATCH v2 2/2] mmc: msm_sdhci: drop SDHCI_QUIRK_WAIT_SEND_CMD Igor Opaniuk
2026-11-23 13:25 ` Stephan Gerhold [this message]
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=awQ-3DFUawyuoJjT@linaro.org \
--to=stephan.gerhold@linaro.org \
--cc=aswin.murugan@oss.qualcomm.com \
--cc=balaji.selvanathan@oss.qualcomm.com \
--cc=casey.connolly@linaro.org \
--cc=dsankouski@gmail.com \
--cc=igor.opaniuk@oss.qualcomm.com \
--cc=jh80.chung@samsung.com \
--cc=jorge.ramirez.ortiz@gmail.com \
--cc=me@samcday.com \
--cc=neil.armstrong@linaro.org \
--cc=peng.fan@nxp.com \
--cc=sumit.garg@kernel.org \
--cc=tanmay.kathpalia@altera.com \
--cc=trini@konsulko.com \
--cc=u-boot-qcom@groups.io \
--cc=u-boot@lists.u-boot-project.org \
--cc=varadarajan.narayanan@oss.qualcomm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox