public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] mmc: sdhci: tegra: fix wrong unit with busy_timeout
@ 2020-11-13 12:53 Wolfram Sang
  2020-11-13 16:38 ` Thierry Reding
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2020-11-13 12:53 UTC (permalink / raw)
  To: linux-mmc
  Cc: Wolfram Sang, Adrian Hunter, Ulf Hansson, Thierry Reding,
	Jonathan Hunter, linux-tegra

'busy_timeout' is in msecs, not in jiffies. Use the correct factor.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Not tested. Found by code investigation about 'busy_timeout'. A quick
grep showed no other problematic code within the MMC host drivers.

 drivers/mmc/host/sdhci-tegra.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index ed12aacb1c73..ad0dc3adc7d1 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -1272,7 +1272,7 @@ static void tegra_sdhci_set_timeout(struct sdhci_host *host,
 	 * busy wait mode.
 	 */
 	val = sdhci_readl(host, SDHCI_TEGRA_VENDOR_MISC_CTRL);
-	if (cmd && cmd->busy_timeout >= 11 * HZ)
+	if (cmd && cmd->busy_timeout >= 11 * MSECS_PER_SEC)
 		val |= SDHCI_MISC_CTRL_ERASE_TIMEOUT_LIMIT;
 	else
 		val &= ~SDHCI_MISC_CTRL_ERASE_TIMEOUT_LIMIT;
-- 
2.28.0


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

* Re: [RFC PATCH] mmc: sdhci: tegra: fix wrong unit with busy_timeout
  2020-11-13 12:53 [RFC PATCH] mmc: sdhci: tegra: fix wrong unit with busy_timeout Wolfram Sang
@ 2020-11-13 16:38 ` Thierry Reding
  2020-11-13 18:34   ` Sowjanya Komatineni
  0 siblings, 1 reply; 5+ messages in thread
From: Thierry Reding @ 2020-11-13 16:38 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-mmc, Adrian Hunter, Ulf Hansson, Jonathan Hunter,
	linux-tegra, Sowjanya Komatineni

[-- Attachment #1: Type: text/plain, Size: 1126 bytes --]

On Fri, Nov 13, 2020 at 01:53:30PM +0100, Wolfram Sang wrote:
> 'busy_timeout' is in msecs, not in jiffies. Use the correct factor.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> 
> Not tested. Found by code investigation about 'busy_timeout'. A quick
> grep showed no other problematic code within the MMC host drivers.
> 
>  drivers/mmc/host/sdhci-tegra.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Sowjanya, can you take a look at this?

Thierry

> diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
> index ed12aacb1c73..ad0dc3adc7d1 100644
> --- a/drivers/mmc/host/sdhci-tegra.c
> +++ b/drivers/mmc/host/sdhci-tegra.c
> @@ -1272,7 +1272,7 @@ static void tegra_sdhci_set_timeout(struct sdhci_host *host,
>  	 * busy wait mode.
>  	 */
>  	val = sdhci_readl(host, SDHCI_TEGRA_VENDOR_MISC_CTRL);
> -	if (cmd && cmd->busy_timeout >= 11 * HZ)
> +	if (cmd && cmd->busy_timeout >= 11 * MSECS_PER_SEC)
>  		val |= SDHCI_MISC_CTRL_ERASE_TIMEOUT_LIMIT;
>  	else
>  		val &= ~SDHCI_MISC_CTRL_ERASE_TIMEOUT_LIMIT;
> -- 
> 2.28.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [RFC PATCH] mmc: sdhci: tegra: fix wrong unit with busy_timeout
  2020-11-13 16:38 ` Thierry Reding
@ 2020-11-13 18:34   ` Sowjanya Komatineni
  2020-11-13 19:57     ` Thierry Reding
  0 siblings, 1 reply; 5+ messages in thread
From: Sowjanya Komatineni @ 2020-11-13 18:34 UTC (permalink / raw)
  To: Thierry Reding, Wolfram Sang
  Cc: linux-mmc, Adrian Hunter, Ulf Hansson, Jonathan Hunter,
	linux-tegra


On 11/13/20 8:38 AM, Thierry Reding wrote:
> On Fri, Nov 13, 2020 at 01:53:30PM +0100, Wolfram Sang wrote:
>> 'busy_timeout' is in msecs, not in jiffies. Use the correct factor.
>>
>> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
>> ---
>>
>> Not tested. Found by code investigation about 'busy_timeout'. A quick
>> grep showed no other problematic code within the MMC host drivers.
>>
>>   drivers/mmc/host/sdhci-tegra.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
> Sowjanya, can you take a look at this?
>
> Thierry

