arm/spear600: fix one-shot timer
Subsystems (2)
PATCH 1/1 arm/spear600: fix one-shot timer
Currently, the "clockevent_next_event" function only works correctly if the timer is not running when this function is called, which is not always the case when running with CONFIG_HIGH_RES_TIMERS.
Fix this by stopping the timer at the beginning of this function.
--- arch/arm/plat-spear/time.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
arch/arm/plat-spear/time.c +4 -1
@@ -147,9 +147,12 @@ static int clockevent_next_event(unsigned long cycles, {u16 val; + val =readw (gpt_base +CR (CLKEVT )); +if ((val &CTRL_ENABLE )) +writew (val & ~CTRL_ENABLE , gpt_base +CR (CLKEVT )); +writew (cycles, gpt_base +LOAD (CLKEVT )); - val =readw (gpt_base +CR (CLKEVT )); val |=CTRL_ENABLE |CTRL_INT_ENABLE ;writew (val, gpt_base +CR (CLKEVT ));
Signature · 1 line
1.7.2.5
PATCH 1/1 arm/spear600: fix one-shot timer
arch/arm/plat-spear/time.c static int clockevent_next_event(unsigned long cycles, · line 150
Quoted 9 lines · Gilles Chanteperdrix
arch/arm/plat-spear/time.c +1
-0@@ -147,9 +147,12 @@ static int clockevent_next_event(unsigned long cycles, {u16 val; + val =readw (gpt_base +CR (CLKEVT ));
can merge above three lines now.
arch/arm/plat-spear/time.c static int clockevent_next_event(unsigned long cycles, · line 151
Quoted 1 line
arch/arm/plat-spear/time.c +1
-0+if ((val &CTRL_ENABLE ))
no need of extra (). Did you run checkpatch? I believe checkpatch reports such issues.
arch/arm/plat-spear/time.c static int clockevent_next_event(unsigned long cycles, · line 157
Quoted 7 lines
arch/arm/plat-spear/time.c +2
-1+writew (val & ~CTRL_ENABLE , gpt_base +CR (CLKEVT )); +writew (cycles, gpt_base +LOAD (CLKEVT )); - val =readw (gpt_base +CR (CLKEVT )); val |=CTRL_ENABLE |CTRL_INT_ENABLE ;writew (val, gpt_base +CR (CLKEVT ));
Otherwise,
Signature · 1 line
viresh
PATCH v2 1/1 arm/spear600: fix one-shot timer
Currently, the "clockevent_next_event" function only works correctly if the timer is not running when this function is called, which is not always the case when running with CONFIG_HIGH_RES_TIMERS.
Fix this by stopping the timer at the beginning of this function.
--- arch/arm/plat-spear/time.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
arch/arm/plat-spear/time.c +4 -2
@@ -145,11 +145,13 @@ static void clockevent_set_mode(enum clock_event_mode mode,static int clockevent_next_event (unsigned long cycles,struct clock_event_device *clk_event_dev) { -u16 val; +u16 val =readw (gpt_base +CR (CLKEVT )); + +if (val &CTRL_ENABLE ) +writew (val & ~CTRL_ENABLE , gpt_base +CR (CLKEVT ));writew (cycles, gpt_base +LOAD (CLKEVT )); - val =readw (gpt_base +CR (CLKEVT )); val |=CTRL_ENABLE |CTRL_INT_ENABLE ;writew (val, gpt_base +CR (CLKEVT ));
Signature · 1 line
1.7.2.5
PATCH v2 1/1 arm/spear600: fix one-shot timer
Quoted 8 lines · On Wednesday 22 February 2012 11:18:12 Gilles Chanteperdrix wrote:
Currently, the "
clockevent_next_event" function only works correctly if the timer is not running when this function is called, which is not always the case when running withCONFIG_HIGH_RES_TIMERS.Fix this by stopping the timer at the beginning of this function.
Acked-by Viresh Kumar <[email protected]>Signed-off-by Gilles Chanteperdrix <[email protected]>
Thanks,
Stefan