17 #include <linux/kernel.h>
18 #include <linux/time.h>
19 #include <linux/timex.h>
28 #include <asm/cpuinfo.h>
30 static int openrisc_timer_set_next_event(
unsigned long delta,
31 struct clock_event_device *
dev)
51 static void openrisc_timer_set_mode(
enum clock_event_mode
mode,
52 struct clock_event_device *
evt)
55 case CLOCK_EVT_MODE_PERIODIC:
59 case CLOCK_EVT_MODE_ONESHOT:
62 case CLOCK_EVT_MODE_UNUSED:
65 case CLOCK_EVT_MODE_SHUTDOWN:
68 case CLOCK_EVT_MODE_RESUME:
80 static struct clock_event_device clockevent_openrisc_timer = {
81 .name =
"openrisc_timer_clockevent",
82 .features = CLOCK_EVT_FEAT_ONESHOT,
84 .set_next_event = openrisc_timer_set_next_event,
85 .set_mode = openrisc_timer_set_mode,
88 static inline void timer_ack(
void)
109 struct pt_regs *old_regs = set_irq_regs(regs);
110 struct clock_event_device *evt = &clockevent_openrisc_timer;
118 evt->event_handler(evt);
121 set_irq_regs(old_regs);
126 static __init void openrisc_clockevent_init(
void)
128 clockevent_openrisc_timer.cpumask =
cpumask_of(0);
150 .name =
"openrisc_timer",
152 .read = openrisc_timer_read,
157 static int __init openrisc_timer_init(
void)
160 panic(
"failed to register clocksource");
174 panic(
"Linux not supported on devices without tick timer");
176 openrisc_timer_init();
177 openrisc_clockevent_init();