From: Shawn Lin Date: Fri, 22 May 2015 07:38:08 +0000 (+0800) Subject: mmc: core: skyrocket timeout for cmd erase_group_xxx X-Git-Tag: firefly_0821_release~4130 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a71c0cc8fb1f3d3cf7a7bcdc42a5d4d2b46809c6;p=firefly-linux-kernel-4.4.55.git mmc: core: skyrocket timeout for cmd erase_group_xxx It shocked me that a buggy emmc need quite a long period of time for setting its erase_group_xxx. Increase timeout value does not harm to normal case which just under constrain. Signed-off-by: Shawn Lin Tested-by: Yongzhong Yang cc: Xiao yao --- diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 42f6b20d1c36..012de1e5aedc 100755 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -439,25 +439,31 @@ static void mmc_wait_for_req_done(struct mmc_host *host, u32 timeout = 0; if (!mrq->cmd->data) { - if (mrq->cmd->opcode == MMC_ERASE || (mrq->cmd->opcode == MMC_SEND_STATUS)) + if (mrq->cmd->opcode == MMC_ERASE || + (mrq->cmd->opcode == MMC_ERASE_GROUP_START) || + (mrq->cmd->opcode == MMC_ERASE_GROUP_END) || + (mrq->cmd->opcode == MMC_SEND_STATUS)) timeout = 2500000; else timeout = 500; } else { - timeout = mrq->cmd->data->blocks * mrq->cmd->data->blksz * 500; - if(!timeout) - timeout = 1000; - else if (timeout > 8 * 1000) + timeout = mrq->cmd->data->blocks * + mrq->cmd->data->blksz * 500; + + timeout = timeout ? timeout : 1000; + if (timeout > 8000) timeout = 8000; } while (1) { - if (!wait_for_completion_timeout(&mrq->completion, msecs_to_jiffies(timeout))) { + if (!wait_for_completion_timeout(&mrq->completion, + msecs_to_jiffies(timeout))) { cmd = mrq->cmd; cmd->error = -ETIMEDOUT; host->ops->post_tmo(host); - dev_err(mmc_dev(host), "req failed (CMD%u): error = %d, timeout = %dms\n", - cmd->opcode, cmd->error, timeout); + dev_err(mmc_dev(host), + "req failed (CMD%u): error = %d, timeout = %dms\n", + cmd->opcode, cmd->error, timeout); if (!cmd->data) break; }