--- zzzz-none-000/linux-2.6.28.10/arch/mips/kernel/cevt-r4k.c 2009-05-02 18:54:43.000000000 +0000 +++ fusiv-7390-686/linux-2.6.28.10/arch/mips/kernel/cevt-r4k.c 2012-02-24 09:00:35.000000000 +0000 @@ -14,6 +14,8 @@ #include #include +#include + /* * The SMTC Kernel for the 34K, 1004K, et. al. replaces several * of these routines with SMTC-specific variants. @@ -36,14 +38,46 @@ #endif /* CONFIG_MIPS_MT_SMTC */ -void mips_set_clock_mode(enum clock_event_mode mode, - struct clock_event_device *evt) -{ - /* Nothing to do ... */ +extern void unmask_mips_timer_irq(unsigned int irq); +extern void mask_mips_timer_irq(unsigned int irq); +void mips_set_clock_mode(enum clock_event_mode mode, struct clock_event_device *evt) +{ + switch(mode) { + case CLOCK_EVT_MODE_UNUSED: + break; + case CLOCK_EVT_MODE_SHUTDOWN: + mask_mips_timer_irq(evt->irq); + break; + case CLOCK_EVT_MODE_PERIODIC: + unmask_mips_timer_irq(evt->irq); + break; + case CLOCK_EVT_MODE_ONESHOT: + unmask_mips_timer_irq(evt->irq); + break; + case CLOCK_EVT_MODE_RESUME: + unmask_mips_timer_irq(evt->irq); + break; + default: + ; + } +#if 0 + printk("[%d/%s/%pF] ignore switch to clock_event_mode %s on clock event device %s (%pF)\n", smp_processor_id(), + __FUNCTION__, + mips_set_clock_mode, + mode == CLOCK_EVT_MODE_UNUSED ? "CLOCK_EVT_MODE_UNUSED" : + mode == CLOCK_EVT_MODE_SHUTDOWN ? "CLOCK_EVT_MODE_SHUTDOWN" : + mode == CLOCK_EVT_MODE_PERIODIC ? "CLOCK_EVT_MODE_PERIODIC" : + mode == CLOCK_EVT_MODE_ONESHOT ? "CLOCK_EVT_MODE_ONESHOT" : + mode == CLOCK_EVT_MODE_RESUME ? "CLOCK_EVT_MODE_RESUME" : "unknown", + evt->name, + evt + ); +#endif + /* Nothing to do ... */ } DEFINE_PER_CPU(struct clock_event_device, mips_clockevent_device); -int cp0_timer_irq_installed; +int cp0_timer_irq_installed[2]; #ifndef CONFIG_MIPS_MT_SMTC @@ -82,7 +116,7 @@ struct irqaction c0_compare_irqaction = { .handler = c0_compare_interrupt, - .flags = IRQF_DISABLED | IRQF_PERCPU, + .flags = IRQF_DISABLED | IRQF_PERCPU | IRQF_TIMER, .name = "timer", }; @@ -184,7 +218,7 @@ cd = &per_cpu(mips_clockevent_device, cpu); - cd->name = "MIPS"; + cd->name = cpu ? "MIPS-1" : "MIPS-0"; cd->features = CLOCK_EVT_FEAT_ONESHOT; /* Calculate the min / max delta */ @@ -202,11 +236,14 @@ clockevents_register_device(cd); - if (cp0_timer_irq_installed) + /*--- printk("[%s] want: timer irq for cpu %d ist: %d\n", __FUNCTION__, smp_processor_id(), irq); ---*/ + + if (cp0_timer_irq_installed[cpu]) return 0; - cp0_timer_irq_installed = 1; + cp0_timer_irq_installed[cpu] = 1; + /*--- printk("[%s] timer irq for cpu %d ist: %d\n", __FUNCTION__, smp_processor_id(), irq); ---*/ setup_irq(irq, &c0_compare_irqaction); return 0;