diff mbox

mmc: sdhci: Allow for long command timeouts

Message ID 1384416980-15850-1-git-send-email-adrian.hunter@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Adrian Hunter Nov. 14, 2013, 8:16 a.m. UTC
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>
---
 drivers/mmc/host/sdhci.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Adrian Hunter Dec. 13, 2013, 10:45 a.m. UTC | #1
Hi Chris

What about this one?

Regards
Adrian

On 14/11/13 10:16, Adrian Hunter wrote:
> 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>
> ---
>  drivers/mmc/host/sdhci.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index bd8a098..614a34d 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1013,7 +1013,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;
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Adrian Hunter Jan. 13, 2014, 7:06 a.m. UTC | #2
Ping?


On 13/12/13 12:45, Adrian Hunter wrote:
> Hi Chris
> 
> What about this one?
> 
> Regards
> Adrian
> 
> On 14/11/13 10:16, Adrian Hunter wrote:
>> 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>
>> ---
>>  drivers/mmc/host/sdhci.c | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
>> index bd8a098..614a34d 100644
>> --- a/drivers/mmc/host/sdhci.c
>> +++ b/drivers/mmc/host/sdhci.c
>> @@ -1013,7 +1013,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;
>>  
>>
> 
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Adrian Hunter Jan. 20, 2014, 6:17 a.m. UTC | #3
Ping?

On 13/01/14 09:06, Adrian Hunter wrote:
> Ping?
> 
> 
> On 13/12/13 12:45, Adrian Hunter wrote:
>> Hi Chris
>>
>> What about this one?
>>
>> Regards
>> Adrian
>>
>> On 14/11/13 10:16, Adrian Hunter wrote:
>>> 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>
>>> ---
>>>  drivers/mmc/host/sdhci.c | 7 ++++++-
>>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
>>> index bd8a098..614a34d 100644
>>> --- a/drivers/mmc/host/sdhci.c
>>> +++ b/drivers/mmc/host/sdhci.c
>>> @@ -1013,7 +1013,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;
>>>  
>>>
>>
>>
>>
> 
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chris Ball Jan. 20, 2014, 3:36 p.m. UTC | #4
Hi Adrian,

On Thu, Nov 14 2013, Adrian Hunter wrote:
> 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>

Thanks, pushed to mmc-next for 3.14, sorry for the delay.

- Chris.
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index bd8a098..614a34d 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1013,7 +1013,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;