From 6732533e8b7f5e39e58971b695ce8cff2ca08eda Mon Sep 17 00:00:00 2001 From: lintao Date: Thu, 5 Jun 2014 18:41:32 +0800 Subject: [PATCH] mmc: host:rk_sdmmc: wifi: SDIO use flags to detect card-in or card-remove.If tagged up wifi and off, then go into deep suspend and resume, we do not judge if wifi is on or off, this will crash pm.resume for drivers cannot access register without hclk_mmc. [ 357.835059] 1192..dw_mci_set_ios: no card. [mmc1] [ 358.322686] dwmmc_rockchip ff0d0000.rksdmmc: Timeout resetting block (ctrl reset 0x1) [ 358.322792] dpm_run_callback(): platform_pm_resume+0x0/0x54 returns -19 [ 358.322813] PM: Device ff0d0000.rksdmmc failed to resume: error -19 Fix it by default return success state to pm.resume if wifi off in SDIO slot --- drivers/mmc/host/rk_sdmmc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/rk_sdmmc.c b/drivers/mmc/host/rk_sdmmc.c index cdd86a6ec49c..a1887f68c7c3 100755 --- a/drivers/mmc/host/rk_sdmmc.c +++ b/drivers/mmc/host/rk_sdmmc.c @@ -3089,13 +3089,13 @@ static bool dw_mci_ctrl_reset(struct dw_mci *host, u32 reset) do { ctrl = mci_readl(host, CTRL); if (!(ctrl & reset)) - return true; + return true; } while (time_before(jiffies, timeout)); dev_err(host->dev, "Timeout resetting block (ctrl reset %#x)\n", ctrl & reset); - + return false; } @@ -3517,7 +3517,15 @@ int dw_mci_resume(struct dw_mci *host) { int i, ret; u32 regs; + struct dw_mci_slot *slot; + + if (host->mmc->restrict_caps & RESTRICT_CARD_TYPE_SDIO){ + slot = mmc_priv(host->mmc); + if(!test_bit(DW_MMC_CARD_PRESENT, &slot->flags)) + return 0; + } + if (host->vmmc) { ret = regulator_enable(host->vmmc); if (ret) { @@ -3526,7 +3534,7 @@ int dw_mci_resume(struct dw_mci *host) return ret; } } - + if (!dw_mci_ctrl_all_reset(host)) { ret = -ENODEV; return ret; -- 2.34.1