public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] OMAP2/3 GPTIMER: minor optimizations
@ 2008-10-14 17:27 Paul Walmsley
  2008-10-14 17:27 ` [PATCH 1/2] OMAP2/3 GPTIMER: drop redundant pending write check Paul Walmsley
  2008-10-14 17:27 ` [PATCH 2/2] OMAP2/3 GPTIMER: skip unnecessary TLDR write during non-autoreload Paul Walmsley
  0 siblings, 2 replies; 9+ messages in thread
From: Paul Walmsley @ 2008-10-14 17:27 UTC (permalink / raw)
  To: linux-omap

Hello,

these patches implement a few minor optimizations on the
omap_dm_timer_set_load() and omap_dm_timer_set_load_start() functions for
OMAP2/3.  Gory details in the patch descriptions.

Tested on 2430SDP and 3430SDP.


- Paul

---

  text    data     bss     dec     hex filename
3099539  135104  151144 3385787  33a9bb vmlinux.3430sdp.orig
3099539  135104  151144 3385787  33a9bb vmlinux.3430sdp

 arch/arm/plat-omap/dmtimer.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)


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

* [PATCH 1/2] OMAP2/3 GPTIMER: drop redundant pending write check
  2008-10-14 17:27 [PATCH 0/2] OMAP2/3 GPTIMER: minor optimizations Paul Walmsley
@ 2008-10-14 17:27 ` Paul Walmsley
  2008-10-14 17:27 ` [PATCH 2/2] OMAP2/3 GPTIMER: skip unnecessary TLDR write during non-autoreload Paul Walmsley
  1 sibling, 0 replies; 9+ messages in thread
From: Paul Walmsley @ 2008-10-14 17:27 UTC (permalink / raw)
  To: linux-omap; +Cc: Paul Walmsley, Richard Woodruff

omap_dm_timer_write_reg() already waits for pending writes to complete,
so the extra wait in omap_dm_timer_set_load() is superfluous.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Richard Woodruff <r-woodruff2@ti.com>
---
 arch/arm/plat-omap/dmtimer.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 167ec2f..59be3aa 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -539,10 +539,6 @@ void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload,
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load);
 
-	/* REVISIT: hw feature, ttgr overtaking tldr? */
-	while (readl(timer->io_base + (OMAP_TIMER_WRITE_PEND_REG & 0xff)))
-		cpu_relax();
-
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 0);
 }
 



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

* [PATCH 2/2] OMAP2/3 GPTIMER: skip unnecessary TLDR write during non-autoreload
  2008-10-14 17:27 [PATCH 0/2] OMAP2/3 GPTIMER: minor optimizations Paul Walmsley
  2008-10-14 17:27 ` [PATCH 1/2] OMAP2/3 GPTIMER: drop redundant pending write check Paul Walmsley
@ 2008-10-14 17:27 ` Paul Walmsley
  2008-10-14 19:13   ` Woodruff, Richard
  1 sibling, 1 reply; 9+ messages in thread
From: Paul Walmsley @ 2008-10-14 17:27 UTC (permalink / raw)
  To: linux-omap; +Cc: Paul Walmsley, Richard Woodruff

The GPTIMER TLDR register does not need to be written if the GPTIMER
is not in autoreload mode.  This is the usual case for dynamic tick-enabled
kernels.

Simulation data indicate that skipping the read that occurs as part of
the write should save at least 300-320 ns for each GPTIMER1 timer
reprogram.  (This assumes L4-Wakeup is at 19MHz and GPTIMER write
posting is enabled.)  Skipping the write itself probably won't have
much impact since it should be posted on the OCP interconnect.

Tested on 2430SDP and 3430SDP.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Richard Woodruff <r-woodruff2@ti.com>
---
 arch/arm/plat-omap/dmtimer.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
index 59be3aa..08028f6 100644
--- a/arch/arm/plat-omap/dmtimer.c
+++ b/arch/arm/plat-omap/dmtimer.c
@@ -549,14 +549,15 @@ void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload,
 	u32 l;
 
 	l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
-	if (autoreload)
+	if (autoreload) {
 		l |= OMAP_TIMER_CTRL_AR;
-	else
+		omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load);
+	} else {
 		l &= ~OMAP_TIMER_CTRL_AR;
+	}
 	l |= OMAP_TIMER_CTRL_ST;
 
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, load);
-	omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load);
 	omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
 }
 



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

* RE: [PATCH 2/2] OMAP2/3 GPTIMER: skip unnecessary TLDR write during non-autoreload
  2008-10-14 17:27 ` [PATCH 2/2] OMAP2/3 GPTIMER: skip unnecessary TLDR write during non-autoreload Paul Walmsley
