Skip to content

Commit

Permalink
mmc: sdhci-tegra: enforce min window size for manual tuning
Browse files Browse the repository at this point in the history
Check against minimum allowed sampling window size on manual tuning.
That allows DDR200 to fail if not enough and then re-init to SDR104.
A safe window size for DDR200 is 8.
  • Loading branch information
CTCaer committed Apr 12, 2023
1 parent 3eb000b commit 55e9940
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/mmc/host/sdhci-tegra.c
Original file line number Diff line number Diff line change
Expand Up @@ -1663,6 +1663,7 @@ static void tegra_sdhci_execute_manual_tuning(struct sdhci_host *host, int num_i
}

#define INVALID_TAP 0x100
#define SAMPLING_WINDOW_SIZE_MIN 8 /* DDR200 */
static int tegra_sdhci_execute_tuning_ddr200(struct sdhci_host *host)
{
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
Expand Down Expand Up @@ -1730,6 +1731,15 @@ static int tegra_sdhci_execute_tuning_ddr200(struct sdhci_host *host)
}
}

if (best_size < SAMPLING_WINDOW_SIZE_MIN) {
dev_err(mmc_dev(host->mmc),
"manual tuning failed, "
"sampling window size (%d) too small...\n",
best_size);
err = -EIO;
goto out;
}

if (!best_tap) {
dev_err(mmc_dev(host->mmc),
"manual tuning failed, no best tap...\n");
Expand Down

0 comments on commit 55e9940

Please sign in to comment.