mmc: dw_mmc: Add some safe delay for releasing power leak

Add some delay for some broken card which need long time to
release the remain power leak. 200ms is very safe, no need to
bother device tree property, as it depends on card not board.

Fixes: 60c9e5240f ("mmc: dw_mmc: Add normal and idle pinctrl control")
Change-Id: I5437945cd860674be860d246200e15eed9d91e03
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Yifeng Zhao <yifeng.zhao@rock-chips.com>
This commit is contained in:
Shawn Lin
2023-07-20 09:20:45 +08:00
committed by Tao Huang
parent 54ff36c469
commit 2a8db47d13

View File

@@ -1468,7 +1468,7 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
{
struct dw_mci_slot *slot = mmc_priv(mmc);
const struct dw_mci_drv_data *drv_data = slot->host->drv_data;
u32 regs;
u32 regs, power_off_delay;
int ret;
switch (ios->bus_width) {
@@ -1507,8 +1507,14 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
switch (ios->power_mode) {
case MMC_POWER_UP:
if (!IS_ERR_OR_NULL(slot->host->pinctrl))
pinctrl_select_state(slot->host->pinctrl, slot->host->idle_state);
if (dw_mci_get_cd(mmc) && !IS_ERR_OR_NULL(slot->host->pinctrl)) {
if (!pinctrl_select_state(slot->host->pinctrl, slot->host->idle_state)) {
if (device_property_read_u32(slot->host->dev, "power-off-delay-ms",
&power_off_delay))
power_off_delay = 200;
msleep(power_off_delay);
}
}
if (!IS_ERR(mmc->supply.vmmc)) {
ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc,