linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: omap_hsmmc: clear status flags before starting a new command
@ 2013-06-29  6:25 Francesco Lavra
  2013-08-25  2:02 ` Chris Ball
  2013-08-25 19:39 ` Balaji T K
  0 siblings, 2 replies; 4+ messages in thread
From: Francesco Lavra @ 2013-06-29  6:25 UTC (permalink / raw)
  To: Balaji T K, Chris Ball, linux-mmc, linux-omap, linux-kernel

Commit 1f6b9fa40e76fffaaa0b3bd6a0bfdcf1cdc06efa consolidated writes to 
the STAT register in one location, moving them from omap_hsmmc_do_irq() 
to omap_hsmmc_irq(). This move has the unwanted side effect that the 
controller status flags are potentially cleared after a new command has 
been started as a consequence of reading the previous status flags. 
This means that if the new command changes the status flags before the 
IRQ routine returns, those flags may be cleared without handling the 
event which asserted them, and thus missing the event.
Move the writing of the STAT register back in omap_hsmmc_do_irq(), 
before handling the status flags which generated the interrupt.

Signed-off-by: Francesco Lavra <francescolavra.fl@gmail.com>
---
 drivers/mmc/host/omap_hsmmc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index eccedc7..301cb7e 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1041,6 +1041,7 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, int status)
 		}
 	}
 
+	OMAP_HSMMC_WRITE(host->base, STAT, status);
 	if (end_cmd || ((status & CC_EN) && host->cmd))
 		omap_hsmmc_cmd_done(host, host->cmd);
 	if ((end_trans || (status & TC_EN)) && host->mrq)
@@ -1060,7 +1061,6 @@ static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id)
 		omap_hsmmc_do_irq(host, status);
 
 		/* Flush posted write */
-		OMAP_HSMMC_WRITE(host->base, STAT, status);
 		status = OMAP_HSMMC_READ(host->base, STAT);
 	}
 
-- 
1.7.5.4

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

* Re: [PATCH] mmc: omap_hsmmc: clear status flags before starting a new command
  2013-06-29  6:25 [PATCH] mmc: omap_hsmmc: clear status flags before starting a new command Francesco Lavra
@ 2013-08-25  2:02 ` Chris Ball
  2013-08-25 19:39 ` Balaji T K
  1 sibling, 0 replies; 4+ messages in thread
From: Chris Ball @ 2013-08-25  2:02 UTC (permalink / raw)
  To: Francesco Lavra; +Cc: Balaji T K, linux-mmc, linux-omap, linux-kernel

Hi Balaji,

On Sat, Jun 29 2013, Francesco Lavra wrote:
> Commit 1f6b9fa40e76fffaaa0b3bd6a0bfdcf1cdc06efa consolidated writes to 
> the STAT register in one location, moving them from omap_hsmmc_do_irq() 
> to omap_hsmmc_irq(). This move has the unwanted side effect that the 
> controller status flags are potentially cleared after a new command has 
> been started as a consequence of reading the previous status flags. 
> This means that if the new command changes the status flags before the 
> IRQ routine returns, those flags may be cleared without handling the 
> event which asserted them, and thus missing the event.
> Move the writing of the STAT register back in omap_hsmmc_do_irq(), 
> before handling the status flags which generated the interrupt.
>
> Signed-off-by: Francesco Lavra <francescolavra.fl@gmail.com>
> ---
>  drivers/mmc/host/omap_hsmmc.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index eccedc7..301cb7e 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -1041,6 +1041,7 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, int status)
>  		}
>  	}
>  
> +	OMAP_HSMMC_WRITE(host->base, STAT, status);
>  	if (end_cmd || ((status & CC_EN) && host->cmd))
>  		omap_hsmmc_cmd_done(host, host->cmd);
>  	if ((end_trans || (status & TC_EN)) && host->mrq)
> @@ -1060,7 +1061,6 @@ static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id)
>  		omap_hsmmc_do_irq(host, status);
>  
>  		/* Flush posted write */
> -		OMAP_HSMMC_WRITE(host->base, STAT, status);
>  		status = OMAP_HSMMC_READ(host->base, STAT);
>  	}

Please could you review this patch?  Thanks,

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>

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

