31 #include <linux/module.h>
33 #include <asm/timer-regs.h>
49 static struct resource rtos_timer_resources[] = {
51 .start = RTOS_TIMER_REGS_ADDR,
60 .num_resources =
ARRAY_SIZE(rtos_timer_resources),
61 .resource = rtos_timer_resources,
83 .read = timer_get_cycles,
88 static int set_next_event(
unsigned long delta,
struct clock_event_device *
evt)
103 static void set_mode(
enum clock_event_mode
mode,
104 struct clock_event_device *
evt)
107 case CLOCK_EVT_MODE_SHUTDOWN:
122 static struct clock_event_device hexagon_clockevent_dev = {
123 .name =
"clockevent",
124 .features = CLOCK_EVT_FEAT_ONESHOT,
127 .set_next_event = set_next_event,
128 .set_mode = set_mode,
130 .broadcast = broadcast,
140 struct clock_event_device *ce_dev = &hexagon_clockevent_dev;
141 struct clock_event_device *dummy_clock_dev =
144 memcpy(dummy_clock_dev, ce_dev,
sizeof(*dummy_clock_dev));
145 INIT_LIST_HEAD(&dummy_clock_dev->list);
147 dummy_clock_dev->features = CLOCK_EVT_FEAT_DUMMY;
149 dummy_clock_dev->mode = CLOCK_EVT_MODE_UNUSED;
158 struct clock_event_device *ce_dev = &
per_cpu(clock_events, cpu);
160 ce_dev->event_handler(ce_dev);
166 struct clock_event_device *ce_dev = &hexagon_clockevent_dev;
169 ce_dev->event_handler(ce_dev);
175 static struct irqaction rtos_timer_intdesc = {
193 struct clock_event_device *ce_dev = &hexagon_clockevent_dev;
201 resource = rtos_timer_device.
resource;
204 rtos_timer =
ioremap(resource->
start, resource_size(resource));
209 clocksource_register_khz(&hexagon_clocksource,
pcycle_freq_mhz * 1000);
227 setup_irq(ce_dev->irq, &rtos_timer_intdesc);
239 static long long fudgefactor = 350;