87 clkctrl &= 0xfffff1ff;
88 clkctrl |= (0x5 << 9);
96 static void __iomem *cns3xxx_tmr1;
98 static void cns3xxx_timer_set_mode(
enum clock_event_mode
mode,
99 struct clock_event_device *
clk)
106 case CLOCK_EVT_MODE_PERIODIC:
107 reload = pclk * 20 / (3 *
HZ) * 0x25000;
109 ctrl |= (1 << 0) | (1 << 2) | (1 << 9);
111 case CLOCK_EVT_MODE_ONESHOT:
113 ctrl |= (1 << 2) | (1 << 9);
115 case CLOCK_EVT_MODE_UNUSED:
116 case CLOCK_EVT_MODE_SHUTDOWN:
124 static int cns3xxx_timer_set_next_event(
unsigned long evt,
125 struct clock_event_device *
unused)
135 static struct clock_event_device cns3xxx_tmr1_clockevent = {
136 .name =
"cns3xxx timer1",
138 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
139 .set_mode = cns3xxx_timer_set_mode,
140 .set_next_event = cns3xxx_timer_set_next_event,
145 static void __init cns3xxx_clockevents_init(
unsigned int timer_irq)
147 cns3xxx_tmr1_clockevent.irq = timer_irq;
148 cns3xxx_tmr1_clockevent.mult =
150 cns3xxx_tmr1_clockevent.shift);
151 cns3xxx_tmr1_clockevent.max_delta_ns =
153 cns3xxx_tmr1_clockevent.min_delta_ns =
164 struct clock_event_device *evt = &cns3xxx_tmr1_clockevent;
170 writel(val & ~(1 << 2), stat);
172 evt->event_handler(evt);
177 static struct irqaction cns3xxx_timer_irq = {
180 .handler = cns3xxx_timer_interrupt,
186 static void __init __cns3xxx_timer_init(
unsigned int timer_irq)
209 irq_mask &= ~(1 << 2);
224 irq_mask |= ((1 << 3) | (1 << 4) | (1 << 5));
233 setup_irq(timer_irq, &cns3xxx_timer_irq);
235 cns3xxx_clockevents_init(timer_irq);
238 static void __init cns3xxx_timer_init(
void)
246 .init = cns3xxx_timer_init,
249 #ifdef CONFIG_CACHE_L2X0
251 void __init cns3xxx_l2x0_init(
void)