summaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host
diff options
context:
space:
mode:
authorAapo Vienamo <avienamo@nvidia.com>2018-08-30 18:06:16 +0300
committerUlf Hansson <ulf.hansson@linaro.org>2018-10-08 11:40:43 +0200
commit887bda8f21ee78b14678853ee6ecdd6569196054 (patch)
tree7fcfa8f15cd44a7c291d64a16ffd48d9f356272d /drivers/mmc/host
parent212b0cf14178663576ea3c01f25abe2f83d23565 (diff)
downloadlinux-stable-887bda8f21ee78b14678853ee6ecdd6569196054.tar.gz
linux-stable-887bda8f21ee78b14678853ee6ecdd6569196054.tar.bz2
linux-stable-887bda8f21ee78b14678853ee6ecdd6569196054.zip
mmc: tegra: Disable card clock during pad calibration
Disable the card clock during automatic pad drive strength calibration and re-enable it afterwards. Signed-off-by: Aapo Vienamo <avienamo@nvidia.com> Acked-by: Thierry Reding <treding@nvidia.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host')
-rw-r--r--drivers/mmc/host/sdhci-tegra.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index e63cd6b2fc9f..ec07a3ce0247 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -260,11 +260,35 @@ static void tegra_sdhci_configure_cal_pad(struct sdhci_host *host, bool enable)
usleep_range(1, 2);
}
+static bool tegra_sdhci_configure_card_clk(struct sdhci_host *host, bool enable)
+{
+ bool status;
+ u32 reg;
+
+ reg = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
+ status = !!(reg & SDHCI_CLOCK_CARD_EN);
+
+ if (status == enable)
+ return status;
+
+ if (enable)
+ reg |= SDHCI_CLOCK_CARD_EN;
+ else
+ reg &= ~SDHCI_CLOCK_CARD_EN;
+
+ sdhci_writew(host, reg, SDHCI_CLOCK_CONTROL);
+
+ return status;
+}
+
static void tegra_sdhci_pad_autocalib(struct sdhci_host *host)
{
+ bool card_clk_enabled;
u32 reg;
int ret;
+ card_clk_enabled = tegra_sdhci_configure_card_clk(host, false);
+
tegra_sdhci_configure_cal_pad(host, true);
reg = sdhci_readl(host, SDHCI_TEGRA_AUTO_CAL_CONFIG);
@@ -279,6 +303,8 @@ static void tegra_sdhci_pad_autocalib(struct sdhci_host *host)
tegra_sdhci_configure_cal_pad(host, false);
+ tegra_sdhci_configure_card_clk(host, card_clk_enabled);
+
if (ret)
dev_err(mmc_dev(host->mmc), "Pad autocal timed out\n");
}