public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] mmc:sdhci: Wait longer for command with busy flags
@ 2013-08-09  0:04 Haijun Zhang
  2013-08-09  6:39 ` Barry Song
  0 siblings, 1 reply; 6+ messages in thread
From: Haijun Zhang @ 2013-08-09  0:04 UTC (permalink / raw)
  To: linux-mmc; +Cc: cbouatmailru, cjb, Haijun Zhang

When command with busy flags send and also data busy end interrupt
will be generate, the command will be finished when data transfer
complete or data busy state end, Sometimes this will expend more than
10*Hz time to finish this command, so we should wait longer to detect
command complete timeout err.

Signed-off-by: Haijun Zhang <Haijun.Zhang@freescale.com>
---
changes for V2:
	- Correct the timer

 drivers/mmc/host/sdhci.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index a78bd4f..8888578 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -986,6 +986,7 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
 	int flags;
 	u32 mask;
 	unsigned long timeout;
+	u32 timer = 10;
 
 	WARN_ON(host->cmd);
 
@@ -1014,7 +1015,18 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
 		mdelay(1);
 	}
 
-	mod_timer(&host->timer, jiffies + 10 * HZ);
+	/*
+	 * When send a commmand with busy state and also the data busy end
+	 * interrupt can be generate, the command will be finished when date
+	 * transfer complete or busy state end. Sometimes this will expend
+	 * more than 10*HZ, In this case whe should wait longer to detect
+	 * command complete timeout err.
+	 */
+	if ((host->cmd->flags & MMC_RSP_BUSY) &&
+			!(host->quirks & SDHCI_QUIRK_NO_BUSY_IRQ))
+		timer = 1000;
+
+	mod_timer(&host->timer, jiffies + timer * HZ);
 
 	host->cmd = cmd;
 
-- 
1.8.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH V2] mmc:sdhci: Wait longer for command with busy flags
  2013-08-09  0:04 [PATCH V2] mmc:sdhci: Wait longer for command with busy flags Haijun Zhang
@ 2013-08-09  6:39 ` Barry Song
  2013-08-09  6:47   ` Zhang Haijun
  0 siblings, 1 reply; 6+ messages in thread
From: Barry Song @ 2013-08-09  6:39 UTC (permalink / raw)
  To: Haijun Zhang; +Cc: linux-mmc, cbouatmailru, cjb

2013/8/9 Haijun Zhang <Haijun.Zhang@freescale.com>:
> When command with busy flags send and also data busy end interrupt
> will be generate, the command will be finished when data transfer
> complete or data busy state end, Sometimes this will expend more than
> 10*Hz time to finish this command, so we should wait longer to detect
> command complete timeout err.
>
> Signed-off-by: Haijun Zhang <Haijun.Zhang@freescale.com>
> ---
> changes for V2:
>         - Correct the timer
>
>  drivers/mmc/host/sdhci.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index a78bd4f..8888578 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -986,6 +986,7 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
>         int flags;
>         u32 mask;
>         unsigned long timeout;
> +       u32 timer = 10;
>
>         WARN_ON(host->cmd);
>
> @@ -1014,7 +1015,18 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
>                 mdelay(1);
>         }
>
> -       mod_timer(&host->timer, jiffies + 10 * HZ);
> +       /*
> +        * When send a commmand with busy state and also the data busy end
> +        * interrupt can be generate, the command will be finished when date
> +        * transfer complete or busy state end. Sometimes this will expend
> +        * more than 10*HZ, In this case whe should wait longer to detect
> +        * command complete timeout err.
> +        */
> +       if ((host->cmd->flags & MMC_RSP_BUSY) &&
> +                       !(host->quirks & SDHCI_QUIRK_NO_BUSY_IRQ))
> +               timer = 1000;
> +
> +       mod_timer(&host->timer, jiffies + timer * HZ);

haojun, do you mean we need to wait for 1 minutes and 40 seconds for
timeout? it seems it is too large for a kernel.

>
>         host->cmd = cmd;
>
> --
> 1.8.0
>

-barry

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V2] mmc:sdhci: Wait longer for command with busy flags
  2013-08-09  6:39 ` Barry Song
@ 2013-08-09  6:47   ` Zhang Haijun
  2013-08-09  8:30     ` Barry Song
  0 siblings, 1 reply; 6+ messages in thread
From: Zhang Haijun @ 2013-08-09  6:47 UTC (permalink / raw)
  To: Barry Song; +Cc: Haijun Zhang, linux-mmc, cbouatmailru, cjb

On 08/09/2013 02:39 PM, Barry Song wrote:
> 2013/8/9 Haijun Zhang <Haijun.Zhang@freescale.com>:
>> When command with busy flags send and also data busy end interrupt
>> will be generate, the command will be finished when data transfer
>> complete or data busy state end, Sometimes this will expend more than
>> 10*Hz time to finish this command, so we should wait longer to detect
>> command complete timeout err.
>>
>> Signed-off-by: Haijun Zhang <Haijun.Zhang@freescale.com>
>> ---
>> changes for V2:
>>          - Correct the timer
>>
>>   drivers/mmc/host/sdhci.c | 14 +++++++++++++-
>>   1 file changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
>> index a78bd4f..8888578 100644
>> --- a/drivers/mmc/host/sdhci.c
>> +++ b/drivers/mmc/host/sdhci.c
>> @@ -986,6 +986,7 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
>>          int flags;
>>          u32 mask;
>>          unsigned long timeout;
>> +       u32 timer = 10;
>>
>>          WARN_ON(host->cmd);
>>
>> @@ -1014,7 +1015,18 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
>>                  mdelay(1);
>>          }
>>
>> -       mod_timer(&host->timer, jiffies + 10 * HZ);
>> +       /*
>> +        * When send a commmand with busy state and also the data busy end
>> +        * interrupt can be generate, the command will be finished when date
>> +        * transfer complete or busy state end. Sometimes this will expend
>> +        * more than 10*HZ, In this case whe should wait longer to detect
>> +        * command complete timeout err.
>> +        */
>> +       if ((host->cmd->flags & MMC_RSP_BUSY) &&
>> +                       !(host->quirks & SDHCI_QUIRK_NO_BUSY_IRQ))
>> +               timer = 1000;
>> +
>> +       mod_timer(&host->timer, jiffies + timer * HZ);
> haojun, do you mean we need to wait for 1 minutes and 40 seconds for
> timeout? it seems it is too large for a kernel.
1000 * HZ = 1000 * 1 / 250 = 4000ms, about 4s. On my platform.
>
>>          host->cmd = cmd;
>>
>> --
>> 1.8.0
>>
> -barry
>


-- 
Thanks & Regards

Haijun



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V2] mmc:sdhci: Wait longer for command with busy flags
  2013-08-09  6:47   ` Zhang Haijun
@ 2013-08-09  8:30     ` Barry Song
  2013-08-09  8:53       ` Jaehoon Chung
  0 siblings, 1 reply; 6+ messages in thread
From: Barry Song @ 2013-08-09  8:30 UTC (permalink / raw)
  To: Zhang Haijun; +Cc: Haijun Zhang, linux-mmc, cbouatmailru, cjb

2013/8/9 Zhang Haijun <B42677@freescale.com>:
> On 08/09/2013 02:39 PM, Barry Song wrote:
>>
>> 2013/8/9 Haijun Zhang <Haijun.Zhang@freescale.com>:
>>>
>>> When command with busy flags send and also data busy end interrupt
>>> will be generate, the command will be finished when data transfer
>>> complete or data busy state end, Sometimes this will expend more than
>>> 10*Hz time to finish this command, so we should wait longer to detect
>>> command complete timeout err.
>>>
>>> Signed-off-by: Haijun Zhang <Haijun.Zhang@freescale.com>
>>> ---
>>> changes for V2:
>>>          - Correct the timer
>>>
>>>   drivers/mmc/host/sdhci.c | 14 +++++++++++++-
>>>   1 file changed, 13 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
>>> index a78bd4f..8888578 100644
>>> --- a/drivers/mmc/host/sdhci.c
>>> +++ b/drivers/mmc/host/sdhci.c
>>> @@ -986,6 +986,7 @@ static void sdhci_send_command(struct sdhci_host
>>> *host, struct mmc_command *cmd)
>>>          int flags;
>>>          u32 mask;
>>>          unsigned long timeout;
>>> +       u32 timer = 10;
>>>
>>>          WARN_ON(host->cmd);
>>>
>>> @@ -1014,7 +1015,18 @@ static void sdhci_send_command(struct sdhci_host
>>> *host, struct mmc_command *cmd)
>>>                  mdelay(1);
>>>          }
>>>
>>> -       mod_timer(&host->timer, jiffies + 10 * HZ);
>>> +       /*
>>> +        * When send a commmand with busy state and also the data busy
>>> end
>>> +        * interrupt can be generate, the command will be finished when
>>> date
>>> +        * transfer complete or busy state end. Sometimes this will
>>> expend
>>> +        * more than 10*HZ, In this case whe should wait longer to detect
>>> +        * command complete timeout err.
>>> +        */
>>> +       if ((host->cmd->flags & MMC_RSP_BUSY) &&
>>> +                       !(host->quirks & SDHCI_QUIRK_NO_BUSY_IRQ))
>>> +               timer = 1000;
>>> +
>>> +       mod_timer(&host->timer, jiffies + timer * HZ);
>>
>> haojun, do you mean we need to wait for 1 minutes and 40 seconds for
>> timeout? it seems it is too large for a kernel.
>
> 1000 * HZ = 1000 * 1 / 250 = 4000ms, about 4s. On my platform.

no. pls note the unit is jiffy not ms.

>
>>
>>>          host->cmd = cmd;
>>>
>>> --
>>> 1.8.0
>>>
>> -barry
>>
>
>
> --
> Thanks & Regards
>
> Haijun
>
>
-barry

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V2] mmc:sdhci: Wait longer for command with busy flags
  2013-08-09  8:30     ` Barry Song
