14 #include <linux/kernel.h>
24 #define BRIDGE_CAUSE_OFF 0x0110
25 #define BRIDGE_MASK_OFF 0x0114
26 #define BRIDGE_INT_TIMER0 0x0002
27 #define BRIDGE_INT_TIMER1 0x0004
33 #define TIMER_CTRL_OFF 0x0000
34 #define TIMER0_EN 0x0001
35 #define TIMER0_RELOAD_EN 0x0002
36 #define TIMER1_EN 0x0004
37 #define TIMER1_RELOAD_EN 0x0008
38 #define TIMER0_RELOAD_OFF 0x0010
39 #define TIMER0_VAL_OFF 0x0014
40 #define TIMER1_RELOAD_OFF 0x0018
41 #define TIMER1_VAL_OFF 0x001c
47 static void __iomem *bridge_base;
48 static u32 bridge_timer1_clr_mask;
49 static void __iomem *timer_base;
55 static u32 ticks_per_jiffy;
63 static u32 notrace orion_read_sched_clock(
void)
72 orion_clkevt_next_event(
unsigned long delta,
struct clock_event_device *
dev)
109 orion_clkevt_mode(
enum clock_event_mode
mode,
struct clock_event_device *dev)
115 if (mode == CLOCK_EVT_MODE_PERIODIC) {
156 static struct clock_event_device orion_clkevt = {
157 .name =
"orion_tick",
158 .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
161 .set_next_event = orion_clkevt_next_event,
162 .set_mode = orion_clkevt_mode,
171 orion_clkevt.event_handler(&orion_clkevt);
176 static struct irqaction orion_timer_irq = {
177 .name =
"orion_tick",
179 .handler = orion_timer_interrupt
185 timer_base = _timer_base;
190 unsigned int irq,
unsigned int tclk)
197 bridge_base = _bridge_base;
198 bridge_timer1_clr_mask = _bridge_timer1_clr_mask;
200 ticks_per_jiffy = (tclk +
HZ/2) /
HZ;
224 orion_clkevt.mult = div_sc(tclk,
NSEC_PER_SEC, orion_clkevt.shift);