18 #include <linux/kernel.h>
19 #include <linux/sched.h>
39 #define PERIOD (0x01 << 27)
40 #define ONESHOT (0x00 << 27)
41 #define COUNTEN (0x01 << 30)
42 #define INTEN (0x01 << 29)
44 #define TICKS_PER_SEC 100
49 static unsigned int timer0_load;
51 static void nuc900_clockevent_setmode(
enum clock_event_mode
mode,
52 struct clock_event_device *
clk)
60 case CLOCK_EVT_MODE_PERIODIC:
65 case CLOCK_EVT_MODE_ONESHOT:
69 case CLOCK_EVT_MODE_UNUSED:
70 case CLOCK_EVT_MODE_SHUTDOWN:
71 case CLOCK_EVT_MODE_RESUME:
78 static int nuc900_clockevent_setnextevent(
unsigned long evt,
79 struct clock_event_device *
clk)
92 static struct clock_event_device nuc900_clockevent_device = {
93 .name =
"nuc900-timer0",
95 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
96 .set_mode = nuc900_clockevent_setmode,
97 .set_next_event = nuc900_clockevent_setnextevent,
105 struct clock_event_device *
evt = &nuc900_clockevent_device;
109 evt->event_handler(evt);
113 static struct irqaction nuc900_timer0_irq = {
114 .name =
"nuc900-timer0",
116 .handler = nuc900_timer0_interrupt,
119 static void __init nuc900_clockevents_init(
void)
136 nuc900_clockevent_device.mult = div_sc(rate,
NSEC_PER_SEC,
137 nuc900_clockevent_device.shift);
139 &nuc900_clockevent_device);
141 &nuc900_clockevent_device);
142 nuc900_clockevent_device.cpumask =
cpumask_of(0);
147 static void __init nuc900_clocksource_init(
void)
170 static void __init nuc900_timer_init(
void)
172 nuc900_clocksource_init();
173 nuc900_clockevents_init();
177 .init = nuc900_timer_init,