@ 2008-10-14 19:13   ` Woodruff, Richard
  2008-11-21 22:22     ` Tony Lindgren
  0 siblings, 1 reply; 9+ messages in thread
From: Woodruff, Richard @ 2008-10-14 19:13 UTC (permalink / raw)
  To: Paul Walmsley, linux-omap@vger.kernel.org

>       omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, load);
> -     omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load);
>       omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
>  }

I seem to recall there was a missed interrupt condition which this worked around.

IIRC, the original code didn't bother with the load I added back as a work around as a way to get posted mode working.

Regards,
Richard W.

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

* Re: [PATCH 2/2] OMAP2/3 GPTIMER: skip unnecessary TLDR write during non-autoreload
  2008-10-14 19:13   ` Woodruff, Richard
@ 2008-11-21 22:22     ` Tony Lindgren
  2008-11-21 22:53       ` Woodruff, Richard
  0 siblings, 1 reply; 9+ messages in thread
From: Tony Lindgren @ 2008-11-21 22:22 UTC (permalink / raw)
  To: Woodruff, Richard; +Cc: Paul Walmsley, linux-omap@vger.kernel.org

* Woodruff, Richard <r-woodruff2@ti.com> [081014 12:47]:
> >       omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, load);
> > -     omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load);
> >       omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
> >  }
> 
> I seem to recall there was a missed interrupt condition which this worked around.
> 
> IIRC, the original code didn't bother with the load I added back as a work around as a way to get posted mode working.

Well these seem to be working based on some quick timer tests.
Pushing so we can verify it ;)

Tony

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

* RE: [PATCH 2/2] OMAP2/3 GPTIMER: skip unnecessary TLDR write during non-autoreload
  2008-11-21 22:22     ` Tony Lindgren
@ 2008-11-21 22:53       ` Woodruff, Richard
  2008-11-21 23:53         ` Tony Lindgren
  2008-11-26 18:39         ` Kevin Hilman
  0 siblings, 2 replies; 9+ messages in thread
From: Woodruff, Richard @ 2008-11-21 22:53 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Paul Walmsley, linux-omap@vger.kernel.org

> * Woodruff, Richard <r-woodruff2@ti.com> [081014 12:47]:
> > >       omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, load);
> > > -     omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load);
> > >       omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
> > >  }
> >
> > I seem to recall there was a missed interrupt condition which this worked
> around.
> >
> > IIRC, the original code didn't bother with the load I added back as a work
> around as a way to get posted mode working.
>
> Well these seem to be working based on some quick timer tests.
> Pushing so we can verify it ;)

This kind of change might be better tested on the PM branch.  It's the kind of thing more likely to work with PM disabled.  Testing in both is good, PM for many things is less forgiving...

Regards,
Richard W.


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

* Re: [PATCH 2/2] OMAP2/3 GPTIMER: skip unnecessary TLDR write during non-autoreload
  2008-11-21 22:53       ` Woodruff, Richard
@ 2008-11-21 23:53         ` Tony Lindgren
  2008-11-26 18:39         ` Kevin Hilman
  1 sibling, 0 replies; 9+ messages in thread
From: Tony Lindgren @ 2008-11-21 23:53 UTC (permalink / raw)
  To: Woodruff, Richard; +Cc: Paul Walmsley, linux-omap@vger.kernel.org, Kevin Hilman

* Woodruff, Richard <r-woodruff2@ti.com> [081121 14:53]:
> > * Woodruff, Richard <r-woodruff2@ti.com> [081014 12:47]:
> > > >       omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, load);
> > > > -     omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load);
> > > >       omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
> > > >  }
> > >
> > > I seem to recall there was a missed interrupt condition which this worked
> > around.
> > >
> > > IIRC, the original code didn't bother with the load I added back as a work
> > around as a way to get posted mode working.
> >
> > Well these seem to be working based on some quick timer tests.
> > Pushing so we can verify it ;)
> 
> This kind of change might be better tested on the PM branch.  It's the kind of thing more likely to work with PM disabled.  Testing in both is good, PM for many things is less forgiving...