Thanks Wolfram.

Right cmd busy_timeout is in msec and we have to enable 
ERASE_TIMEOUT_LIMIT bit for more than 11s busy operations.

So it should be MSEC_PER_SEC.

>
>> diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
>> index ed12aacb1c73..ad0dc3adc7d1 100644
>> --- a/drivers/mmc/host/sdhci-tegra.c
>> +++ b/drivers/mmc/host/sdhci-tegra.c
>> @@ -1272,7 +1272,7 @@ static void tegra_sdhci_set_timeout(struct sdhci_host *host,
>>   	 * busy wait mode.
>>   	 */
>>   	val = sdhci_readl(host, SDHCI_TEGRA_VENDOR_MISC_CTRL);
>> -	if (cmd && cmd->busy_timeout >= 11 * HZ)
>> +	if (cmd && cmd->busy_timeout >= 11 * MSECS_PER_SEC)
>>   		val |= SDHCI_MISC_CTRL_ERASE_TIMEOUT_LIMIT;
>>   	else
>>   		val &= ~SDHCI_MISC_CTRL_ERASE_TIMEOUT_LIMIT;
>> -- 
>> 2.28.0

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

* Re: [RFC PATCH] mmc: sdhci: tegra: fix wrong unit with busy_timeout
  2020-11-13 18:34   ` Sowjanya Komatineni
@ 2020-11-13 19:57     ` Thierry Reding
  2020-11-14  0:15       ` Wolfram Sang
  0 siblings, 1 reply; 5+ messages in thread
From: Thierry Reding @ 2020-11-13 19:57 UTC (permalink / raw)
  To: Sowjanya Komatineni
  Cc: Wolfram Sang, linux-mmc, Adrian Hunter, Ulf Hansson,
	Jonathan Hunter, linux-tegra

[-- Attachment #1: Type: text/plain, Size: 1172 bytes --]

On Fri, Nov 13, 2020 at 10:34:27AM -0800, Sowjanya Komatineni wrote:
> 
> On 11/13/20 8:38 AM, Thierry Reding wrote:
> > On Fri, Nov 13, 2020 at 01:53:30PM +0100, Wolfram Sang wrote:
> > > 'busy_timeout' is in msecs, not in jiffies. Use the correct factor.
> > > 
> > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> > > ---
> > > 
> > > Not tested. Found by code investigation about 'busy_timeout'. A quick
> > > grep showed no other problematic code within the MMC host drivers.
> > > 
> > >   drivers/mmc/host/sdhci-tegra.c | 2 +-
> > >   1 file changed, 1 insertion(+), 1 deletion(-)
> > Sowjanya, can you take a look at this?
> > 
> > Thierry
> 
> Thanks Wolfram.
> 
> Right cmd busy_timeout is in msec and we have to enable ERASE_TIMEOUT_LIMIT
> bit for more than 11s busy operations.
> 
> So it should be MSEC_PER_SEC.

Great, thanks!

Acked-by: Thierry Reding <treding@nvidia.com>

And perhaps also:

Fixes: 5e958e4aacf4 ("sdhci: tegra: Implement Tegra specific set_timeout callback")

Not sure it's worth adding the latter because this has been in Linux
since 5.7 and I haven't heard of any issues.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [RFC PATCH] mmc: sdhci: tegra: fix wrong unit with busy_timeout
  2020-11-13 19:57     ` Thierry Reding
@ 2020-11-14  0:15       ` Wolfram Sang
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2020-11-14  0:15 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Sowjanya Komatineni, linux-mmc, Adrian Hunter, Ulf Hansson,
	Jonathan Hunter, linux-tegra

[-- Attachment #1: Type: text/plain, Size: 284 bytes --]


> Great, thanks!
> 
> Acked-by: Thierry Reding <treding@nvidia.com>
> 
> And perhaps also:
> 
> Fixes: 5e958e4aacf4 ("sdhci: tegra: Implement Tegra specific set_timeout callback")

Thanks! I will check a build report I got (privately) and resend this as
a proper patch.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2020-11-14  0:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-13 12:53 [RFC PATCH] mmc: sdhci: tegra: fix wrong unit with busy_timeout Wolfram Sang
2020-11-13 16:38 ` Thierry Reding
2020-11-13 18:34   ` Sowjanya Komatineni
2020-11-13 19:57     ` Thierry Reding
2020-11-14  0:15       ` Wolfram Sang

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