OMAP2/3 GPTIMER: minor optimizations
Subsystems (2)
cover OMAP2/3 GPTIMER: minor optimizations
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(-)
PATCH 1/2 OMAP2/3 GPTIMER: drop redundant pending write check
omap_dm_timer_write_reg() already waits for pending writes to complete, so the extra wait in omap_dm_timer_set_load() is superfluous.
--- arch/arm/plat-omap/dmtimer.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
arch/arm/plat-omap/dmtimer.c +0 -4
@@ -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 ); }
PATCH 2/2 OMAP2/3 GPTIMER: skip unnecessary TLDR write during non-autoreload
In reply to Paul WalmsleyThe 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.
--- arch/arm/plat-omap/dmtimer.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
arch/arm/plat-omap/dmtimer.c +4 -3
@@ -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); }
RE: [PATCH 2/2] OMAP2/3 GPTIMER: skip unnecessary TLDR write during non-autoreload
Quoted 4 lines
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.
Re: [PATCH 2/2] OMAP2/3 GPTIMER: skip unnecessary TLDR write during non-autoreload
Quoted 8 lines · Woodruff, Richard
Quoted 4 lines
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
RE: [PATCH 2/2] OMAP2/3 GPTIMER: skip unnecessary TLDR write during non-autoreload
Quoted 6 lines · Woodruff, Richard
Quoted 5 lines
Quoted 4 lines
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);}
Quoted 8 lines
Quoted 1 line
I seem to recall there was a missed interrupt condition which this worked
around.
Quoted 2 lines
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.
Re: [PATCH 2/2] OMAP2/3 GPTIMER: skip unnecessary TLDR write during non-autoreload
Quoted 9 lines · Woodruff, Richard
Quoted 9 lines · Woodruff, Richard
Quoted 6 lines
Quoted 4 lines
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.
Quoted 1 line
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
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
Kevin Hilman
Acked-byRe: [PATCH 2/2] OMAP2/3 GPTIMER: skip unnecessary TLDR write during non-autoreload
In reply to Woodruff, RichardQuoted 10 lines · Richard
Quoted 10 lines · Woodruff, Richard
Quoted 6 lines
Quoted 4 lines
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.
Quoted 2 lines
IIRC, the original code didn't bother with the load I added back as a work
Quoted 8 lines
Quoted 4 lines
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.
Re: [PATCH 2/2] OMAP2/3 GPTIMER: skip unnecessary TLDR write during non-autoreload
Quoted 21 lines · Kevin Hilman
Quoted 10 lines · Richard
Quoted 10 lines · Woodruff, Richard
Quoted 6 lines
Quoted 4 lines
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.
Quoted 2 lines
IIRC, the original code didn't bother with the load I added back as a work
Quoted 8 lines
Quoted 4 lines
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...
Quoted 7 lines
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 <[email protected]>
Thanks for testing, pushing them to l-o today and adding to omap2-upstream queue.
Regards,
Tony