@ 2013-08-09  8:53       ` Jaehoon Chung
  2013-08-09  9:07         ` Zhang Haijun
  0 siblings, 1 reply; 6+ messages in thread
From: Jaehoon Chung @ 2013-08-09  8:53 UTC (permalink / raw)
  To: Barry Song; +Cc: Zhang Haijun, Haijun Zhang, linux-mmc, cbouatmailru, cjb

On 08/09/2013 05:30 PM, Barry Song wrote:
> 2013/8/9 Zhang Haijun <B42677@freescale.com>:
>> On 08/09/2013 02:39 PM, Barry Song wrote:
>>>
>>> 2013/8/9 Haijun Zhang <Haijun.Zhang@freescale.com>:
>>>>
>>>> When command with busy flags send and also data busy end interrupt
>>>> will be generate, the command will be finished when data transfer
>>>> complete or data busy state end, Sometimes this will expend more than
>>>> 10*Hz time to finish this command, so we should wait longer to detect
>>>> command complete timeout err.
>>>>
>>>> Signed-off-by: Haijun Zhang <Haijun.Zhang@freescale.com>
>>>> ---
>>>> changes for V2:
>>>>          - Correct the timer
>>>>
>>>>   drivers/mmc/host/sdhci.c | 14 +++++++++++++-
>>>>   1 file changed, 13 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
>>>> index a78bd4f..8888578 100644
>>>> --- a/drivers/mmc/host/sdhci.c
>>>> +++ b/drivers/mmc/host/sdhci.c
>>>> @@ -986,6 +986,7 @@ static void sdhci_send_command(struct sdhci_host
>>>> *host, struct mmc_command *cmd)
>>>>          int flags;
>>>>          u32 mask;
>>>>          unsigned long timeout;
>>>> +       u32 timer = 10;
>>>>
>>>>          WARN_ON(host->cmd);
>>>>
>>>> @@ -1014,7 +1015,18 @@ static void sdhci_send_command(struct sdhci_host
>>>> *host, struct mmc_command *cmd)
>>>>                  mdelay(1);
>>>>          }
>>>>
>>>> -       mod_timer(&host->timer, jiffies + 10 * HZ);
>>>> +       /*
>>>> +        * When send a commmand with busy state and also the data busy
>>>> end
>>>> +        * interrupt can be generate, the command will be finished when
>>>> date
>>>> +        * transfer complete or busy state end. Sometimes this will
>>>> expend
>>>> +        * more than 10*HZ, In this case whe should wait longer to detect
>>>> +        * command complete timeout err.
>>>> +        */
>>>> +       if ((host->cmd->flags & MMC_RSP_BUSY) &&
>>>> +                       !(host->quirks & SDHCI_QUIRK_NO_BUSY_IRQ))
>>>> +               timer = 1000;
>>>> +
>>>> +       mod_timer(&host->timer, jiffies + timer * HZ);
>>>
>>> haojun, do you mean we need to wait for 1 minutes and 40 seconds for
>>> timeout? it seems it is too large for a kernel.
>>
>> 1000 * HZ = 1000 * 1 / 250 = 4000ms, about 4s. On my platform.
> 
> no. pls note the unit is jiffy not ms.
Haijun, you refer to kernel/time.c

