[PATCH 15/22] mci: sdhci: wait for idle before stopping clock

Sascha Hauer s.hauer at pengutronix.de
Thu Aug 3 03:49:56 PDT 2023


We should wait for the controller being idle before stopping the clock.
Some SDHCI controllers like the one found on TI AM62x SoCs do not work
properly without it.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/mci/sdhci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mci/sdhci.c b/drivers/mci/sdhci.c
index 8c543c1b5b..6d3c695372 100644
--- a/drivers/mci/sdhci.c
+++ b/drivers/mci/sdhci.c
@@ -493,6 +493,8 @@ void sdhci_set_clock(struct sdhci *host, unsigned int clock, unsigned int input_
 
 	host->mci->clock = 0;
 
+	sdhci_wait_idle(host, NULL);
+
 	sdhci_write16(host, SDHCI_CLOCK_CONTROL, 0);
 
 	if (clock == 0)
-- 
2.39.2




More information about the barebox mailing list