All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mmc: msm_sdhci: drop the 1 ms delay after every command
@ 2026-11-23  8:57 Igor Opaniuk
  2026-11-23  8:57 ` [PATCH v2 1/2] mmc: sdhci: delay the status clear after a response without CRC Igor Opaniuk
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Igor Opaniuk @ 2026-11-23  8:57 UTC (permalink / raw)
  To: Sumit Garg, Peng Fan, Jaehoon Chung, Tanmay Kathpalia,
	u-boot-qcom, u-boot
  Cc: Casey Connolly, Neil Armstrong, Tom Rini, Stephan Gerhold,
	Sam Day, Jorge Ramirez-Ortiz, Dzmitry Sankouski,
	Varadarajan Narayanan, Aswin Murugan, Balaji Selvanathan,
	Igor Opaniuk

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

Best regards,
-- 
Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-23 13:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH v2 0/2] mmc: msm_sdhci: drop the 1 ms delay after every command Stephan Gerhold

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.