17 #include <linux/time.h>
18 #include <linux/timex.h>
22 #include <linux/sched.h>
25 #include <linux/module.h>
26 #include <asm/irq_regs.h>
27 #include <asm/traps.h>
30 #include <arch/spr_def.h>
42 return cycles_per_sec;
45 #if CHIP_HAS_SPLIT_CYCLE()
67 #define SCHED_CLOCK_SHIFT 10
77 .name =
"cycle counter",
79 .read = clocksource_get_cycles,
98 pr_info(
"Clock rate yields %lu.%02lu BogoMIPS (lpj=%lu)\n",
107 clocksource_register_hz(&cycle_counter_cs, cycles_per_sec);
126 #define MAX_TICK 0x7fffffff
127 #define TILE_MINSEC 5
129 static int tile_timer_set_next_event(
unsigned long ticks,
130 struct clock_event_device *
evt)
142 static void tile_timer_set_mode(
enum clock_event_mode
mode,
143 struct clock_event_device *
evt)
153 .name =
"tile timer",
154 .features = CLOCK_EVT_FEAT_ONESHOT,
155 .min_delta_ns = 1000,
158 .set_next_event = tile_timer_set_next_event,
159 .set_mode = tile_timer_set_mode,
167 clockevents_calc_mult_shift(evt, cycles_per_sec,
TILE_MINSEC);
183 struct pt_regs *old_regs = set_irq_regs(regs);
199 evt->event_handler(evt);
207 set_irq_regs(old_regs);
234 return ((
u64)nsecs * dev->mult) >> dev->shift;