Commit 02f5632122ccbb6eb0c3b3f612b564b659defb32

Authored by Linus Walleij
Committed by Russell King
1 parent 1b56b17f99

ARM: 7085/2: mach-integrator: clockevent supports oneshot mode

The Integrator AP timer has no problem supporting oneshot
ticks with proper code, so let's do it so we can have
NOHZ configured in for this platform too.

Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

Showing 1 changed file with 19 additions and 5 deletions Side-by-side Diff

arch/arm/mach-integrator/integrator_ap.c
... ... @@ -360,15 +360,29 @@
360 360 {
361 361 u32 ctrl = readl(clkevt_base + TIMER_CTRL) & ~TIMER_CTRL_ENABLE;
362 362  
363   - BUG_ON(mode == CLOCK_EVT_MODE_ONESHOT);
  363 + /* Disable timer */
  364 + writel(ctrl, clkevt_base + TIMER_CTRL);
364 365  
365   - if (mode == CLOCK_EVT_MODE_PERIODIC) {
366   - writel(ctrl, clkevt_base + TIMER_CTRL);
  366 + switch (mode) {
  367 + case CLOCK_EVT_MODE_PERIODIC:
  368 + /* Enable the timer and start the periodic tick */
367 369 writel(timer_reload, clkevt_base + TIMER_LOAD);
368 370 ctrl |= TIMER_CTRL_PERIODIC | TIMER_CTRL_ENABLE;
  371 + writel(ctrl, clkevt_base + TIMER_CTRL);
  372 + break;
  373 + case CLOCK_EVT_MODE_ONESHOT:
  374 + /* Leave the timer disabled, .set_next_event will enable it */
  375 + ctrl &= ~TIMER_CTRL_PERIODIC;
  376 + writel(ctrl, clkevt_base + TIMER_CTRL);
  377 + break;
  378 + case CLOCK_EVT_MODE_UNUSED:
  379 + case CLOCK_EVT_MODE_SHUTDOWN:
  380 + case CLOCK_EVT_MODE_RESUME:
  381 + default:
  382 + /* Just leave in disabled state */
  383 + break;
369 384 }
370 385  
371   - writel(ctrl, clkevt_base + TIMER_CTRL);
372 386 }
373 387  
374 388 static int clkevt_set_next_event(unsigned long next, struct clock_event_device *evt)
... ... @@ -385,7 +399,7 @@
385 399 static struct clock_event_device integrator_clockevent = {
386 400 .name = "timer1",
387 401 .shift = 34,
388   - .features = CLOCK_EVT_FEAT_PERIODIC,
  402 + .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
389 403 .set_mode = clkevt_set_mode,
390 404 .set_next_event = clkevt_set_next_event,
391 405 .rating = 300,