12 #include <linux/errno.h>
15 #include <linux/timex.h>
20 #include <mach/hardware.h>
21 #include <mach/irqs.h>
23 static u32 notrace sa1100_read_sched_clock(
void)
28 #define MIN_OSCR_DELTA 2
32 struct clock_event_device *
c =
dev_id;
43 sa1100_osmr0_set_next_event(
unsigned long delta,
struct clock_event_device *
c)
45 unsigned long next, oscr;
49 writel_relaxed(next,
OSMR0);
56 sa1100_osmr0_set_mode(
enum clock_event_mode
mode,
struct clock_event_device *c)
59 case CLOCK_EVT_MODE_ONESHOT:
60 case CLOCK_EVT_MODE_UNUSED:
61 case CLOCK_EVT_MODE_SHUTDOWN:
66 case CLOCK_EVT_MODE_RESUME:
67 case CLOCK_EVT_MODE_PERIODIC:
72 static struct clock_event_device ckevt_sa1100_osmr0 = {
74 .features = CLOCK_EVT_FEAT_ONESHOT,
76 .set_next_event = sa1100_osmr0_set_next_event,
77 .set_mode = sa1100_osmr0_set_mode,
80 static struct irqaction sa1100_timer_irq = {
83 .handler = sa1100_ost0_interrupt,
84 .dev_id = &ckevt_sa1100_osmr0,
87 static void __init sa1100_timer_init(
void)
89 writel_relaxed(0,
OIER);
94 clockevents_calc_mult_shift(&ckevt_sa1100_osmr0, 3686400, 4);
95 ckevt_sa1100_osmr0.max_delta_ns =
97 ckevt_sa1100_osmr0.min_delta_ns =
109 unsigned long osmr[4], oier;
122 writel_relaxed(0x0f,
OSSR);
123 writel_relaxed(osmr[0],
OSMR0);
124 writel_relaxed(osmr[1],
OSMR1);
125 writel_relaxed(osmr[2],
OSMR2);
126 writel_relaxed(osmr[3],
OSMR3);
127 writel_relaxed(oier,
OIER);
135 #define sa1100_timer_suspend NULL
136 #define sa1100_timer_resume NULL
140 .init = sa1100_timer_init,