diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2011-09-08 16:22:32 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-10-17 04:12:43 -0400 |
commit | 6d8ce7129f6c4c2f8716d6a771d59f263deab898 (patch) | |
tree | 00dc17d4332da512155b8332534301e23513532a /arch | |
parent | 02f5632122ccbb6eb0c3b3f612b564b659defb32 (diff) |
ARM: 7086/2: mach-integrator: modernize clock event registration
Drop mult, shift and delta calculations and let the
clockevent core scale this as appropriate.
Set the minimum interval to 1 rather than 15 (0xf), there
is nothing in the data sheets I have indicating that 15
should be some minimum value.
Acked-by: 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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-integrator/integrator_ap.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c index e66a8bce3999..0a6f397f1222 100644 --- a/arch/arm/mach-integrator/integrator_ap.c +++ b/arch/arm/mach-integrator/integrator_ap.c | |||
@@ -398,12 +398,10 @@ static int clkevt_set_next_event(unsigned long next, struct clock_event_device * | |||
398 | 398 | ||
399 | static struct clock_event_device integrator_clockevent = { | 399 | static struct clock_event_device integrator_clockevent = { |
400 | .name = "timer1", | 400 | .name = "timer1", |
401 | .shift = 34, | ||
402 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | 401 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, |
403 | .set_mode = clkevt_set_mode, | 402 | .set_mode = clkevt_set_mode, |
404 | .set_next_event = clkevt_set_next_event, | 403 | .set_next_event = clkevt_set_next_event, |
405 | .rating = 300, | 404 | .rating = 300, |
406 | .cpumask = cpu_all_mask, | ||
407 | }; | 405 | }; |
408 | 406 | ||
409 | static struct irqaction integrator_timer_irq = { | 407 | static struct irqaction integrator_timer_irq = { |
@@ -415,9 +413,9 @@ static struct irqaction integrator_timer_irq = { | |||
415 | 413 | ||
416 | static void integrator_clockevent_init(u32 khz) | 414 | static void integrator_clockevent_init(u32 khz) |
417 | { | 415 | { |
418 | struct clock_event_device *evt = &integrator_clockevent; | ||
419 | unsigned int ctrl = 0; | 416 | unsigned int ctrl = 0; |
420 | 417 | ||
418 | /* Calculate and program a divisor */ | ||
421 | if (khz * 1000 > 0x100000 * HZ) { | 419 | if (khz * 1000 > 0x100000 * HZ) { |
422 | khz /= 256; | 420 | khz /= 256; |
423 | ctrl |= TIMER_CTRL_DIV256; | 421 | ctrl |= TIMER_CTRL_DIV256; |
@@ -425,17 +423,14 @@ static void integrator_clockevent_init(u32 khz) | |||
425 | khz /= 16; | 423 | khz /= 16; |
426 | ctrl |= TIMER_CTRL_DIV16; | 424 | ctrl |= TIMER_CTRL_DIV16; |
427 | } | 425 | } |
428 | |||
429 | timer_reload = khz * 1000 / HZ; | 426 | timer_reload = khz * 1000 / HZ; |
430 | writel(ctrl, clkevt_base + TIMER_CTRL); | 427 | writel(ctrl, clkevt_base + TIMER_CTRL); |
431 | 428 | ||
432 | evt->irq = IRQ_TIMERINT1; | ||
433 | evt->mult = div_sc(khz, NSEC_PER_MSEC, evt->shift); | ||
434 | evt->max_delta_ns = clockevent_delta2ns(0xffff, evt); | ||
435 | evt->min_delta_ns = clockevent_delta2ns(0xf, evt); | ||
436 | |||
437 | setup_irq(IRQ_TIMERINT1, &integrator_timer_irq); | 429 | setup_irq(IRQ_TIMERINT1, &integrator_timer_irq); |
438 | clockevents_register_device(evt); | 430 | clockevents_config_and_register(&integrator_clockevent, |
431 | khz * 1000, | ||
432 | 1, | ||
433 | 0xffffU); | ||
439 | } | 434 | } |
440 | 435 | ||
441 | /* | 436 | /* |