diff options
-rw-r--r-- | arch/arm/mach-omap2/timer-gp.c | 9 | ||||
-rw-r--r-- | arch/arm/plat-omap/dmtimer.c | 19 | ||||
-rw-r--r-- | include/asm-arm/arch-omap/dmtimer.h | 1 |
3 files changed, 22 insertions, 7 deletions
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c index 78d05f203fff..557603f99313 100644 --- a/arch/arm/mach-omap2/timer-gp.c +++ b/arch/arm/mach-omap2/timer-gp.c | |||
@@ -59,8 +59,7 @@ static struct irqaction omap2_gp_timer_irq = { | |||
59 | static int omap2_gp_timer_set_next_event(unsigned long cycles, | 59 | static int omap2_gp_timer_set_next_event(unsigned long cycles, |
60 | struct clock_event_device *evt) | 60 | struct clock_event_device *evt) |
61 | { | 61 | { |
62 | omap_dm_timer_set_load(gptimer, 0, 0xffffffff - cycles); | 62 | omap_dm_timer_set_load_start(gptimer, 0, 0xffffffff - cycles); |
63 | omap_dm_timer_start(gptimer); | ||
64 | 63 | ||
65 | return 0; | 64 | return 0; |
66 | } | 65 | } |
@@ -77,8 +76,7 @@ static void omap2_gp_timer_set_mode(enum clock_event_mode mode, | |||
77 | period = clk_get_rate(omap_dm_timer_get_fclk(gptimer)) / HZ; | 76 | period = clk_get_rate(omap_dm_timer_get_fclk(gptimer)) / HZ; |
78 | period -= 1; | 77 | period -= 1; |
79 | 78 | ||
80 | omap_dm_timer_set_load(gptimer, 1, 0xffffffff - period); | 79 | omap_dm_timer_set_load_start(gptimer, 1, 0xffffffff - period); |
81 | omap_dm_timer_start(gptimer); | ||
82 | break; | 80 | break; |
83 | case CLOCK_EVT_MODE_ONESHOT: | 81 | case CLOCK_EVT_MODE_ONESHOT: |
84 | break; | 82 | break; |
@@ -172,8 +170,7 @@ static void __init omap2_gp_clocksource_init(void) | |||
172 | tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gpt)); | 170 | tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gpt)); |
173 | tick_period = (tick_rate / HZ) - 1; | 171 | tick_period = (tick_rate / HZ) - 1; |
174 | 172 | ||
175 | omap_dm_timer_set_load(gpt, 1, 0); | 173 | omap_dm_timer_set_load_start(gpt, 1, 0); |
176 | omap_dm_timer_start(gpt); | ||
177 | 174 | ||
178 | clocksource_gpt.mult = | 175 | clocksource_gpt.mult = |
179 | clocksource_khz2mult(tick_rate/1000, clocksource_gpt.shift); | 176 | clocksource_khz2mult(tick_rate/1000, clocksource_gpt.shift); |
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index 822b6bb5c74c..f22506af0e67 100644 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c | |||
@@ -546,6 +546,24 @@ void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, | |||
546 | omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 0); | 546 | omap_dm_timer_write_reg(timer, OMAP_TIMER_TRIGGER_REG, 0); |
547 | } | 547 | } |
548 | 548 | ||
549 | /* Optimized set_load which removes costly spin wait in timer_start */ | ||
550 | void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload, | ||
551 | unsigned int load) | ||
552 | { | ||
553 | u32 l; | ||
554 | |||
555 | l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG); | ||
556 | if (autoreload) | ||
557 | l |= OMAP_TIMER_CTRL_AR; | ||
558 | else | ||
559 | l &= ~OMAP_TIMER_CTRL_AR; | ||
560 | l |= OMAP_TIMER_CTRL_ST; | ||
561 | |||
562 | omap_dm_timer_write_reg(timer, OMAP_TIMER_COUNTER_REG, load); | ||
563 | omap_dm_timer_write_reg(timer, OMAP_TIMER_LOAD_REG, load); | ||
564 | omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l); | ||
565 | } | ||
566 | |||
549 | void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, | 567 | void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, |
550 | unsigned int match) | 568 | unsigned int match) |
551 | { | 569 | { |
@@ -560,7 +578,6 @@ void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, | |||
560 | omap_dm_timer_write_reg(timer, OMAP_TIMER_MATCH_REG, match); | 578 | omap_dm_timer_write_reg(timer, OMAP_TIMER_MATCH_REG, match); |
561 | } | 579 | } |
562 | 580 | ||
563 | |||
564 | void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, | 581 | void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, |
565 | int toggle, int trigger) | 582 | int toggle, int trigger) |
566 | { | 583 | { |
diff --git a/include/asm-arm/arch-omap/dmtimer.h b/include/asm-arm/arch-omap/dmtimer.h index fefb276ed402..02b29e8437ae 100644 --- a/include/asm-arm/arch-omap/dmtimer.h +++ b/include/asm-arm/arch-omap/dmtimer.h | |||
@@ -66,6 +66,7 @@ void omap_dm_timer_stop(struct omap_dm_timer *timer); | |||
66 | 66 | ||
67 | void omap_dm_timer_set_source(struct omap_dm_timer *timer, int source); | 67 | void omap_dm_timer_set_source(struct omap_dm_timer *timer, int source); |
68 | void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, unsigned int value); | 68 | void omap_dm_timer_set_load(struct omap_dm_timer *timer, int autoreload, unsigned int value); |
69 | void omap_dm_timer_set_load_start(struct omap_dm_timer *timer, int autoreload, unsigned int value); | ||
69 | void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, unsigned int match); | 70 | void omap_dm_timer_set_match(struct omap_dm_timer *timer, int enable, unsigned int match); |
70 | void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, int toggle, int trigger); | 71 | void omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, int toggle, int trigger); |
71 | void omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler); | 72 | void omap_dm_timer_set_prescaler(struct omap_dm_timer *timer, int prescaler); |