Best Regards,
Jaehoon Chung
> 
>>
>>>
>>>>          host->cmd = cmd;
>>>>
>>>> --
>>>> 1.8.0
>>>>
>>> -barry
>>>
>>
>>
>> --
>> Thanks & Regards
>>
>> Haijun
>>
>>
> -barry
> --
> 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
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V2] mmc:sdhci: Wait longer for command with busy flags
  2013-08-09  8:53       ` Jaehoon Chung
@ 2013-08-09  9:07         ` Zhang Haijun
  0 siblings, 0 replies; 6+ messages in thread
From: Zhang Haijun @ 2013-08-09  9:07 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: Barry Song, Haijun Zhang, linux-mmc, cbouatmailru, cjb

On 08/09/2013 04:53 PM, Jaehoon Chung wrote:
> On 08/09/2013 05:30 PM, Barry Song wrote:
>> 2013/8/9 Zhang Haijun <B42677@freescale.com>:
>>> On 08/09/2013 02:39 PM, Barry Song wrote:
>>>> 2013/8/9 Haijun Zhang <Haijun.Zhang@freescale.com>:
>>>>> When command with busy flags send and also data busy end interrupt
>>>>> will be generate, the command will be finished when data transfer
>>>>> complete or data busy state end, Sometimes this will expend more than
>>>>> 10*Hz time to finish this command, so we should wait longer to detect
>>>>> command complete timeout err.
>>>>>
>>>>> Signed-off-by: Haijun Zhang <Haijun.Zhang@freescale.com>
>>>>> ---
>>>>> changes for V2:
>>>>>           - Correct the timer
>>>>>
>>>>>    drivers/mmc/host/sdhci.c | 14 +++++++++++++-
>>>>>    1 file changed, 13 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
>>>>> index a78bd4f..8888578 100644
>>>>> --- a/drivers/mmc/host/sdhci.c
>>>>> +++ b/drivers/mmc/host/sdhci.c
>>>>> @@ -986,6 +986,7 @@ static void sdhci_send_command(struct sdhci_host
>>>>> *host, struct mmc_command *cmd)
>>>>>           int flags;
>>>>>           u32 mask;
>>>>>           unsigned long timeout;
>>>>> +       u32 timer = 10;
>>>>>
>>>>>           WARN_ON(host->cmd);
>>>>>
>>>>> @@ -1014,7 +1015,18 @@ static void sdhci_send_command(struct sdhci_host
>>>>> *host, struct mmc_command *cmd)
>>>>>                   mdelay(1);
>>>>>           }
>>>>>
>>>>> -       mod_timer(&host->timer, jiffies + 10 * HZ);
>>>>> +       /*
>>>>> +        * When send a commmand with busy state and also the data busy
>>>>> end
>>>>> +        * interrupt can be generate, the command will be finished when
>>>>> date
>>>>> +        * transfer complete or busy state end. Sometimes this will
>>>>> expend
>>>>> +        * more than 10*HZ, In this case whe should wait longer to detect
>>>>> +        * command complete timeout err.
>>>>> +        */
>>>>> +       if ((host->cmd->flags & MMC_RSP_BUSY) &&
>>>>> +                       !(host->quirks & SDHCI_QUIRK_NO_BUSY_IRQ))
>>>>> +               timer = 1000;
>>>>> +
>>>>> +       mod_timer(&host->timer, jiffies + timer * HZ);
>>>> haojun, do you mean we need to wait for 1 minutes and 40 seconds for
>>>> timeout? it seems it is too large for a kernel.
>>> 1000 * HZ = 1000 * 1 / 250 = 4000ms, about 4s. On my platform.
>> no. pls note the unit is jiffy not ms.
> Haijun, you refer to kernel/time.c
Yes, thanks Chung and barry.
You are right. In case 4000ms = jiffies + 1000 = 4 * HZ(250).
I'll recheck on my platform.

Many thanks.
>
> Best Regards,
> Jaehoon Chung
>>>>>           host->cmd = cmd;
>>>>>
>>>>> --
>>>>> 1.8.0
>>>>>
>>>> -barry
>>>>
>>>
>>> --
>>> Thanks & Regards
>>>
>>> Haijun
>>>
>>>
>> -barry
>> --
>> 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
>>
>


-- 
Thanks & Regards

Haijun



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-08-09  9:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-09  0:04 [PATCH V2] mmc:sdhci: Wait longer for command with busy flags Haijun Zhang
2013-08-09  6:39 ` Barry Song
2013-08-09  6:47   ` Zhang Haijun
2013-08-09  8:30     ` Barry Song
2013-08-09  8:53       ` Jaehoon Chung
2013-08-09  9:07         ` Zhang Haijun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox