* [PATCH] arm/spear600: fix one-shot timer
@ 2012-02-21 22:19 Gilles Chanteperdrix
2012-02-22 4:30 ` Viresh Kumar
0 siblings, 1 reply; 4+ messages in thread
From: Gilles Chanteperdrix @ 2012-02-21 22:19 UTC (permalink / raw)
To: linux-arm-kernel
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.
Signed-off-by: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
---
arch/arm/plat-spear/time.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/arch/arm/plat-spear/time.c b/arch/arm/plat-spear/time.c
index 0c77e42..ac15ff3 100644
--- a/arch/arm/plat-spear/time.c
+++ b/arch/arm/plat-spear/time.c
@@ -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));
--
1.7.2.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] arm/spear600: fix one-shot timer
2012-02-21 22:19 [PATCH] arm/spear600: fix one-shot timer Gilles Chanteperdrix
@ 2012-02-22 4:30 ` Viresh Kumar
2012-02-22 10:18 ` [PATCH v2] " Gilles Chanteperdrix
0 siblings, 1 reply; 4+ messages in thread
From: Viresh Kumar @ 2012-02-22 4:30 UTC (permalink / raw)
To: linux-arm-kernel
On 2/22/2012 3:49 AM, Gilles Chanteperdrix wrote:
> diff --git a/arch/arm/plat-spear/time.c b/arch/arm/plat-spear/time.c
> index 0c77e42..ac15ff3 100644
> --- a/arch/arm/plat-spear/time.c
> +++ b/arch/arm/plat-spear/time.c
> @@ -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.
> + if ((val & CTRL_ENABLE))
no need of extra (). Did you run checkpatch? I believe checkpatch
reports such issues.
> + 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,
Acked-by: Viresh Kumar <viresh.kumar@st.com>
--
viresh
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] arm/spear600: fix one-shot timer
2012-02-22 4:30 ` Viresh Kumar
@ 2012-02-22 10:18 ` Gilles Chanteperdrix
2012-02-22 10:31 ` Stefan Roese
0 siblings, 1 reply; 4+ messages in thread
From: Gilles Chanteperdrix @ 2012-02-22 10:18 UTC (permalink / raw)
To: linux-arm-kernel
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.
Acked-by: Viresh Kumar <viresh.kumar@st.com>
Signed-off-by: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
---
arch/arm/plat-spear/time.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/arm/plat-spear/time.c b/arch/arm/plat-spear/time.c
index 0c77e42..abb5bde 100644
--- a/arch/arm/plat-spear/time.c
+++ b/arch/arm/plat-spear/time.c
@@ -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));
--
1.7.2.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] arm/spear600: fix one-shot timer
2012-02-22 10:18 ` [PATCH v2] " Gilles Chanteperdrix
@ 2012-02-22 10:31 ` Stefan Roese
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2012-02-22 10:31 UTC (permalink / raw)
To: linux-arm-kernel
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 with CONFIG_HIGH_RES_TIMERS.
>
> Fix this by stopping the timer at the beginning of this function.
>
> Acked-by: Viresh Kumar <viresh.kumar@st.com>
> Signed-off-by: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Acked-by: Stefan Roese <sr@denx.de>
Thanks,
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-02-22 10:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-21 22:19 [PATCH] arm/spear600: fix one-shot timer Gilles Chanteperdrix
2012-02-22 4:30 ` Viresh Kumar
2012-02-22 10:18 ` [PATCH v2] " Gilles Chanteperdrix
2012-02-22 10:31 ` Stefan Roese
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).