22 #include <linux/kernel.h>
26 #include <linux/export.h>
32 static unsigned long last_crtr;
34 static struct clock_event_device clkevt;
36 #define RM9200_TIMER_LATCH ((AT91_SLOW_CLOCK + HZ/2) / HZ)
43 static inline unsigned long read_CRTR(
void)
72 clkevt.event_handler(&clkevt);
78 u32 crtr = read_CRTR();
82 clkevt.event_handler(&clkevt);
91 static struct irqaction at91rm9200_timer_irq = {
94 .handler = at91rm9200_timer_interrupt
103 .name =
"32k_counter",
111 clkevt32k_mode(
enum clock_event_mode
mode,
struct clock_event_device *
dev)
117 last_crtr = read_CRTR();
119 case CLOCK_EVT_MODE_PERIODIC:
124 case CLOCK_EVT_MODE_ONESHOT:
131 case CLOCK_EVT_MODE_SHUTDOWN:
132 case CLOCK_EVT_MODE_UNUSED:
133 case CLOCK_EVT_MODE_RESUME:
141 clkevt32k_next_event(
unsigned long delta,
struct clock_event_device *dev)
170 static struct clock_event_device clkevt = {
172 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
175 .set_next_event = clkevt32k_next_event,
176 .set_mode = clkevt32k_mode,
184 at91_st_base =
ioremap(addr, 256);
186 panic(
"Impossible to ioremap ST\n");