aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource/moxart_timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/clocksource/moxart_timer.c')
-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)