summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>2016-06-24 12:19:34 +0200
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2016-06-29 16:48:29 +0200
commitfc14b7601e5ca587afd97936ef3fd599f4e9281c (patch)
tree461266cfd3209e8356802c43c13a3caba33df052 /drivers
parent70efa60d96c9f05d91d8875eee97446df7f9e877 (diff)
mmc: tegra: apalis-tk1: hack to make sd1 functional
Disable the external loopback and use the internal loopback as per SDMMC_VENDOR_MISC_CNTRL_0 register's SDMMC_SPARE1 bits being set to 0xfffd according to the TRM. Enable card detect polling as we can't use SD1_CD# aka SDMMC3_CLK_LB_OUT for now as it features some magic properties even though the external loopback is disabled and the internal loopback used as per SDMMC_VENDOR_MISC_CNTRL_0 register's SDMMC_SPARE1 bits being set to 0xfffd according to the TRM! Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Acked-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/host/sdhci-tegra.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index 311e003667c8..a37ecb6a8a55 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -1204,15 +1204,25 @@ static void tegra_sdhci_reset_exit(struct sdhci_host *host, u8 mask)
/* External loopback is valid for sdmmc3 only */
if ((soc_data->nvquirks & NVQUIRK_DISABLE_EXTERNAL_LOOPBACK) &&
(tegra_host->instance == 2)) {
+#ifdef CONFIG_MACH_APALIS_TK1
+ /*
+ * Disable the external loopback and use the internal loopback as per
+ * SDMMC_VENDOR_MISC_CNTRL_0 register's SDMMC_SPARE1 bits being set to
+ * 0xfffd according to the TRM.
+ */
+#else /* CONFIG_MACH_APALIS_TK1 */
if ((tegra_host->tuning_status == TUNING_STATUS_DONE)
&& (host->mmc->pm_flags &
MMC_PM_KEEP_POWER)) {
+#endif /* CONFIG_MACH_APALIS_TK1 */
misc_ctrl &= ~(1 <<
SDHCI_VNDR_MISC_CTRL_EN_EXT_LOOPBACK_SHIFT);
+#ifndef CONFIG_MACH_APALIS_TK1
} else {
misc_ctrl |= (1 <<
SDHCI_VNDR_MISC_CTRL_EN_EXT_LOOPBACK_SHIFT);
}
+#endif /* !CONFIG_MACH_APALIS_TK1 */
}
sdhci_writel(host, misc_ctrl, SDHCI_VNDR_MISC_CTRL);
@@ -3262,6 +3272,13 @@ out:
SDHCI_TEGRA_DBG("%s: Freq tuning done\n", mmc_hostname(sdhci->mmc));
if (enable_lb_clk) {
misc_ctrl = sdhci_readl(sdhci, SDHCI_VNDR_MISC_CTRL);
+#ifdef CONFIG_MACH_APALIS_TK1
+ /*
+ * Disable the external loopback and use the internal loopback
+ * as per SDMMC_VENDOR_MISC_CNTRL_0 register's SDMMC_SPARE1 bits
+ * being set to 0xfffd according to the TRM.
+ */
+#else /* CONFIG_MACH_APALIS_TK1 */
if (err) {
/* Tuning is failed and card will try to enumerate in
* Legacy High Speed mode. So, Enable External Loopback
@@ -3269,10 +3286,10 @@ out:
*/
misc_ctrl |= (1 <<
SDHCI_VNDR_MISC_CTRL_EN_EXT_LOOPBACK_SHIFT);
- } else {
+ } else
+#endif /* CONFIG_MACH_APALIS_TK1 */
misc_ctrl &= ~(1 <<
SDHCI_VNDR_MISC_CTRL_EN_EXT_LOOPBACK_SHIFT);
- }
sdhci_writel(sdhci, misc_ctrl, SDHCI_VNDR_MISC_CTRL);
}
return err;
@@ -4321,6 +4338,17 @@ static int sdhci_tegra_probe(struct platform_device *pdev)
host->mmc->pm_caps |= plat->pm_caps;
host->mmc->pm_flags |= plat->pm_flags;
+#ifdef CONFIG_MACH_APALIS_TK1
+ /*
+ * Enable card detect polling as we can't use SD1_CD# aka
+ * SDMMC3_CLK_LB_OUT for now as it features some magic properties even
+ * though the external loopback is disabled and the internal loopback
+ * used as per SDMMC_VENDOR_MISC_CNTRL_0 register's SDMMC_SPARE1 bits
+ * being set to 0xfffd according to the TRM!
+ */
+ host->mmc->caps |= MMC_CAP_NEEDS_POLL;
+#endif /* CONFIG_MACH_APALIS_TK1 */
+
host->mmc->caps |= MMC_CAP_ERASE;
/* enable 1/8V DDR capable */
host->mmc->caps |= MMC_CAP_1_8V_DDR;