mmc: host: rockchip: fix commit f5b42ad17d9da38198e24b3f1912fffc86c904a6
authorlintao <lintao@rock-chips.com>
Fri, 28 Mar 2014 08:17:59 +0000 (16:17 +0800)
committerlintao <lintao@rock-chips.com>
Fri, 28 Mar 2014 08:20:56 +0000 (16:20 +0800)
     Original methdod setup max hold time for cmd_rto tear down wifi in some cases,
work around this bug by detecting hold time ahead.

drivers/mmc/host/rk_sdmmc.c

index df3604b479198b24cc04bea5d0b55d3b64c5bafa..542fec6d23bac0134c38eba2b450bbbbff144a50 100755 (executable)
@@ -1460,12 +1460,9 @@ static void dw_mci_command_complete(struct dw_mci *host, struct mmc_command *cmd
        if (status & SDMMC_INT_RTO)
        {
            if(host->mmc->restrict_caps & RESTRICT_CARD_TYPE_SDIO)
-           {
                host->cmd_rto += 1;
-              (host->cmd_rto >= SDMMC_CMD_RTO_MAX_HOLD)?(cmd->error = -ETIMEDOUT):(cmd->error = 0);    
-               }
-               else
-                   cmd->error = -ETIMEDOUT;
+               
+               cmd->error = -ETIMEDOUT;
        }
        else if ((cmd->flags & MMC_RSP_CRC) && (status & SDMMC_INT_RCRC))
                cmd->error = -EILSEQ;
@@ -1477,8 +1474,11 @@ static void dw_mci_command_complete(struct dw_mci *host, struct mmc_command *cmd
 
        if (cmd->error) {
            if(MMC_SEND_STATUS != cmd->opcode)
-           MMC_DBG_ERR_FUNC(host->mmc, " command complete, cmd=%d,cmdError=%d [%s]",\
-               cmd->opcode, cmd->error,mmc_hostname(host->mmc));
+               if(host->cmd_rto >= SDMMC_CMD_RTO_MAX_HOLD){
+               MMC_DBG_ERR_FUNC(host->mmc, " command complete, cmd=%d,cmdError=%d [%s]",\
+                   cmd->opcode, cmd->error,mmc_hostname(host->mmc));
+              host->cmd_rto = 0;
+        }
                
                /* newer ip versions need a delay between retries */
                if (host->quirks & DW_MCI_QUIRK_RETRY_DELAY)