Skip to content

Commit de31f6a

Browse files
Faiz-AbbasUlf Hansson
authored andcommitted
mmc: sdhci_am654: Reset Command and Data line after tuning
The tuning data is leftover in the buffer after tuning. This can cause issues in future data commands, especially with CQHCI. Reset the command and data lines after tuning to continue from a clean state. Fixes: 41fd4ca ("mmc: sdhci_am654: Add Initial Support for AM654 SDHCI driver") Cc: stable@vger.kernel.org Signed-off-by: Faiz Abbas <faiz_abbas@ti.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20200108143301.1929-3-faiz_abbas@ti.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 4d627c8 commit de31f6a

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

drivers/mmc/host/sdhci_am654.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,22 @@ static void sdhci_am654_write_b(struct sdhci_host *host, u8 val, int reg)
240240
writeb(val, host->ioaddr + reg);
241241
}
242242

243+
static int sdhci_am654_execute_tuning(struct mmc_host *mmc, u32 opcode)
244+
{
245+
struct sdhci_host *host = mmc_priv(mmc);
246+
int err = sdhci_execute_tuning(mmc, opcode);
247+
248+
if (err)
249+
return err;
250+
/*
251+
* Tuning data remains in the buffer after tuning.
252+
* Do a command and data reset to get rid of it
253+
*/
254+
sdhci_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
255+
256+
return 0;
257+
}
258+
243259
static struct sdhci_ops sdhci_am654_ops = {
244260
.get_max_clock = sdhci_pltfm_clk_get_max_clock,
245261
.get_timeout_clock = sdhci_pltfm_clk_get_max_clock,
@@ -546,6 +562,8 @@ static int sdhci_am654_probe(struct platform_device *pdev)
546562
goto pm_runtime_put;
547563
}
548564

565+
host->mmc_host_ops.execute_tuning = sdhci_am654_execute_tuning;
566+
549567
ret = sdhci_am654_init(host);
550568
if (ret)
551569
goto pm_runtime_put;

0 commit comments

Comments
 (0)