Re: [PATCH] Add HS400 enhanced strobe support
From: Masahiro Yamada
Date: Thu Feb 23 2017 - 07:50:57 EST
Hi.
2017-02-15 22:50 GMT+09:00 Piotr Sroka <piotrs@xxxxxxxxxxx>:
> Add support for HS400ES mode to Cadence SDHCI driver.
>
> Signed-off-by: Piotr Sroka <piotrs@xxxxxxxxxxx>
Next time, please add "mmc: sdhci-cadence" to the patch subject.
This will clarify which driver is being touched.
> +static void sdhci_cdns_hs400_enhanced_strobe(struct mmc_host *mmc,
> + struct mmc_ios *ios)
> +{
> + struct sdhci_host *host = mmc_priv(mmc);
> + struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host);
> +
> + priv->enhanced_strobe = ios->enhanced_strobe;
> + if (ios->enhanced_strobe)
> + sdhci_cdns_set_emmc_mode(priv,
> + SDHCI_CDNS_HRS06_MODE_MMC_HS400ES);
> +}
This function, if ios->enhanced_strobe is true, enables it immediately,
but nothing happens if ios->enhanced_strobe is false.
(it will be disabled at the next call of sdhci_cdns_set_uhs_signaling().)
If you look at drivers/mmc/core/core.c,
mmc_set_ios() is called immediately after
host->ops->hs400_enhanced_strobe(host, &host->ios),
but I am not quite sure if we should rely on that fact.
I am just putting my untested code below.
static void sdhci_cdns_hs400_enhanced_strobe(struct mmc_host *mmc,
struct mmc_ios *ios)
{
struct sdhci_host *host = mmc_priv(mmc);
struct sdhci_cdns_priv *priv = sdhci_cdns_priv(host);
u32 mode;
mode = readl(priv->hrs_addr + SDHCI_CDNS_HRS06) &
SDHCI_CDNS_HRS06_MODE_MASK;
switch (mode) {
case SDHCI_CDNS_HRS06_MODE_MMC_HS400:
if (ios->enhanced_strobe)
mode = SDHCI_CDNS_HRS06_MODE_MMC_HS400ES;
break;
case SDHCI_CDNS_HRS06_MODE_MMC_HS400ES:
if (!ios->enhanced_strobe)
mode = SDHCI_CDNS_HRS06_MODE_MMC_HS400;
break;
default:
break;
}
sdhci_cdns_set_emmc_mode(priv, mode);
priv->enhanced_strobe = ios->enhanced_strobe;
}
BTW, I prefer sdhci_cdns_hs400_enhanced_strobe()
is placed below sdhci_cdns_execute_tuning()
because these two callbacks belong to the same group.
These two are not members of sdhci_ops,
but replacements for host->mmc_host_ops.
The other parts look good to me.
--
Best Regards
Masahiro Yamada