@@ -1694,6 +1694,7 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
int tuning_loop_counter = MAX_TUNING_LOOP;
unsigned long timeout;
int err = 0;
+ bool requires_tuning_nonuhs;
host = mmc_priv(mmc);
@@ -1704,16 +1705,19 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
/*
- * Host Controller needs tuning only in case of SDR104 mode
- * and for SDR50 mode when Use Tuning for SDR50 is set in
+ * The Host Controller needs tuning only in case of SDR104 mode
+ * and for SDR50 mode when Use Tuning for SDR50 is set in the
* Capabilities register.
- * If the Host Controller supports the HS200 mode then tuning
- * function has to be executed.
+ * If the Host Controller supports the HS200 mode then the
+ * tuning function has to be executed.
*/
- if ((ctrl & SDHCI_CTRL_UHS_MASK == SDHCI_CTRL_UHS_SDR104) ||
- ((ctrl & SDHCI_CTRL_UHS_MASK == SDHCI_CTRL_UHS_SDR50) &&
- host->flags & SDHCI_SDR50_NEEDS_TUNING ||
+ if (((ctrl & SDHCI_CTRL_UHS_MASK) == SDHCI_CTRL_UHS_SDR50) &&
+ (host->flags & SDHCI_SDR50_NEEDS_TUNING ||
host->flags & SDHCI_HS200_NEEDS_TUNING))
+ requires_tuning_nonuhs = true;
+
+ if (((ctrl & SDHCI_CTRL_UHS_MASK) == SDHCI_CTRL_UHS_SDR104) ||
+ requires_tuning_nonuhs)
ctrl |= SDHCI_CTRL_EXEC_TUNING;
else {
spin_unlock(&host->lock);