20 #include <linux/kernel.h>
28 #include <linux/module.h>
34 #define TIMER_CTRL_OFF 0x0000
35 #define TIMER0_EN 0x0001
36 #define TIMER0_RELOAD_EN 0x0002
37 #define TIMER0_25MHZ 0x0800
38 #define TIMER0_DIV(div) ((div) << 19)
39 #define TIMER1_EN 0x0004
40 #define TIMER1_RELOAD_EN 0x0008
41 #define TIMER1_25MHZ 0x1000
42 #define TIMER1_DIV(div) ((div) << 22)
43 #define TIMER_EVENTS_STATUS 0x0004
44 #define TIMER0_CLR_MASK (~0x1)
45 #define TIMER1_CLR_MASK (~0x100)
46 #define TIMER0_RELOAD_OFF 0x0010
47 #define TIMER0_VAL_OFF 0x0014
48 #define TIMER1_RELOAD_OFF 0x0018
49 #define TIMER1_VAL_OFF 0x001c
53 #define TIMER_DIVIDER_SHIFT 5
54 #define TIMER_DIVIDER (1 << TIMER_DIVIDER_SHIFT)
59 static void __iomem *timer_base;
65 static u32 ticks_per_jiffy;
67 static u32 notrace armada_370_xp_read_sched_clock(
void)
76 armada_370_xp_clkevt_next_event(
unsigned long delta,
77 struct clock_event_device *
dev)
103 armada_370_xp_clkevt_mode(
enum clock_event_mode
mode,
104 struct clock_event_device *dev)
108 if (mode == CLOCK_EVT_MODE_PERIODIC) {
138 static struct clock_event_device armada_370_xp_clkevt = {
139 .name =
"armada_370_xp_tick",
140 .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
143 .set_next_event = armada_370_xp_clkevt_next_event,
144 .set_mode = armada_370_xp_clkevt_mode,
154 armada_370_xp_clkevt.event_handler(&armada_370_xp_clkevt);
159 static struct irqaction armada_370_xp_timer_irq = {
160 .name =
"armada_370_xp_tick",
162 .handler = armada_370_xp_timer_interrupt
169 unsigned int timer_clk;
180 timer_clk = 25000000;
183 ret = of_property_read_u32(np,
"clock-frequency", &clk);
195 ticks_per_jiffy = (timer_clk +
HZ / 2) /
HZ;
215 "armada_370_xp_clocksource",
221 setup_irq(timer_irq, &armada_370_xp_timer_irq);
224 timer_clk, 1, 0xfffffffe);