Commit 37ae2471 authored by Viresh Kumar's avatar Viresh Kumar Committed by Daniel Lezcano

clockevents/drivers/moxart: Migrate to new 'set-state' interface

Migrate moxart driver to the new 'set-state' interface provided by
clockevents core, the earlier 'set-mode' interface is marked obsolete
now.

This also enables us to implement callbacks for new states of clockevent
devices, for example: ONESHOT_STOPPED.

Cc: Jonas Jensen <jonas.jensen@gmail.com>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
parent d4740934
...@@ -58,25 +58,24 @@ ...@@ -58,25 +58,24 @@
static void __iomem *base; static void __iomem *base;
static unsigned int clock_count_per_tick; static unsigned int clock_count_per_tick;
static void moxart_clkevt_mode(enum clock_event_mode mode, static int moxart_shutdown(struct clock_event_device *evt)
struct clock_event_device *clk) {
writel(TIMER1_DISABLE, base + TIMER_CR);
return 0;
}
static int moxart_set_oneshot(struct clock_event_device *evt)
{ {
switch (mode) {
case CLOCK_EVT_MODE_RESUME:
case CLOCK_EVT_MODE_ONESHOT:
writel(TIMER1_DISABLE, base + TIMER_CR); writel(TIMER1_DISABLE, base + TIMER_CR);
writel(~0, base + TIMER1_BASE + REG_LOAD); writel(~0, base + TIMER1_BASE + REG_LOAD);
break; return 0;
case CLOCK_EVT_MODE_PERIODIC: }
static int moxart_set_periodic(struct clock_event_device *evt)
{
writel(clock_count_per_tick, base + TIMER1_BASE + REG_LOAD); writel(clock_count_per_tick, base + TIMER1_BASE + REG_LOAD);
writel(TIMER1_ENABLE, base + TIMER_CR); writel(TIMER1_ENABLE, base + TIMER_CR);
break; return 0;
case CLOCK_EVT_MODE_UNUSED:
case CLOCK_EVT_MODE_SHUTDOWN:
default:
writel(TIMER1_DISABLE, base + TIMER_CR);
break;
}
} }
static int moxart_clkevt_next_event(unsigned long cycles, static int moxart_clkevt_next_event(unsigned long cycles,
...@@ -97,8 +96,12 @@ static int moxart_clkevt_next_event(unsigned long cycles, ...@@ -97,8 +96,12 @@ static int moxart_clkevt_next_event(unsigned long cycles,
static struct clock_event_device moxart_clockevent = { static struct clock_event_device moxart_clockevent = {
.name = "moxart_timer", .name = "moxart_timer",
.rating = 200, .rating = 200,
.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, .features = CLOCK_EVT_FEAT_PERIODIC |
.set_mode = moxart_clkevt_mode, CLOCK_EVT_FEAT_ONESHOT,
.set_state_shutdown = moxart_shutdown,
.set_state_periodic = moxart_set_periodic,
.set_state_oneshot = moxart_set_oneshot,
.tick_resume = moxart_set_oneshot,
.set_next_event = moxart_clkevt_next_event, .set_next_event = moxart_clkevt_next_event,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment