From: Adrian Hunter <adrian.hunter@intel.com>
Date: Thu, 14 Nov 2013 08:16:20 +0000 (+0200)
Subject: mmc: sdhci: Allow for long command timeouts
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3e1a6892481034193b2502725f787465ebf39818;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git

mmc: sdhci: Allow for long command timeouts

The driver has a timer with a 10 second timeout to catch devices that stop
responding.  However it is possible for commands to take even longer than
that.  Change the timer timeout to reflect the command timeout.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Chris Ball <chris@printf.net>
---

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 0a1893a54dd7..9ddef4763541 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1018,7 +1018,12 @@ void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
 		mdelay(1);
 	}
 
-	mod_timer(&host->timer, jiffies + 10 * HZ);
+	timeout = jiffies;
+	if (!cmd->data && cmd->cmd_timeout_ms > 9000)
+		timeout += DIV_ROUND_UP(cmd->cmd_timeout_ms, 1000) * HZ + HZ;
+	else
+		timeout += 10 * HZ;
+	mod_timer(&host->timer, timeout);
 
 	host->cmd = cmd;