/* * Copyright 2008, Realtek Semiconductor Corp. * * Tony Wu (tonywu@realtek.com) * Dec. 07, 2008 */ #include #include #include #include #include "bspchip.h" extern void bsp_timer_ack(void); int ext_timer_state(void) { return 0; } int ext_timer_set_base_clock(unsigned int hz) { return 0; } static int ext_timer_set_next_event(unsigned long delta, struct clock_event_device *evt) { return -EINVAL; } static void ext_timer_set_mode(enum clock_event_mode mode, struct clock_event_device *evt) { return; } static void ext_timer_event_handler(struct clock_event_device *dev) { } DEFINE_PER_CPU(struct clock_event_device, ext_clockevent_device); static irqreturn_t ext_timer_interrupt(int irq, void *dev_id) { struct clock_event_device *cd; cd = &per_cpu(ext_clockevent_device, smp_processor_id()); int cpu = smp_processor_id(); /* Ack the RTC interrupt. */ bsp_timer_ack(); #ifdef CONFIG_RTL8686_SHM_NOTIFY //printk("%d ", cpu); #if 0 if (cpu == 0) { extern int aipc_shm_notify(void); aipc_shm_notify(); } #else { extern int aipc_shm_notify(void); aipc_shm_notify(); } #endif #endif cd->event_handler(cd); return IRQ_HANDLED; } static struct irqaction ext_irqaction = { .handler = ext_timer_interrupt, .flags = IRQF_TIMER | IRQF_PERCPU, .name = "EXT_TIMER", }; int ext_clockevent_init(void) { unsigned int cpu = smp_processor_id(); struct clock_event_device *cd; unsigned int irq; cd = &per_cpu(ext_clockevent_device, cpu); irq = BSP_TC0_IRQ + cpu; cd->name = "EXT_TIMER"; cd->features = CLOCK_EVT_FEAT_PERIODIC; cd->event_handler = ext_timer_event_handler; cd->set_next_event = ext_timer_set_next_event; cd->set_mode = ext_timer_set_mode; cd->rating = 100; cd->irq = irq; clockevent_set_clock(cd, 32768); cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd); cd->min_delta_ns = clockevent_delta2ns(0x300, cd); cd->cpumask = cpumask_of(cpu); clockevents_register_device(cd); setup_irq(irq, &ext_irqaction); irq_set_handler(irq, handle_percpu_irq); return 0; }