]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
openrisc: Set shortest clock event to 100 ticks
authorJonas Bonn <jonas@southpole.se>
Fri, 18 Nov 2011 13:40:04 +0000 (14:40 +0100)
committerJonas Bonn <jonas@southpole.se>
Fri, 17 Feb 2012 09:08:19 +0000 (10:08 +0100)
It takes a couple of instructions to actually configure a clock event
so setting an alarm just 1 clock cycle in the future isn't going to work;
doing so results in setting an alarm in the "past" in which case the event
won't fire until the timer overflows and rolls back around to the "current
time".

Not quite sure how many clock cycles it actually takes to get through to
actually writing the register, but 100 seems to work reliably.

Use generic helper to set up the clock event while we're at it.

Reported-by: Jan Schulte <jan.schulte@aacmicrotec.com>
Signed-off-by: Jonas Bonn <jonas@southpole.se>
arch/openrisc/kernel/time.c

index bd946ef1623d6fdb10c5d1d0588085ce7f1cdae5..7c52e9494a8de02f589f88586187bafa0d1688d1 100644 (file)
@@ -125,16 +125,13 @@ irqreturn_t __irq_entry timer_interrupt(struct pt_regs *regs)
 
 static __init void openrisc_clockevent_init(void)
 {
-       clockevents_calc_mult_shift(&clockevent_openrisc_timer,
-                                   cpuinfo.clock_frequency, 4);
+       clockevent_openrisc_timer.cpumask = cpumask_of(0);
 
        /* We only have 28 bits */
-       clockevent_openrisc_timer.max_delta_ns =
-           clockevent_delta2ns((u32) 0x0fffffff, &clockevent_openrisc_timer);
-       clockevent_openrisc_timer.min_delta_ns =
-           clockevent_delta2ns(1, &clockevent_openrisc_timer);
-       clockevent_openrisc_timer.cpumask = cpumask_of(0);
-       clockevents_register_device(&clockevent_openrisc_timer);
+       clockevents_config_and_register(&clockevent_openrisc_timer,
+                                       cpuinfo.clock_frequency,
+                                       100, 0x0fffffff);
+
 }
 
 /**