15 #include <linux/kernel.h>
20 #include <asm/div64.h>
24 #include <mach/regs-ost.h>
25 #include <mach/irqs.h>
42 #define MIN_OSCR_DELTA 16
45 pxa_ost0_interrupt(
int irq,
void *
dev_id)
47 struct clock_event_device *
c =
dev_id;
58 pxa_osmr0_set_next_event(
unsigned long delta,
struct clock_event_device *
dev)
60 unsigned long next, oscr;
64 writel_relaxed(next,
OSMR0);
71 pxa_osmr0_set_mode(
enum clock_event_mode
mode,
struct clock_event_device *dev)
74 case CLOCK_EVT_MODE_ONESHOT:
79 case CLOCK_EVT_MODE_UNUSED:
80 case CLOCK_EVT_MODE_SHUTDOWN:
86 case CLOCK_EVT_MODE_RESUME:
87 case CLOCK_EVT_MODE_PERIODIC:
92 static struct clock_event_device ckevt_pxa_osmr0 = {
94 .features = CLOCK_EVT_FEAT_ONESHOT,
96 .set_next_event = pxa_osmr0_set_next_event,
97 .set_mode = pxa_osmr0_set_mode,
103 .handler = pxa_ost0_interrupt,
104 .dev_id = &ckevt_pxa_osmr0,
107 static void __init pxa_timer_init(
void)
111 writel_relaxed(0,
OIER);
116 clockevents_calc_mult_shift(&ckevt_pxa_osmr0, clock_tick_rate, 4);
117 ckevt_pxa_osmr0.max_delta_ns =
119 ckevt_pxa_osmr0.min_delta_ns =
131 static unsigned long osmr[4], oier, oscr;
154 writel_relaxed(osmr[0],
OSMR0);
155 writel_relaxed(osmr[1],
OSMR1);
156 writel_relaxed(osmr[2],
OSMR2);
157 writel_relaxed(osmr[3],
OSMR3);
158 writel_relaxed(oier,
OIER);
159 writel_relaxed(oscr,
OSCR);
162 #define pxa_timer_suspend NULL
163 #define pxa_timer_resume NULL
167 .init = pxa_timer_init,