aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource/time-orion.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/clocksource/time-orion.c')
-rw-r--r--drivers/clocksource/time-orion.c46
1 files changed, 26 insertions, 20 deletions
diff --git a/drivers/clocksource/time-orion.c b/drivers/clocksource/time-orion.c
index 0b3ce0399c51..0ece7427b497 100644
--- a/drivers/clocksource/time-orion.c
+++ b/drivers/clocksource/time-orion.c
@@ -60,30 +60,36 @@ static int orion_clkevt_next_event(unsigned long delta,
60 return 0; 60 return 0;
61} 61}
62 62
63static void orion_clkevt_mode(enum clock_event_mode mode, 63static int orion_clkevt_shutdown(struct clock_event_device *dev)
64 struct clock_event_device *dev)
65{ 64{
66 if (mode == CLOCK_EVT_MODE_PERIODIC) { 65 /* disable timer */
67 /* setup and enable periodic timer at 1/HZ intervals */ 66 atomic_io_modify(timer_base + TIMER_CTRL,
68 writel(ticks_per_jiffy - 1, timer_base + TIMER1_RELOAD); 67 TIMER1_RELOAD_EN | TIMER1_EN, 0);
69 writel(ticks_per_jiffy - 1, timer_base + TIMER1_VAL); 68 return 0;
70 atomic_io_modify(timer_base + TIMER_CTRL, 69}
71 TIMER1_RELOAD_EN | TIMER1_EN, 70
72 TIMER1_RELOAD_EN | TIMER1_EN); 71static int orion_clkevt_set_periodic(struct clock_event_device *dev)
73 } else { 72{
74 /* disable timer */ 73 /* setup and enable periodic timer at 1/HZ intervals */
75 atomic_io_modify(timer_base + TIMER_CTRL, 74 writel(ticks_per_jiffy - 1, timer_base + TIMER1_RELOAD);
76 TIMER1_RELOAD_EN | TIMER1_EN, 0); 75 writel(ticks_per_jiffy - 1, timer_base + TIMER1_VAL);
77 } 76 atomic_io_modify(timer_base + TIMER_CTRL,
77 TIMER1_RELOAD_EN | TIMER1_EN,
78 TIMER1_RELOAD_EN | TIMER1_EN);
79 return 0;
78} 80}
79 81
80static struct clock_event_device orion_clkevt = { 82static struct clock_event_device orion_clkevt = {
81 .name = "orion_event", 83 .name = "orion_event",
82 .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC, 84 .features = CLOCK_EVT_FEAT_ONESHOT |
83 .shift = 32, 85 CLOCK_EVT_FEAT_PERIODIC,
84 .rating = 300, 86 .shift = 32,
85 .set_next_event = orion_clkevt_next_event, 87 .rating = 300,
86 .set_mode = orion_clkevt_mode, 88 .set_next_event = orion_clkevt_next_event,
89 .set_state_shutdown = orion_clkevt_shutdown,
90 .set_state_periodic = orion_clkevt_set_periodic,
91 .set_state_oneshot = orion_clkevt_shutdown,
92 .tick_resume = orion_clkevt_shutdown,
87}; 93};
88 94
89static irqreturn_t orion_clkevt_irq_handler(int irq, void *dev_id) 95static irqreturn_t orion_clkevt_irq_handler(int irq, void *dev_id)