[v2,7/7] mmc: sdhci_am654: Fix ITAPDLY for HS400 timing
Commit Message
While STRB is currently used for DATA and CRC responses, the CMD
responses from the device to the host still require ITAPDLY for
HS400 timing.
Currently what is stored for HS400 is the ITAPDLY from High Speed
mode which is incorrect. The ITAPDLY for HS400 speed mode should
be the same as ITAPDLY as HS200 timing after tuning is executed.
Add the functionality to save ITAPDLY from HS200 tuning and save
as HS400 ITAPDLY.
Fixes: a161c45f2979 ("mmc: sdhci_am654: Enable DLL only for some speed modes")
Signed-off-by: Judith Mendez <jm@ti.com>
---
drivers/mmc/host/sdhci_am654.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
@@ -151,6 +151,7 @@ struct sdhci_am654_data {
u32 flags;
u32 quirks;
bool dll_enable;
+ bool hs200_tunning;
#define SDHCI_AM654_QUIRK_FORCE_CDTEST BIT(0)
};
@@ -175,6 +176,7 @@ static void sdhci_am654_setup_dll(struct sdhci_host *host, unsigned int clock)
{
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host);
+ unsigned char timing = host->mmc->ios.timing;
int sel50, sel100, freqsel;
u32 mask, val;
int ret;
@@ -237,6 +239,10 @@ static void sdhci_am654_setup_dll(struct sdhci_host *host, unsigned int clock)
dev_err(mmc_dev(host->mmc), "DLL failed to relock\n");
return;
}
+
+ /* HS400 ITAPDLY should be the same as HS200 ITAPDLY*/
+ if (timing == MMC_TIMING_MMC_HS400)
+ sdhci_am654->itap_del_sel[timing] = sdhci_am654->itap_del_sel[timing - 1];
}
static void sdhci_am654_write_itapdly(struct sdhci_am654_data *sdhci_am654,
@@ -310,6 +316,9 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)
regmap_update_bits(sdhci_am654->base, PHY_CTRL5, CLKBUFSEL_MASK,
sdhci_am654->clkbuf_sel);
+
+ if (timing == MMC_TIMING_MMC_HS200 && sdhci_am654->dll_enable)
+ sdhci_am654->hs200_tunning = true;
}
static void sdhci_j721e_4bit_set_clock(struct sdhci_host *host,
@@ -527,6 +536,10 @@ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host,
sdhci_am654_write_itapdly(sdhci_am654, itap, 1);
+ /* Save ITAPDLY for HS200 */
+ if (sdhci_am654->hs200_tunning)
+ sdhci_am654->itap_del_sel[MMC_TIMING_MMC_HS200] = itap;
+
return 0;
}