public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci: clear interrupt when retune interrupt received
@ 2017-06-08 18:51 Troy Kisky
  2017-06-09 12:46 ` Adrian Hunter
  0 siblings, 1 reply; 5+ messages in thread
From: Troy Kisky @ 2017-06-08 18:51 UTC (permalink / raw)
  To: aisheng.dong, adrian.hunter
  Cc: ulf.hansson, linux-mmc, fabio.estevam, gary.bisson, Troy Kisky

This lets the loop exit before max_loops reaches 0.

Fixes: f37b20ebc4bc ("mmc: sdhci: add standard hw auto retuning support")

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
---
 drivers/mmc/host/sdhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index ecd0d43..e104194 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2687,7 +2687,7 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id)
 
 		/* Clear selected interrupts. */
 		mask = intmask & (SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK |
-				  SDHCI_INT_BUS_POWER);
+				  SDHCI_INT_BUS_POWER | SDHCI_INT_RETUNE);
 		sdhci_writel(host, mask, SDHCI_INT_STATUS);
 
 		if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) {
-- 
2.7.4


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

* Re: [PATCH] mmc: sdhci: clear interrupt when retune interrupt received
  2017-06-08 18:51 [PATCH] mmc: sdhci: clear interrupt when retune interrupt received Troy Kisky
@ 2017-06-09 12:46 ` Adrian Hunter
  2017-06-09 15:45   ` Troy Kisky
  0 siblings, 1 reply; 5+ messages in thread
From: Adrian Hunter @ 2017-06-09 12:46 UTC (permalink / raw)
  To: Troy Kisky, aisheng.dong
  Cc: ulf.hansson, linux-mmc, fabio.estevam, gary.bisson

On 08/06/17 21:51, Troy Kisky wrote:
> This lets the loop exit before max_loops reaches 0.

Needs more explanation.

> 
> Fixes: f37b20ebc4bc ("mmc: sdhci: add standard hw auto retuning support")
> 
> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> ---
>  drivers/mmc/host/sdhci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index ecd0d43..e104194 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2687,7 +2687,7 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id)
>  
>  		/* Clear selected interrupts. */
>  		mask = intmask & (SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK |
> -				  SDHCI_INT_BUS_POWER);
> +				  SDHCI_INT_BUS_POWER | SDHCI_INT_RETUNE);

SDHCI_INT_RETUNE is defined to be read-only so why write to it.

>  		sdhci_writel(host, mask, SDHCI_INT_STATUS);
>  
>  		if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) {
> 


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

* Re: [PATCH] mmc: sdhci: clear interrupt when retune interrupt received
  2017-06-09 12:46 ` Adrian Hunter
@ 2017-06-09 15:45   ` Troy Kisky
  2017-06-12 12:33     ` Adrian Hunter
  0 siblings, 1 reply; 5+ messages in thread
From: Troy Kisky @ 2017-06-09 15:45 UTC (permalink / raw)
  To: Adrian Hunter, aisheng.dong
  Cc: ulf.hansson, linux-mmc, fabio.estevam, gary.bisson

On 6/9/2017 5:46 AM, Adrian Hunter wrote:
> On 08/06/17 21:51, Troy Kisky wrote:
>> This lets the loop exit before max_loops reaches 0.
> 
> Needs more explanation.
> 
>>
>> Fixes: f37b20ebc4bc ("mmc: sdhci: add standard hw auto retuning support")
>>
>> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
>> ---
>>  drivers/mmc/host/sdhci.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
>> index ecd0d43..e104194 100644
>> --- a/drivers/mmc/host/sdhci.c
>> +++ b/drivers/mmc/host/sdhci.c
>> @@ -2687,7 +2687,7 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id)
>>  
>>  		/* Clear selected interrupts. */
>>  		mask = intmask & (SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK |
>> -				  SDHCI_INT_BUS_POWER);
>> +				  SDHCI_INT_BUS_POWER | SDHCI_INT_RETUNE);
> 
> SDHCI_INT_RETUNE is defined to be read-only so why write to it.


SDHCI_INT_RETUNE is bit 12
host/sdhci.h:#define  SDHCI_INT_RETUNE  0x00001000

Which at least from i.mx6/i.mx7 reference manuals, is a write 1 to clear bit(marked as w1c).



