On 28. 11. 2022. 14:32, Adrian Hunter wrote:
Avoid re-configuring UHS and preset settings when the settings have not
changed, irrespective of whether the clock is turning on.
Tested-by: Haibo Chen <haibo.chen@xxxxxxx>
Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx>
Hi, this is breaking sdhci-msm on IPQ8074 in next-20221130 for me
and reverting it makes the eMMC work again.
I get a lot of:
[ 2.727287] mmc0: tuning execution failed: -5
[ 2.727323] mmc0: error -5 whilst initialising MMC card
[ 3.846540] mmc0: tuning execution failed: -5
[ 3.846564] mmc0: error -5 whilst initialising MMC card
[ 4.966517] mmc0: tuning execution failed: -5
[ 4.966539] mmc0: error -5 whilst initialising MMC card
[ 6.096486] mmc0: tuning execution failed: -5
[ 6.096508] mmc0: error -5 whilst initialising MMC card
[ 7.206431] mmc0: tuning execution failed: -5
[ 7.206454] mmc0: error -5 whilst initialising MMC card
Regards,
Robert
---
drivers/mmc/host/sdhci.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 64750fbb0ac8..17e5ccf9a855 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2315,7 +2315,6 @@ void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
{
struct sdhci_host *host = mmc_priv(mmc);
bool reinit_uhs = host->reinit_uhs;
- bool turning_on_clk = false;
u8 ctrl;
host->reinit_uhs = false;
@@ -2345,8 +2344,6 @@ void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
sdhci_enable_preset_value(host, false);
if (!ios->clock || ios->clock != host->clock) {
- turning_on_clk = ios->clock && !host->clock;
-
host->ops->set_clock(host, ios->clock);
host->clock = ios->clock;
@@ -2374,11 +2371,10 @@ void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
host->ops->set_bus_width(host, ios->bus_width);
/*
- * Special case to avoid multiple clock changes during voltage
- * switching.
+ * Avoid unnecessary changes. In particular, this avoids multiple clock
+ * changes during voltage switching.
*/
if (!reinit_uhs &&
- turning_on_clk &&
host->timing == ios->timing &&
host->version >= SDHCI_SPEC_300 &&
!sdhci_presetable_values_change(host, ios))