Re: [PATCH RESEND v2 5/8] mmc: sdhci-of-k1: Configure PHY mode
From: Adrian Hunter
Date: Thu Dec 03 2026 - 11:19:04 EST
On 01/12/2026 12:54, Yixun Lan wrote:
> From: Long Wan <long.wan@xxxxxxxxxxxxxxxxxx>
>
> Apply PHY configuration only for eMMC hosts which enable PHY function mode,
> and configure drive strength and bias. While for SD/SDIO hosts mode, bypass
> the PHY mode and select TX internal clock instead.
Could use an explanation of what happens without this fix.
>
> Fixes: f87b273e4b6d ("mmc: sdhci-of-k1: enable essential clock infrastructure for SD operation")
> Signed-off-by: Long Wan <long.wan@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Yixun Lan <dlan@xxxxxxxxxx>
Otherwise:
Acked-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
> ---
> drivers/mmc/host/sdhci-of-k1.c | 24 ++++++++++++++----------
> 1 file changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-k1.c b/drivers/mmc/host/sdhci-of-k1.c
> index 5fb4692b58cd..01bc0f4bd6de 100644
> --- a/drivers/mmc/host/sdhci-of-k1.c
> +++ b/drivers/mmc/host/sdhci-of-k1.c
> @@ -169,21 +169,25 @@ static void spacemit_sdhci_reset(struct sdhci_host *host, u8 mask)
> if (mask != SDHCI_RESET_ALL)
> return;
>
> - spacemit_sdhci_setbits(host, SDHC_PHY_FUNC_EN | SDHC_PHY_PLL_LOCK,
> - SPACEMIT_SDHC_PHY_CTRL_REG);
> + if (host->mmc->caps2 & MMC_CAP2_NO_MMC) {
> + /* SD/SDIO: bypass PHY, use TX internal clock */
> + spacemit_sdhci_setbits(host, SDHC_TX_INT_CLK_SEL, SPACEMIT_SDHC_TX_CFG_REG);
> +
> + spacemit_sdhci_setbits(host, SDHC_OVRRD_CLK_OEN | SDHC_FORCE_CLK_ON,
> + SPACEMIT_SDHC_OP_EXT_REG);
> + } else {
> + /* eMMC: use PHY function mode */
> + spacemit_sdhci_setbits(host, SDHC_PHY_FUNC_EN | SDHC_PHY_PLL_LOCK,
> + SPACEMIT_SDHC_PHY_CTRL_REG);
>
> - spacemit_sdhci_clrsetbits(host, SDHC_PHY_DRIVE_SEL,
> - SDHC_RX_BIAS_CTRL | FIELD_PREP(SDHC_PHY_DRIVE_SEL, 4),
> - SPACEMIT_SDHC_PHY_PADCFG_REG);
> + spacemit_sdhci_clrsetbits(host, SDHC_PHY_DRIVE_SEL,
> + SDHC_RX_BIAS_CTRL | FIELD_PREP(SDHC_PHY_DRIVE_SEL, 4),
> + SPACEMIT_SDHC_PHY_PADCFG_REG);
>
> - if (!(host->mmc->caps2 & MMC_CAP2_NO_MMC))
> spacemit_sdhci_setbits(host, SDHC_MMC_CARD_MODE, SPACEMIT_SDHC_MMC_CTRL_REG);
> + }
>
> spacemit_sdhci_setbits(host, SDHC_GEN_PAD_CLK_ON, SPACEMIT_SDHC_LEGACY_CTRL_REG);
> -
> - if (host->mmc->caps2 & MMC_CAP2_NO_MMC)
> - spacemit_sdhci_setbits(host, SDHC_OVRRD_CLK_OEN | SDHC_FORCE_CLK_ON,
> - SPACEMIT_SDHC_OP_EXT_REG);
> }
>
> static void spacemit_sdhci_set_uhs_signaling(struct sdhci_host *host, unsigned int timing)
>