[PATCH 1/3] mmc: sdhci-of-dwcmshc: improve delay handling with fsleep()

From: Artem Shimko

Date: Mon May 18 2026 - 07:02:43 EST


The driver currently uses udelay() for short delays, which performs
busy-waiting and may not be optimal even for very short durations.
While udelay() is appropriate for atomic context, these specific delays
occur in non-atomic contexts where sleeping is allowed.

Replace udelay(1) with fsleep(1) in dwcmshc_rk3568_set_clock() and
rk35xx_sdhci_reset(). The fsleep() function automatically selects the
optimal delay mechanism based on the requested duration - for
delays <= 10 microseconds it will use udelay() internally, but provides
better flexibility for future adjustments and makes the code more
consistent with kernel best practices. No functional change is intended.

Signed-off-by: Artem Shimko <a.shimko.dev@xxxxxxxxx>
---
drivers/mmc/host/sdhci-of-dwcmshc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c
index 0b2158a7e409..8c3ca47c8060 100644
--- a/drivers/mmc/host/sdhci-of-dwcmshc.c
+++ b/drivers/mmc/host/sdhci-of-dwcmshc.c
@@ -816,7 +816,7 @@ static void dwcmshc_rk3568_set_clock(struct sdhci_host *host, unsigned int clock

/* Reset DLL */
sdhci_writel(host, BIT(1), DWCMSHC_EMMC_DLL_CTRL);
- udelay(1);
+ fsleep(1);
sdhci_writel(host, 0x0, DWCMSHC_EMMC_DLL_CTRL);

/*
@@ -895,7 +895,7 @@ static void rk35xx_sdhci_reset(struct sdhci_host *host, u8 mask)

if (mask & SDHCI_RESET_ALL && priv->reset) {
reset_control_assert(priv->reset);
- udelay(1);
+ fsleep(1);
reset_control_deassert(priv->reset);
}

--
2.43.0