From: Sascha Hauer <s.hauer@pengutronix.de>
To: BAREBOX <barebox@lists.infradead.org>
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH v2 09/10] mci: sdhci: rockchip: support HS400
Date: Mon, 18 May 2026 15:13:44 +0200 [thread overview]
Message-ID: <20260518-rockchip-emmc-hs400-v2-9-789ce495f70b@pengutronix.de> (raw)
In-Reply-To: <20260518-rockchip-emmc-hs400-v2-0-789ce495f70b@pengutronix.de>
After sdhci_set_clock() runs sdhci_set_uhs_signaling() (which writes
the standard SDHCI_CTRL_HS400 = 0x5 to HOST_CONTROL2's UHS field) and
the SDCLK is gated for the high-speed DLL config, fix up two things
that the dwcmshc controller needs in HS400:
- HOST_CONTROL2's UHS field needs DWCMSHC_CTRL_HS400 (0x7) instead of
the standard SDHCI_CTRL_HS400 (0x5).
- EMMC_CONTROL.CARD_IS_EMMC (BIT 0 at offset 0x52c) must be set to
enable the data-strobe sampling path that HS400 uses.
The high-speed DLL branch (>52 MHz) already programs DLL_TXCLK,
DLL_STRBIN and locks the DLL the same way HS200 does, which is what
HS400 needs as well. Together with the core HS200 -> HS -> HS400
transition, this lets HS400 run on rk3568 / rk3588.
Tested on a K3588 Radxa Rock5T board.
Assisted-by: Claude Opus 4.7
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/mci/rockchip-dwcmshc-sdhci.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/mci/rockchip-dwcmshc-sdhci.c b/drivers/mci/rockchip-dwcmshc-sdhci.c
index 4b2ee03e9a..2b55456f05 100644
--- a/drivers/mci/rockchip-dwcmshc-sdhci.c
+++ b/drivers/mci/rockchip-dwcmshc-sdhci.c
@@ -18,6 +18,7 @@
#define DWCMSHC_VER_TYPE 0x504
#define DWCMSHC_HOST_CTRL3 0x508
#define DWCMSHC_EMMC_CONTROL 0x52c
+#define DWCMSHC_CARD_IS_EMMC BIT(0)
#define DWCMSHC_EMMC_ATCTRL 0x540
/* Rockchip specific Registers */
@@ -183,6 +184,25 @@ static void rk_sdhci_set_clock(struct rk_sdhci_host *host, unsigned int clock)
/* Disable clock while config DLL */
sdhci_write16(&host->sdhci, SDHCI_CLOCK_CONTROL, 0);
+ /*
+ * HS400 needs the dwcmshc-specific value (0x7) in HOST_CONTROL2's UHS
+ * field rather than the standard SDHCI_CTRL_HS400 (0x5) the generic
+ * sdhci_set_uhs_signaling() wrote. It also requires CARD_IS_EMMC in
+ * EMMC_CONTROL to enable the data strobe sampling path.
+ */
+ if (host->mci.ios.timing == MMC_TIMING_MMC_HS400) {
+ u16 ctrl_2;
+
+ ctrl_2 = sdhci_read16(&host->sdhci, SDHCI_HOST_CONTROL2);
+ ctrl_2 &= ~SDHCI_CTRL_UHS_MASK;
+ ctrl_2 |= DWCMSHC_CTRL_HS400;
+ sdhci_write16(&host->sdhci, SDHCI_HOST_CONTROL2, ctrl_2);
+
+ extra = sdhci_read16(&host->sdhci, DWCMSHC_EMMC_CONTROL);
+ extra |= DWCMSHC_CARD_IS_EMMC;
+ sdhci_write16(&host->sdhci, DWCMSHC_EMMC_CONTROL, extra);
+ }
+
if (clock <= 52000000) {
/*
* Disable DLL and reset both of sample and drive clock.
--
2.47.3
next prev parent reply other threads:[~2026-05-18 13:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 13:13 [PATCH v2 00/10] mci: rockchip-dwcmshc: add HS400(ES) support Sascha Hauer
2026-05-18 13:13 ` [PATCH v2 01/10] mci: sdhci: define VDD_180 and shrink UHS_MASK to bits 0..2 Sascha Hauer
2026-05-18 13:13 ` [PATCH v2 02/10] mci: mmc_send_tuning: actually point data.dest at the buffer Sascha Hauer
2026-05-18 13:13 ` [PATCH v2 03/10] mci: sdhci: add ADMA2 descriptor helpers Sascha Hauer
2026-05-18 13:13 ` [PATCH v2 04/10] mci: add HS400 mode selection Sascha Hauer
2026-05-18 13:13 ` [PATCH v2 05/10] mci: add HS400 Enhanced Strobe (HS400ES) selection Sascha Hauer
2026-05-18 13:13 ` [PATCH v2 06/10] mci: rockchip-dwcmshc-sdhci: use ADMA2 Sascha Hauer
2026-05-18 13:18 ` Ahmad Fatoum
2026-05-18 13:13 ` [PATCH v2 07/10] mci: sdhci: rockchip: set TX-path source-select bit in DWCMSHC_EMMC_DLL_TXCLK Sascha Hauer
2026-05-18 13:13 ` [PATCH v2 08/10] mci: sdhci: rockchip: distinguish IP revision 0 (rk3568) from 1 (rk3576/rk3588) Sascha Hauer
2026-05-18 13:13 ` Sascha Hauer [this message]
2026-05-18 13:13 ` [PATCH v2 10/10] mci: sdhci: rockchip: support HS400 Enhanced Strobe Sascha Hauer
2026-05-19 6:16 ` [PATCH v2 00/10] mci: rockchip-dwcmshc: add HS400(ES) support Sascha Hauer
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=20260518-rockchip-emmc-hs400-v2-9-789ce495f70b@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.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