From: Andrew Gaylard <ag@ffroot.co.za>
To: linux-mmc@vger.kernel.org
Cc: ulfh@kernel.org, tonyhuang.sunplus@gmail.com,
lhjeff911@gmail.com, Andrew Gaylard <ag@ffroot.co.za>
Subject: [PATCH] mmc: sunplus: initialise rd_crc_dly=1 for DDR modes
Date: Thu, 17 Sep 2026 12:49:59 +0200 [thread overview]
Message-ID: <20260917104959.662433-1-ag@ffroot.co.za> (raw)
After spmmc_controller_init() resets the controller, all timing
fields are zero. The hs_en path initialises the write timing
delays (wr_cmd_dly, wr_dat_dly) but leaves the read side at zero.
In DDR52 mode, rd_crc_dly=0 causes the first write to fail with
CRC_TOKEN_CHECK_ERROR, triggering the auto-tuning retry loop and
causing a multi-second delay on the first cold-boot write.
Set rd_crc_dly=1 when enabling DDR mode to avoid this.
Tested on a LTPP3G2, booting via eMMC in DDR52 mode,
on linux-next-20260915.
Signed-off-by: Andrew Gaylard <ag@ffroot.co.za>
---
drivers/mmc/host/sunplus-mmc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/mmc/host/sunplus-mmc.c b/drivers/mmc/host/sunplus-mmc.c
index 63279760239c..e947c84eef94 100644
--- a/drivers/mmc/host/sunplus-mmc.c
+++ b/drivers/mmc/host/sunplus-mmc.c
@@ -294,6 +294,11 @@ static void spmmc_set_bus_timing(struct spmmc_host *host, unsigned int timing)
value = readl(host->base + SPMMC_SD_CONFIG0_REG);
value |= SPMMC_SD_DDR_MODE;
writel(value, host->base + SPMMC_SD_CONFIG0_REG);
+ /* DDR mode needs rd_crc_dly=1 */
+ value = readl(host->base + SPMMC_SD_TIMING_CONFIG0_REG);
+ value &= ~SPMMC_SD_READ_CRC_DELAY;
+ value |= FIELD_PREP(SPMMC_SD_READ_CRC_DELAY, 1);
+ writel(value, host->base + SPMMC_SD_TIMING_CONFIG0_REG);
} else {
value = readl(host->base + SPMMC_SD_CONFIG0_REG);
value &= ~SPMMC_SD_DDR_MODE;
--
2.53.0
next reply other threads:[~2026-09-17 10:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 10:49 Andrew Gaylard [this message]
2026-09-29 13:34 ` [PATCH] mmc: sunplus: initialise rd_crc_dly=1 for DDR modes Ulf Hansson
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=20260917104959.662433-1-ag@ffroot.co.za \
--to=ag@ffroot.co.za \
--cc=lhjeff911@gmail.com \
--cc=linux-mmc@vger.kernel.org \
--cc=tonyhuang.sunplus@gmail.com \
--cc=ulfh@kernel.org \
/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