OK, let's not push them yet then. Kevin promised to run some timer
tests on them on Monday, so let's wait for that.

Regards,

Tony

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

* Re: [PATCH 2/2] OMAP2/3 GPTIMER: skip unnecessary TLDR write during non-autoreload
  2008-11-21 22:53       ` Woodruff, Richard
  2008-11-21 23:53         ` Tony Lindgren
@ 2008-11-26 18:39         ` Kevin Hilman
  2008-11-26 18:49           ` Tony Lindgren
  1 sibling, 1 reply; 9+ messages in thread
From: Kevin Hilman @ 2008-11-26 18:39 UTC (permalink / raw)
  To: Woodruff, Richard
  Cc: Tony Lindgren, Paul Walmsley, linux-omap@vger.kernel.org

"Woodruff, Richard" <r-woodruff2@ti.com> writes:

>> * Woodruff, Richard <r-woodruff2@ti.com> [081014 12:47]:
>> > >       omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, load);
>> > > -     omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load);
>> > >       omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
>> > >  }
>> >
>> > I seem to recall there was a missed interrupt condition which this worked
>> around.
>> >
>> > IIRC, the original code didn't bother with the load I added back as a work
>> around as a way to get posted mode working.
>>
>> Well these seem to be working based on some quick timer tests.
>> Pushing so we can verify it ;)
>
> This kind of change might be better tested on the PM branch.  It's
> the kind of thing more likely to work with PM disabled.  Testing in
> both is good, PM for many things is less forgiving...

I validated these patches on the PM branch.

I used cyclictest to test lots of timer reprogramming, and also tested
in both RET-while-idle and OFF-while-idle for low frequency timer
reprogramming.

Acked-by: Kevin Hilman <khilman@deeprootsystems.com>



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

* Re: [PATCH 2/2] OMAP2/3 GPTIMER: skip unnecessary TLDR write during non-autoreload
  2008-11-26 18:39         ` Kevin Hilman
@ 2008-11-26 18:49           ` Tony Lindgren
  0 siblings, 0 replies; 9+ messages in thread
From: Tony Lindgren @ 2008-11-26 18:49 UTC (permalink / raw)
  To: Kevin Hilman; +Cc: Woodruff, Richard, Paul Walmsley, linux-omap@vger.kernel.org

* Kevin Hilman <khilman@deeprootsystems.com> [081126 10:39]:
> "Woodruff, Richard" <r-woodruff2@ti.com> writes:
> 
> >> * Woodruff, Richard <r-woodruff2@ti.com> [081014 12:47]:
> >> > >       omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, load);
> >> > > -     omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load);
> >> > >       omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l);
> >> > >  }
> >> >
> >> > I seem to recall there was a missed interrupt condition which this worked
> >> around.
> >> >
> >> > IIRC, the original code didn't bother with the load I added back as a work
> >> around as a way to get posted mode working.
> >>
> >> Well these seem to be working based on some quick timer tests.
> >> Pushing so we can verify it ;)
> >
> > This kind of change might be better tested on the PM branch.  It's
> > the kind of thing more likely to work with PM disabled.  Testing in
> > both is good, PM for many things is less forgiving...
> 
> I validated these patches on the PM branch.
> 
> I used cyclictest to test lots of timer reprogramming, and also tested
> in both RET-while-idle and OFF-while-idle for low frequency timer
> reprogramming.
> 
> Acked-by: Kevin Hilman <khilman@deeprootsystems.com>

Thanks for testing, pushing them to l-o today and adding to
omap2-upstream queue.

Regards,

Tony

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

end of thread, other threads:[~2008-11-26 18:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-14 17:27 [PATCH 0/2] OMAP2/3 GPTIMER: minor optimizations Paul Walmsley
2008-10-14 17:27 ` [PATCH 1/2] OMAP2/3 GPTIMER: drop redundant pending write check Paul Walmsley
2008-10-14 17:27 ` [PATCH 2/2] OMAP2/3 GPTIMER: skip unnecessary TLDR write during non-autoreload Paul Walmsley
2008-10-14 19:13   ` Woodruff, Richard
2008-11-21 22:22     ` Tony Lindgren
2008-11-21 22:53       ` Woodruff, Richard
2008-11-21 23:53         ` Tony Lindgren
2008-11-26 18:39         ` Kevin Hilman
2008-11-26 18:49           ` Tony Lindgren

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