> 
>>  		sdhci_writel(host, mask, SDHCI_INT_STATUS);
>>  
>>  		if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) {
>>
> 
> 


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

* Re: [PATCH] mmc: sdhci: clear interrupt when retune interrupt received
  2017-06-09 15:45   ` Troy Kisky
@ 2017-06-12 12:33     ` Adrian Hunter
  2017-06-12 14:03       ` A.S. Dong
  0 siblings, 1 reply; 5+ messages in thread
From: Adrian Hunter @ 2017-06-12 12:33 UTC (permalink / raw)
  To: Troy Kisky, aisheng.dong
  Cc: ulf.hansson, linux-mmc, fabio.estevam, gary.bisson

On 09/06/17 18:45, Troy Kisky wrote:
> On 6/9/2017 5:46 AM, Adrian Hunter wrote:
>> On 08/06/17 21:51, Troy Kisky wrote:
>>> This lets the loop exit before max_loops reaches 0.
>>
>> Needs more explanation.
>>
>>>
>>> Fixes: f37b20ebc4bc ("mmc: sdhci: add standard hw auto retuning support")
>>>
>>> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
>>> ---
>>>  drivers/mmc/host/sdhci.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
>>> index ecd0d43..e104194 100644
>>> --- a/drivers/mmc/host/sdhci.c
>>> +++ b/drivers/mmc/host/sdhci.c
>>> @@ -2687,7 +2687,7 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id)
>>>  
>>>  		/* Clear selected interrupts. */
>>>  		mask = intmask & (SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK |
>>> -				  SDHCI_INT_BUS_POWER);
>>> +				  SDHCI_INT_BUS_POWER | SDHCI_INT_RETUNE);
>>
>> SDHCI_INT_RETUNE is defined to be read-only so why write to it.
> 
> 
> SDHCI_INT_RETUNE is bit 12
> host/sdhci.h:#define  SDHCI_INT_RETUNE  0x00001000
> 
> Which at least from i.mx6/i.mx7 reference manuals, is a write 1 to clear bit(marked as w1c).

So it doesn't work the way it is specified in the SDHCI spec.

It should be harmless to write 1, but you still need to explain how the bit
works on your hardware.  What does "This lets the loop exit before max_loops
reaches 0" mean?

> 
> 
> 
>>
>>>  		sdhci_writel(host, mask, SDHCI_INT_STATUS);
>>>  
>>>  		if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) {
>>>
>>
>>
> 
> 


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

* RE: [PATCH] mmc: sdhci: clear interrupt when retune interrupt received
  2017-06-12 12:33     ` Adrian Hunter
@ 2017-06-12 14:03       ` A.S. Dong
  0 siblings, 0 replies; 5+ messages in thread
From: A.S. Dong @ 2017-06-12 14:03 UTC (permalink / raw)
  To: Adrian Hunter, Troy Kisky
  Cc: ulf.hansson@linaro.org, linux-mmc@vger.kernel.org, Fabio Estevam,
	gary.bisson@boundarydevices.com

> -----Original Message-----
> From: Adrian Hunter [mailto:adrian.hunter@intel.com]
> Sent: Monday, June 12, 2017 8:34 PM
> To: Troy Kisky; A.S. Dong
> Cc: ulf.hansson@linaro.org; linux-mmc@vger.kernel.org; Fabio Estevam;
> gary.bisson@boundarydevices.com
> Subject: Re: [PATCH] mmc: sdhci: clear interrupt when retune interrupt
> received
> 
> On 09/06/17 18:45, Troy Kisky wrote:
> > On 6/9/2017 5:46 AM, Adrian Hunter wrote:
> >> On 08/06/17 21:51, Troy Kisky wrote:
> >>> This lets the loop exit before max_loops reaches 0.
> >>
> >> Needs more explanation.
> >>
> >>>
> >>> Fixes: f37b20ebc4bc ("mmc: sdhci: add standard hw auto retuning
> >>> support")
> >>>
> >>> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> >>> ---
> >>>  drivers/mmc/host/sdhci.c | 2 +-
> >>>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> >>> index ecd0d43..e104194 100644
> >>> --- a/drivers/mmc/host/sdhci.c
> >>> +++ b/drivers/mmc/host/sdhci.c
> >>> @@ -2687,7 +2687,7 @@ static irqreturn_t sdhci_irq(int irq, void
> >>> *dev_id)
> >>>
> >>>  		/* Clear selected interrupts. */
> >>>  		mask = intmask & (SDHCI_INT_CMD_MASK | SDHCI_INT_DATA_MASK |
> >>> -				  SDHCI_INT_BUS_POWER);
> >>> +				  SDHCI_INT_BUS_POWER | SDHCI_INT_RETUNE);
> >>
> >> SDHCI_INT_RETUNE is defined to be read-only so why write to it.
> >
> >
> > SDHCI_INT_RETUNE is bit 12
> > host/sdhci.h:#define  SDHCI_INT_RETUNE  0x00001000
> >
> > Which at least from i.mx6/i.mx7 reference manuals, is a write 1 to clear
> bit(marked as w1c).
> 
> So it doesn't work the way it is specified in the SDHCI spec.
> 
> It should be harmless to write 1, but you still need to explain how the
> bit works on your hardware.  What does "This lets the loop exit before
> max_loops reaches 0" mean?
> 

Can't remember too much history.
Simply from code inspection, it seems without clear SDHCI_INT_RETUNE,
it will loop max_loops.

Not sure about ""This lets the loop exit before max_loops reaches 0" mean?"

Troy,
Would you help explain it?

Regards
Dong Aisheng

> >
> >
> >
> >>
> >>>  		sdhci_writel(host, mask, SDHCI_INT_STATUS);
> >>>
> >>>  		if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE))
> {
> >>>
> >>
> >>
> >
> >


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

end of thread, other threads:[~2017-06-12 14:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-08 18:51 [PATCH] mmc: sdhci: clear interrupt when retune interrupt received Troy Kisky
2017-06-09 12:46 ` Adrian Hunter
2017-06-09 15:45   ` Troy Kisky
2017-06-12 12:33     ` Adrian Hunter
2017-06-12 14:03       ` A.S. Dong

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