mmc: host:rk_sdmmc:
authorlintao <lintao@rock-chips.com>
Thu, 5 Jun 2014 10:41:32 +0000 (18:41 +0800)
committerlintao <lintao@rock-chips.com>
Thu, 5 Jun 2014 10:47:00 +0000 (18:47 +0800)
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

index cdd86a6ec49cc016b8920faf76bacf3c7d65499a..a1887f68c7c306d330784f2befffa95fb066578e 100755 (executable)
@@ -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;