Hello Santosh,

On Sun, 10 Jan 2010, Shilimkar, Santosh wrote:

> > -----Original Message-----
> > From: [email protected] 
> > [mailto:[email protected]] On Behalf Of Kevin
> > Hilman
> > Sent: Friday, January 08, 2010 11:29 PM
> > To: [email protected]
> > Cc: Tero Kristo
> > Subject: [PATCH 01/13] OMAP2/3: DMTIMER: Clear pending interrupts when 
> > stopping a timer
> > 
> > From: Tero Kristo <[email protected]>
> > 
> > OMAP GP timers keep running for a few cycles after they are stopped,
> > which can cause the timer to expire and generate an interrupt. The pending
> > interrupt will prevent e.g. OMAP from entering suspend, thus we ack it
> > manually.
> > 
> > Signed-off-by: Tero Kristo <[email protected]>
> > Signed-off-by: Kevin Hilman <[email protected]>
> > ---
> >  arch/arm/plat-omap/dmtimer.c |   10 ++++++++++
> >  1 files changed, 10 insertions(+), 0 deletions(-)
> > 
> > diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
> > index 64f407e..5502ce8 100644
> > --- a/arch/arm/plat-omap/dmtimer.c
> > +++ b/arch/arm/plat-omap/dmtimer.c
> > @@ -551,6 +551,16 @@ void omap_dm_timer_stop(struct omap_dm_timer *timer)
> >     if (l & OMAP_TIMER_CTRL_ST) {
> >             l &= ~0x1;
> >             omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
> > +           /* Readback to make sure write has completed */
> > +           omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
> Hopefully compiler don't optimize your readback.

It can't - if it does, it is a gcc bug.  omap_dm_timer_read_reg() 
ultimately calls __raw_readl() which uses the 'volatile' keyword:

http://en.wikipedia.org/wiki/Volatile_variable

...

Separately from the compiler, one must also ensure that the ARM core 
itself does not cache the readback.  This is handled by mapping the 
GPTIMER memory space as MT_DEVICE in mach-omap2/io.c.  See also the 
MT_DEVICE section in arch/arm/mm/mmu.c.  Further details are in the ARMv7 
Architecture Reference Manual, section A3.5.5, "Device Memory".


- Paul
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to