summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJudith Mendez <jm@ti.com>2026-08-06 11:22:02 -0500
committerUlf Hansson <ulfh@kernel.org>2026-09-04 10:53:13 +0200
commit3c6f98b6e64e565ec548c63e32e58af2af2c1811 (patch)
treeb2b68fc44d292276e99ae45e8e0637cc3998a804 /drivers
parent555bb7b7c1497accc0894423220f772f006a9584 (diff)
downloadlinux-next-3c6f98b6e64e565ec548c63e32e58af2af2c1811.tar.gz
linux-next-3c6f98b6e64e565ec548c63e32e58af2af2c1811.zip
mmc: core: Add power-off-delay-us support
Add support for power-off-delay-us which shall be used to specify value of delay after deasserting power during MMC power cycles. Default for delay is 1000us but custom delay can be passed in to work around hardware issues such as slow RC discharge on MMC VDD rails. Signed-off-by: Judith Mendez <jm@ti.com> Signed-off-by: Ulf Hansson <ulfh@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/core/core.c2
-rw-r--r--drivers/mmc/core/core.h8
-rw-r--r--drivers/mmc/core/host.c4
3 files changed, 13 insertions, 1 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 29e80e5f928e..9472041fe1c2 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1388,7 +1388,7 @@ void mmc_power_off(struct mmc_host *host)
* XO-1.5, require a short delay after poweroff before the card
* can be successfully turned on again.
*/
- mmc_delay(1);
+ mmc_delay_us(host->ios.power_off_delay_us);
}
void mmc_power_cycle(struct mmc_host *host, u32 ocr)
diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
index a028b48be164..601c73761e88 100644
--- a/drivers/mmc/core/core.h
+++ b/drivers/mmc/core/core.h
@@ -73,6 +73,14 @@ static inline void mmc_delay(unsigned int ms)
msleep(ms);
}
+static inline void mmc_delay_us(unsigned int us)
+{
+ if (us == 0)
+ return;
+
+ fsleep(us);
+}
+
void mmc_rescan(struct work_struct *work);
void mmc_start_host(struct mmc_host *host);
void __mmc_stop_host(struct mmc_host *host);
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index b7ce3137d452..ac1846e0e7fb 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -421,6 +421,9 @@ int mmc_of_parse(struct mmc_host *host)
device_property_read_u32(dev, "post-power-on-delay-ms",
&host->ios.power_delay_ms);
+ device_property_read_u32(dev, "power-off-delay-us",
+ &host->ios.power_off_delay_us);
+
return mmc_pwrseq_alloc(host);
}
@@ -574,6 +577,7 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
host->fixed_drv_type = -EINVAL;
host->ios.power_delay_ms = 10;
+ host->ios.power_off_delay_us = 1000;
host->ios.power_mode = MMC_POWER_UNDEFINED;
return host;