diff mbox series

[4/4] mmc: sdhci: Enable card clock instead of ->set_clock()

Message ID 20221124170649.63851-5-adrian.hunter@intel.com (mailing list archive)
State New, archived
Headers show
Series mmc: sdhci: Fix voltage switch delay | expand

Commit Message

Adrian Hunter Nov. 24, 2022, 5:06 p.m. UTC
SDHCI has separate controls for the internal clock and enabling the
clock signal to the card.

The card clock signal was disabled via SDHCI_CLOCK_CARD_EN to avoid
glitches on the clock line. It is not necessary to reset the internal clock
to re-enable it. Instead re-enable by re-asserting SDHCI_CLOCK_CARD_EN.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
 drivers/mmc/host/sdhci.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 79a50d461ee4..19e0cb7add94 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2442,8 +2442,11 @@  void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 			host->drv_type = ios->drv_type;
 		}
 
-		/* Re-enable SD Clock */
-		host->ops->set_clock(host, host->clock);
+		if (ios->clock) {
+			clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
+			clk |= SDHCI_CLOCK_CARD_EN;
+			sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
+		}
 	} else
 		sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
 }