mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Cc: Lucas Sinn <lucas.sinn@wolfvision.net>
Subject: [PATCH] drivers: mci: rockchip: fix HS400 DLL strobe and clock gate config
Date: Thu, 28 May 2026 14:29:02 +0200	[thread overview]
Message-ID: <20260528122902.3523883-1-s.hauer@pengutronix.de> (raw)

From: Lucas Sinn <lucas.sinn@wolfvision.net>

Align two register writes with the Linux kernel (sdhci-of-dwcmshc.c):

- DLL_STRBIN_TAPNUM_DEFAULT: 0x8 -> 0x4
  The strobe tap number was twice the value used by Linux, placing the
  DS sampling point at the wrong phase at 200 MHz and causing DMA
  timeouts in HS400/HS400-ES mode.

- DWCMSHC_HOST_CTRL3: also disable the internal clock gate (BIT(4))
  Linux clears both the cmd-conflict-check bit (BIT(0)) and the
  internal-clock-gate bit (BIT(4)). Without disabling the clock gate
  the DLL could stall during high-speed operation.

Assisted-by: Claude Sonnet 4.6
Signed-off-by: Lucas Sinn <lucas.sinn@wolfvision.net>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mci/rockchip-dwcmshc-sdhci.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mci/rockchip-dwcmshc-sdhci.c b/drivers/mci/rockchip-dwcmshc-sdhci.c
index 0be5d9ff63..8e828a1f1b 100644
--- a/drivers/mci/rockchip-dwcmshc-sdhci.c
+++ b/drivers/mci/rockchip-dwcmshc-sdhci.c
@@ -40,7 +40,7 @@
 #define DLL_TXCLK_TAPNUM_DEFAULT	0x10
 #define DLL_TXCLK_TAPNUM_90_DEGREES	0xA
 #define DLL_TXCLK_TAPNUM_FROM_SW	BIT(24)
-#define DLL_STRBIN_TAPNUM_DEFAULT	0x8
+#define DLL_STRBIN_TAPNUM_DEFAULT	0x4
 #define DLL_STRBIN_TAPNUM_FROM_SW	BIT(24)
 #define DLL_STRBIN_DELAY_NUM_SEL	BIT(26)
 #define DLL_STRBIN_DELAY_NUM_OFFSET	16
@@ -177,9 +177,10 @@ static void rk_sdhci_set_clock(struct rk_sdhci_host *host, unsigned int clock)
 
 	sdhci_set_clock(&host->sdhci, clock, clk_get_rate(host->clks[CLK_CORE].clk));
 
-	/* Disable cmd conflict check */
+	/* Disable cmd conflict check and internal clock gate */
 	extra = sdhci_read32(&host->sdhci, DWCMSHC_HOST_CTRL3);
 	extra &= ~BIT(0);
+	extra |= BIT(4);
 	sdhci_write32(&host->sdhci, DWCMSHC_HOST_CTRL3, extra);
 
 	/* Disable clock while config DLL */
-- 
2.47.3




             reply	other threads:[~2026-05-28 12:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-28 12:29 Sascha Hauer [this message]
2026-05-29 11:43 ` 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=20260528122902.3523883-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=lucas.sinn@wolfvision.net \
    /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