Skip to content

Commit 4fc7261

Browse files
Prathamesh SheteUlf Hansson
authored andcommitted
mmc: sdhci-tegra: Fix switch to HS400ES mode
When CMD13 is sent after switching to HS400ES mode, the bus is operating at either MMC_HIGH_26_MAX_DTR or MMC_HIGH_52_MAX_DTR. To meet Tegra SDHCI requirement at HS400ES mode, force SDHCI interface clock to MMC_HS200_MAX_DTR (200 MHz) so that host controller CAR clock and the interface clock are rate matched. Signed-off-by: Prathamesh Shete <pshete@nvidia.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Fixes: dfc9700 ("mmc: tegra: Implement HS400 enhanced strobe") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20211214113653.4631-1-pshete@nvidia.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 2585cf9 commit 4fc7261

1 file changed

Lines changed: 26 additions & 17 deletions

File tree

drivers/mmc/host/sdhci-tegra.c

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -356,23 +356,6 @@ static void tegra_sdhci_set_tap(struct sdhci_host *host, unsigned int tap)
356356
}
357357
}
358358

359-
static void tegra_sdhci_hs400_enhanced_strobe(struct mmc_host *mmc,
360-
struct mmc_ios *ios)
361-
{
362-
struct sdhci_host *host = mmc_priv(mmc);
363-
u32 val;
364-
365-
val = sdhci_readl(host, SDHCI_TEGRA_VENDOR_SYS_SW_CTRL);
366-
367-
if (ios->enhanced_strobe)
368-
val |= SDHCI_TEGRA_SYS_SW_CTRL_ENHANCED_STROBE;
369-
else
370-
val &= ~SDHCI_TEGRA_SYS_SW_CTRL_ENHANCED_STROBE;
371-
372-
sdhci_writel(host, val, SDHCI_TEGRA_VENDOR_SYS_SW_CTRL);
373-
374-
}
375-
376359
static void tegra_sdhci_reset(struct sdhci_host *host, u8 mask)
377360
{
378361
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -793,6 +776,32 @@ static void tegra_sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
793776
}
794777
}
795778

779+
static void tegra_sdhci_hs400_enhanced_strobe(struct mmc_host *mmc,
780+
struct mmc_ios *ios)
781+
{
782+
struct sdhci_host *host = mmc_priv(mmc);
783+
u32 val;
784+
785+
val = sdhci_readl(host, SDHCI_TEGRA_VENDOR_SYS_SW_CTRL);
786+
787+
if (ios->enhanced_strobe) {
788+
val |= SDHCI_TEGRA_SYS_SW_CTRL_ENHANCED_STROBE;
789+
/*
790+
* When CMD13 is sent from mmc_select_hs400es() after
791+
* switching to HS400ES mode, the bus is operating at
792+
* either MMC_HIGH_26_MAX_DTR or MMC_HIGH_52_MAX_DTR.
793+
* To meet Tegra SDHCI requirement at HS400ES mode, force SDHCI
794+
* interface clock to MMC_HS200_MAX_DTR (200 MHz) so that host
795+
* controller CAR clock and the interface clock are rate matched.
796+
*/
797+
tegra_sdhci_set_clock(host, MMC_HS200_MAX_DTR);
798+
} else {
799+
val &= ~SDHCI_TEGRA_SYS_SW_CTRL_ENHANCED_STROBE;
800+
}
801+
802+
sdhci_writel(host, val, SDHCI_TEGRA_VENDOR_SYS_SW_CTRL);
803+
}
804+
796805
static unsigned int tegra_sdhci_get_max_clock(struct sdhci_host *host)
797806
{
798807
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);

0 commit comments

Comments
 (0)