From: Adrian Hunter <adrian.hunter@intel.com>
To: <ziniu.wang_1@nxp.com>, <haibo.chen@nxp.com>,
<ulf.hansson@linaro.org>, <linux-mmc@vger.kernel.org>
Cc: <shawnguo@kernel.org>, <s.hauer@pengutronix.de>,
<kernel@pengutronix.de>, <festevam@gmail.com>,
<imx@lists.linux.dev>, <s32@nxp.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] mmc: sdhci-esdhc-imx: optimize clock loopback selection with dummy pad support
Date: Wed, 28 May 2025 13:34:54 +0300 [thread overview]
Message-ID: <405271f5-3ae9-4f64-a433-043fb3194834@intel.com> (raw)
In-Reply-To: <20250521025502.112030-2-ziniu.wang_1@nxp.com>
On 21/05/2025 05:55, ziniu.wang_1@nxp.com wrote:
> From: Luke Wang <ziniu.wang_1@nxp.com>
>
> For legacy platforms without dummy pad:
> When clock <= 100MHz: Set ESDHC_MIX_CTRL_FBCLK_SEL to 0 (external clock
> pad loopback) for better bus clock proximity.
> When clock > 100MHz: Set ESDHC_MIX_CTRL_FBCLK_SEL to 1 (internal clock
> loopback) to avoid signal reflection noise at high frequency.
>
> For i.MX94/95 with dummy pad support:
> Keep ESDHC_MIX_CTRL_FBCLK_SEL at 0 for all speed mode. Hardware
> automatically substitutes clock pad loopback with dummy pad loopback
> when available, eliminating signal reflections while preserving better
> bus clock proximity.
>
> Signed-off-by: Luke Wang <ziniu.wang_1@nxp.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> drivers/mmc/host/sdhci-esdhc-imx.c | 25 +++++++++++++++++++++----
> 1 file changed, 21 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index c448a53530a5..5f1c45b2bd5d 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -212,6 +212,9 @@
> /* The IP does not have GPIO CD wake capabilities */
> #define ESDHC_FLAG_SKIP_CD_WAKE BIT(18)
>
> +/* the controller has dummy pad for clock loopback */
> +#define ESDHC_FLAG_DUMMY_PAD BIT(19)
> +
> #define ESDHC_AUTO_TUNING_WINDOW 3
>
> enum wp_types {
> @@ -348,6 +351,15 @@ static struct esdhc_soc_data usdhc_imx8mm_data = {
> .quirks = SDHCI_QUIRK_NO_LED,
> };
>
> +static struct esdhc_soc_data usdhc_imx95_data = {
> + .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_MAN_TUNING
> + | ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200
> + | ESDHC_FLAG_HS400 | ESDHC_FLAG_HS400_ES
> + | ESDHC_FLAG_STATE_LOST_IN_LPMODE
> + | ESDHC_FLAG_DUMMY_PAD,
> + .quirks = SDHCI_QUIRK_NO_LED,
> +};
> +
> struct pltfm_imx_data {
> u32 scratchpad;
> struct pinctrl *pinctrl;
> @@ -392,6 +404,8 @@ static const struct of_device_id imx_esdhc_dt_ids[] = {
> { .compatible = "fsl,imx7ulp-usdhc", .data = &usdhc_imx7ulp_data, },
> { .compatible = "fsl,imx8qxp-usdhc", .data = &usdhc_imx8qxp_data, },
> { .compatible = "fsl,imx8mm-usdhc", .data = &usdhc_imx8mm_data, },
> + { .compatible = "fsl,imx94-usdhc", .data = &usdhc_imx95_data, },
> + { .compatible = "fsl,imx95-usdhc", .data = &usdhc_imx95_data, },
> { .compatible = "fsl,imxrt1050-usdhc", .data = &usdhc_imxrt1050_data, },
> { .compatible = "nxp,s32g2-usdhc", .data = &usdhc_s32g2_data, },
> { /* sentinel */ }
> @@ -1424,9 +1438,10 @@ static void esdhc_set_uhs_signaling(struct sdhci_host *host, unsigned timing)
> break;
> }
>
> - if (timing == MMC_TIMING_UHS_SDR104 ||
> - timing == MMC_TIMING_MMC_HS200 ||
> - timing == MMC_TIMING_MMC_HS400)
> + if (!(imx_data->socdata->flags & ESDHC_FLAG_DUMMY_PAD) &&
> + (timing == MMC_TIMING_UHS_SDR104 ||
> + timing == MMC_TIMING_MMC_HS200 ||
> + timing == MMC_TIMING_MMC_HS400))
> m |= ESDHC_MIX_CTRL_FBCLK_SEL;
> else
> m &= ~ESDHC_MIX_CTRL_FBCLK_SEL;
> @@ -1678,7 +1693,9 @@ static void sdhc_esdhc_tuning_restore(struct sdhci_host *host)
> writel(reg, host->ioaddr + ESDHC_TUNING_CTRL);
>
> reg = readl(host->ioaddr + ESDHC_MIX_CTRL);
> - reg |= ESDHC_MIX_CTRL_SMPCLK_SEL | ESDHC_MIX_CTRL_FBCLK_SEL;
> + reg |= ESDHC_MIX_CTRL_SMPCLK_SEL;
> + if (!(imx_data->socdata->flags & ESDHC_FLAG_DUMMY_PAD))
> + reg |= ESDHC_MIX_CTRL_FBCLK_SEL;
> writel(reg, host->ioaddr + ESDHC_MIX_CTRL);
>
> writel(FIELD_PREP(ESDHC_TUNE_CTRL_STATUS_DLY_CELL_SET_PRE_MASK,
next prev parent reply other threads:[~2025-05-28 10:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-21 2:55 [PATCH 1/2] mmc: sdhci-esdhc-imx: refactor clock loopback selection logic ziniu.wang_1
2025-05-21 2:55 ` [PATCH 2/2] mmc: sdhci-esdhc-imx: optimize clock loopback selection with dummy pad support ziniu.wang_1
2025-05-21 16:20 ` Frank Li
2025-05-28 10:34 ` Adrian Hunter [this message]
2025-06-09 14:24 ` Ulf Hansson
2025-05-21 16:09 ` [PATCH 1/2] mmc: sdhci-esdhc-imx: refactor clock loopback selection logic Frank Li
2025-05-22 3:52 ` Bough Chen
2025-05-22 3:59 ` Bough Chen
2025-05-28 10:34 ` Adrian Hunter
2025-06-09 14:24 ` 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=405271f5-3ae9-4f64-a433-043fb3194834@intel.com \
--to=adrian.hunter@intel.com \
--cc=festevam@gmail.com \
--cc=haibo.chen@nxp.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=s32@nxp.com \
--cc=shawnguo@kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=ziniu.wang_1@nxp.com \
/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