m68knommu: move old ColdFire timers init from CPU init to timers code
authorGreg Ungerer <gerg@uclinux.org>
Sat, 24 Dec 2011 04:36:27 +0000 (14:36 +1000)
committerGreg Ungerer <gerg@uclinux.org>
Sun, 4 Mar 2012 23:43:10 +0000 (09:43 +1000)
The original ColdFire timer interrupt setup is used by most of the users
of the original ColdFire timer code. But the code is currently duplicated
in each of the ColdFire CPU specific init files. Move it to the timers
code that it is really part of. It is strait forward to make it conditional
on also having the original interrupt engine that it needs.

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
arch/m68k/platform/5206/config.c
arch/m68k/platform/5249/config.c
arch/m68k/platform/5307/config.c
arch/m68k/platform/5407/config.c
arch/m68k/platform/coldfire/timers.c

index aca6253191f729ccea8adf93a513c5cab05bf498..c81dd51ff758a9d26f5af4525e7f0c5b0cbb1343 100644 (file)
 
 /***************************************************************************/
 
-static void __init m5206_timers_init(void)
-{
-       /* Timer1 is always used as system timer */
-       writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3,
-               MCF_MBAR + MCFSIM_TIMER1ICR);
-       mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1);
-
-#ifdef CONFIG_HIGHPROFILE
-       /* Timer2 is to be used as a high speed profile timer  */
-       writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3,
-               MCF_MBAR + MCFSIM_TIMER2ICR);
-       mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2);
-#endif
-}
-
-/***************************************************************************/
-
 void m5206_cpu_reset(void)
 {
        local_irq_disable();
@@ -57,7 +40,6 @@ void __init config_BSP(char *commandp, int size)
 
        mach_reset = m5206_cpu_reset;
        mach_sched_init = hw_timer_init;
-       m5206_timers_init();
 
        /* Only support the external interrupts on their primary level */
        mcf_mapirq2imr(25, MCFINTC_EINT1);
index d00e12a378cc766d3ec17293b369e5062ee04fb5..cda273383226604a8f3e065529d7d0cf2078be96 100644 (file)
@@ -83,23 +83,6 @@ static void __init m5249_smc91x_init(void)
 
 /***************************************************************************/
 
-static void __init m5249_timers_init(void)
-{
-       /* Timer1 is always used as system timer */
-       writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3,
-               MCF_MBAR + MCFSIM_TIMER1ICR);
-       mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1);
-
-#ifdef CONFIG_HIGHPROFILE
-       /* Timer2 is to be used as a high speed profile timer  */
-       writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3,
-               MCF_MBAR + MCFSIM_TIMER2ICR);
-       mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2);
-#endif
-}
-
-/***************************************************************************/
-
 void m5249_cpu_reset(void)
 {
        local_irq_disable();
@@ -115,7 +98,6 @@ void __init config_BSP(char *commandp, int size)
 {
        mach_reset = m5249_cpu_reset;
        mach_sched_init = hw_timer_init;
-       m5249_timers_init();
 #ifdef CONFIG_M5249C3
        m5249_smc91x_init();
 #endif
index 89722cdbd0261f6d1186298c0b9f34d192d9c22b..5f4bf6cb017f87e438ad49860065787ccb590251 100644 (file)
@@ -28,23 +28,6 @@ unsigned char ledbank = 0xff;
 
 /***************************************************************************/
 
-static void __init m5307_timers_init(void)
-{
-       /* Timer1 is always used as system timer */
-       writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3,
-               MCF_MBAR + MCFSIM_TIMER1ICR);
-       mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1);
-
-#ifdef CONFIG_HIGHPROFILE
-       /* Timer2 is to be used as a high speed profile timer  */
-       writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3,
-               MCF_MBAR + MCFSIM_TIMER2ICR);
-       mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2);
-#endif
-}
-
-/***************************************************************************/
-
 void m5307_cpu_reset(void)
 {
        local_irq_disable();
@@ -67,7 +50,6 @@ void __init config_BSP(char *commandp, int size)
 
        mach_reset = m5307_cpu_reset;
        mach_sched_init = hw_timer_init;
-       m5307_timers_init();
 
        /* Only support the external interrupts on their primary level */
        mcf_mapirq2imr(25, MCFINTC_EINT1);
index e3b4cab0feb369af7e888a9423547a9ac8b47ad2..19c612557b9802b3945a3d85eddc943e8dbefa72 100644 (file)
 
 /***************************************************************************/
 
-static void __init m5407_timers_init(void)
-{
-       /* Timer1 is always used as system timer */
-       writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3,
-               MCF_MBAR + MCFSIM_TIMER1ICR);
-       mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1);
-
-#ifdef CONFIG_HIGHPROFILE
-       /* Timer2 is to be used as a high speed profile timer  */
-       writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3,
-               MCF_MBAR + MCFSIM_TIMER2ICR);
-       mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2);
-#endif
-}
-
-/***************************************************************************/
-
 void m5407_cpu_reset(void)
 {
        local_irq_disable();
@@ -51,7 +34,6 @@ void __init config_BSP(char *commandp, int size)
 {
        mach_reset = m5407_cpu_reset;
        mach_sched_init = hw_timer_init;
-       m5407_timers_init();
 
        /* Only support the external interrupts on their primary level */
        mcf_mapirq2imr(25, MCFINTC_EINT1);
index d0b4e9798fdef0fb004024feeaee0dbf1bce62cc..ed96ce50d79f1163bf2df6830fdb6b148eb84a17 100644 (file)
@@ -51,6 +51,25 @@ static irq_handler_t timer_interrupt;
 
 /***************************************************************************/
 
+static void init_timer_irq(void)
+{
+#ifdef MCFSIM_ICR_AUTOVEC
+       /* Timer1 is always used as system timer */
+       writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI3,
+               MCF_MBAR + MCFSIM_TIMER1ICR);
+       mcf_mapirq2imr(MCF_IRQ_TIMER, MCFINTC_TIMER1);
+
+#ifdef CONFIG_HIGHPROFILE
+       /* Timer2 is to be used as a high speed profile timer  */
+       writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL7 | MCFSIM_ICR_PRI3,
+               MCF_MBAR + MCFSIM_TIMER2ICR);
+       mcf_mapirq2imr(MCF_IRQ_PROFILER, MCFINTC_TIMER2);
+#endif
+#endif /* MCFSIM_ICR_AUTOVEC */
+}
+
+/***************************************************************************/
+
 static irqreturn_t mcftmr_tick(int irq, void *dummy)
 {
        /* Reset the ColdFire timer */
@@ -113,6 +132,7 @@ void hw_timer_init(irq_handler_t handler)
        clocksource_register_hz(&mcftmr_clk, FREQ);
 
        timer_interrupt = handler;
+       init_timer_irq();
        setup_irq(MCF_IRQ_TIMER, &mcftmr_timer_irq);
 
 #ifdef CONFIG_HIGHPROFILE