* Re: [PATCH] mmc: omap_hsmmc: clear status flags before starting a new command
  2013-06-29  6:25 [PATCH] mmc: omap_hsmmc: clear status flags before starting a new command Francesco Lavra
  2013-08-25  2:02 ` Chris Ball
@ 2013-08-25 19:39 ` Balaji T K
  2013-08-25 19:41   ` Chris Ball
  1 sibling, 1 reply; 4+ messages in thread
From: Balaji T K @ 2013-08-25 19:39 UTC (permalink / raw)
  To: Francesco Lavra; +Cc: Chris Ball, linux-mmc, linux-omap, linux-kernel

On Saturday 29 June 2013 11:55 AM, Francesco Lavra wrote:
> Commit 1f6b9fa40e76fffaaa0b3bd6a0bfdcf1cdc06efa consolidated writes to
> the STAT register in one location, moving them from omap_hsmmc_do_irq()
> to omap_hsmmc_irq(). This move has the unwanted side effect that the
> controller status flags are potentially cleared after a new command has
> been started as a consequence of reading the previous status flags.
> This means that if the new command changes the status flags before the
> IRQ routine returns, those flags may be cleared without handling the
> event which asserted them, and thus missing the event.
> Move the writing of the STAT register back in omap_hsmmc_do_irq(),
> before handling the status flags which generated the interrupt.
>
> Signed-off-by: Francesco Lavra <francescolavra.fl@gmail.com>

Reviewed and Tested-by: Balaji T K <balajitk@ti.com>

> ---
>   drivers/mmc/host/omap_hsmmc.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
> index eccedc7..301cb7e 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -1041,6 +1041,7 @@ static void omap_hsmmc_do_irq(struct omap_hsmmc_host *host, int status)
>   		}
>   	}
>
> +	OMAP_HSMMC_WRITE(host->base, STAT, status);
>   	if (end_cmd || ((status & CC_EN) && host->cmd))
>   		omap_hsmmc_cmd_done(host, host->cmd);
>   	if ((end_trans || (status & TC_EN)) && host->mrq)
> @@ -1060,7 +1061,6 @@ static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id)
>   		omap_hsmmc_do_irq(host, status);
>
>   		/* Flush posted write */
> -		OMAP_HSMMC_WRITE(host->base, STAT, status);
>   		status = OMAP_HSMMC_READ(host->base, STAT);
>   	}
>
>

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

* Re: [PATCH] mmc: omap_hsmmc: clear status flags before starting a new command
  2013-08-25 19:39 ` Balaji T K
@ 2013-08-25 19:41   ` Chris Ball
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Ball @ 2013-08-25 19:41 UTC (permalink / raw)
  To: Balaji T K; +Cc: Francesco Lavra, linux-mmc, linux-omap, linux-kernel

Hi,

On Sun, Aug 25 2013, Balaji T K wrote:
> On Saturday 29 June 2013 11:55 AM, Francesco Lavra wrote:
>> Commit 1f6b9fa40e76fffaaa0b3bd6a0bfdcf1cdc06efa consolidated writes to
>> the STAT register in one location, moving them from omap_hsmmc_do_irq()
>> to omap_hsmmc_irq(). This move has the unwanted side effect that the
>> controller status flags are potentially cleared after a new command has
>> been started as a consequence of reading the previous status flags.
>> This means that if the new command changes the status flags before the
>> IRQ routine returns, those flags may be cleared without handling the
>> event which asserted them, and thus missing the event.
>> Move the writing of the STAT register back in omap_hsmmc_do_irq(),
>> before handling the status flags which generated the interrupt.
>>
>> Signed-off-by: Francesco Lavra <francescolavra.fl@gmail.com>
>
> Reviewed and Tested-by: Balaji T K <balajitk@ti.com>

Thanks, pushed to mmc-next for 3.12.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>

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

end of thread, other threads:[~2013-08-25 19:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-29  6:25 [PATCH] mmc: omap_hsmmc: clear status flags before starting a new command Francesco Lavra
2013-08-25  2:02 ` Chris Ball
2013-08-25 19:39 ` Balaji T K
2013-08-25 19:41   ` Chris Ball

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).