aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2015-06-18 06:54:26 -0400
committerDaniel Lezcano <daniel.lezcano@linaro.org>2015-08-10 05:40:32 -0400
commit37ae24716a584da33253cf6630a91c01b6656cc0 (patch)
treed6cdc17b3f3b050d8e3dcd4e3bf993322d98e317
parentd47409347e76ca5e7cdbbb515a9000878b5222cc (diff)
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: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-rw-r--r--drivers/clocksource/moxart_timer.c49
1 files changed, 26 insertions, 23 deletions
diff --git a/drivers/clocksource/moxart_timer.c b/drivers/clocksource/moxart_timer.c
index 5eb2c35932b1..19857af651c1 100644
--- a/drivers/clocksource/moxart_timer.c
+++ b/drivers/clocksource/moxart_timer.c
@@ -58,25 +58,24 @@
58static void __iomem *base; 58static void __iomem *base;
59static unsigned int clock_count_per_tick; 59static unsigned int clock_count_per_tick;
60 60
61static void moxart_clkevt_mode(enum clock_event_mode mode, 61static int moxart_shutdown(struct clock_event_device *evt)
62 struct clock_event_device *clk)
63{ 62{
64 switch (mode) { 63 writel(TIMER1_DISABLE, base + TIMER_CR);
65 case CLOCK_EVT_MODE_RESUME: 64 return 0;
66 case CLOCK_EVT_MODE_ONESHOT: 65}
67 writel(TIMER1_DISABLE, base + TIMER_CR); 66
68 writel(~0, base + TIMER1_BASE + REG_LOAD); 67static int moxart_set_oneshot(struct clock_event_device *evt)
69 break; 68{
70 case CLOCK_EVT_MODE_PERIODIC: 69 writel(TIMER1_DISABLE, base + TIMER_CR);
71 writel(clock_count_per_tick, base + TIMER1_BASE + REG_LOAD); 70 writel(~0, base + TIMER1_BASE + REG_LOAD);
72 writel(TIMER1_ENABLE, base + TIMER_CR); 71 return 0;
73 break; 72}
74 case CLOCK_EVT_MODE_UNUSED: 73
75 case CLOCK_EVT_MODE_SHUTDOWN: 74static int moxart_set_periodic(struct clock_event_device *evt)
76 default: 75{
77 writel(TIMER1_DISABLE, base + TIMER_CR); 76 writel(clock_count_per_tick, base + TIMER1_BASE + REG_LOAD);
78 break; 77 writel(TIMER1_ENABLE, base + TIMER_CR);
79 } 78 return 0;
80} 79}
81 80
82static int moxart_clkevt_next_event(unsigned long cycles, 81static int moxart_clkevt_next_event(unsigned long cycles,
@@ -95,11 +94,15 @@ static int moxart_clkevt_next_event(unsigned long cycles,
95} 94}
96 95
97static struct clock_event_device moxart_clockevent = { 96static struct clock_event_device moxart_clockevent = {
98 .name = "moxart_timer", 97 .name = "moxart_timer",
99 .rating = 200, 98 .rating = 200,
100 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 99 .features = CLOCK_EVT_FEAT_PERIODIC |
101 .set_mode = moxart_clkevt_mode, 100 CLOCK_EVT_FEAT_ONESHOT,
102 .set_next_event = moxart_clkevt_next_event, 101 .set_state_shutdown = moxart_shutdown,
102 .set_state_periodic = moxart_set_periodic,
103 .set_state_oneshot = moxart_set_oneshot,
104 .tick_resume = moxart_set_oneshot,
105 .set_next_event = moxart_clkevt_next_event,
103}; 106};
104 107
105static irqreturn_t moxart_timer_interrupt(int irq, void *dev_id) 108static irqreturn_t moxart_timer_interrupt(int irq, void *dev_id)