From: Adrian Hunter <adrian.hunter@intel.com>
To: Shawn Lin <shawn.lin@rock-chips.com>,
Ulf Hansson <ulf.hansson@linaro.org>
Cc: <linux-mmc@vger.kernel.org>, <linux-rockchip@lists.infradead.org>,
<Stable@vger.kernel.org>
Subject: Re: [PATCH v2] mmc: sdhci-of-dwcmshc: Disable clock before DLL configuration
Date: Wed, 8 Apr 2026 09:39:33 +0300 [thread overview]
Message-ID: <696a1d25-bb79-4ddc-942e-196ff2e5a93c@intel.com> (raw)
In-Reply-To: <1775629564-11267-1-git-send-email-shawn.lin@rock-chips.com>
On 08/04/2026 09:26, Shawn Lin wrote:
> According to the ASIC design recommendations, the clock must be
> disabled before operating the DLL to prevent glitches that could
> affect the internal digital logic. In extreme cases, failing to
> do so may cause the controller to malfunction completely.
>
> Adds a step to disable the clock before DLL configuration and
> re-enables it at the end.
>
> Fixes: 08f3dff799d4 ("mmc: sdhci-of-dwcmshc: add rockchip platform support")
> Cc: <Stable@vger.kernel.org>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Missing colon below, otherwise:
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
>
> Changes in v2:
> - Add a comment about why passing zero to sdhci_enable_clk()
>
> drivers/mmc/host/sdhci-of-dwcmshc.c | 19 ++++++++++++++++---
> 1 file changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
> index 6139516..5af35c9 100644
> --- a/drivers/mmc/host/sdhci-of-dwcmshc.c
> +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
> @@ -783,12 +783,15 @@ static void dwcmshc_rk3568_set_clock(struct sdhci_host *host, unsigned int clock
> extra |= BIT(4);
> sdhci_writel(host, extra, reg);
>
> + /* Disable clock while config DLL */
> + sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
> +
> if (clock <= 52000000) {
> if (host->mmc->ios.timing == MMC_TIMING_MMC_HS200 ||
> host->mmc->ios.timing == MMC_TIMING_MMC_HS400) {
> dev_err(mmc_dev(host->mmc),
> "Can't reduce the clock below 52MHz in HS200/HS400 mode");
> - return;
> + goto enable_clk;
> }
>
> /*
> @@ -808,7 +811,7 @@ static void dwcmshc_rk3568_set_clock(struct sdhci_host *host, unsigned int clock
> DLL_STRBIN_DELAY_NUM_SEL |
> DLL_STRBIN_DELAY_NUM_DEFAULT << DLL_STRBIN_DELAY_NUM_OFFSET;
> sdhci_writel(host, extra, DWCMSHC_EMMC_DLL_STRBIN);
> - return;
> + goto enable_clk;
> }
>
> /* Reset DLL */
> @@ -835,7 +838,7 @@ static void dwcmshc_rk3568_set_clock(struct sdhci_host *host, unsigned int clock
> 500 * USEC_PER_MSEC);
> if (err) {
> dev_err(mmc_dev(host->mmc), "DLL lock timeout!\n");
> - return;
> + goto enable_clk;
> }
>
> extra = 0x1 << 16 | /* tune clock stop en */
> @@ -868,6 +871,16 @@ static void dwcmshc_rk3568_set_clock(struct sdhci_host *host, unsigned int clock
> DLL_STRBIN_TAPNUM_DEFAULT |
> DLL_STRBIN_TAPNUM_FROM_SW;
> sdhci_writel(host, extra, DWCMSHC_EMMC_DLL_STRBIN);
> +
> +enable_clk
Missing colon
> + /*
> + * The sdclk frequency select bits in SDHCI_CLOCK_CONTROL are not functional
> + * on Rockchip's SDHCI implementation. Instead, the clock frequency is fully
> + * controlled via external clk provider by calling clk_set_rate(). Consequently,
> + * passing 0 to sdhci_enable_clk() only re-enables the already-configured clock,
> + * which matches the hardware's actual behavior.
> + */
> + sdhci_enable_clk(host, 0);
> }
>
> static void rk35xx_sdhci_reset(struct sdhci_host *host, u8 mask)
prev parent reply other threads:[~2026-04-08 6:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-08 6:26 [PATCH v2] mmc: sdhci-of-dwcmshc: Disable clock before DLL configuration Shawn Lin
2026-04-08 6:39 ` Adrian Hunter [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=696a1d25-bb79-4ddc-942e-196ff2e5a93c@intel.com \
--to=adrian.hunter@intel.com \
--cc=Stable@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=shawn.lin@rock-chips.com \
--cc=ulf.hansson@linaro.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