m68knommu: modify timer init code to make it consistent with m68k code
authorGreg Ungerer <gerg@uclinux.org>
Mon, 23 Jan 2012 05:34:58 +0000 (15:34 +1000)
committerGreg Ungerer <gerg@uclinux.org>
Sun, 4 Mar 2012 23:43:04 +0000 (09:43 +1000)
With a few small changes we can make the m68knommu timer init code the
same as the m68k code. By using the mach_sched_init function pointer
and reworking the current timer initializers to keep track of the common
m68k timer_interrupt() handler we end up with almost identical code for
m68knommu.

This will allow us to more easily merge the mmu and non-mmu m68k time.c
in future patches.

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
17 files changed:
arch/m68k/include/asm/machdep.h
arch/m68k/kernel/setup_no.c
arch/m68k/kernel/time_no.c
arch/m68k/platform/5206/config.c
arch/m68k/platform/520x/config.c
arch/m68k/platform/523x/config.c
arch/m68k/platform/5249/config.c
arch/m68k/platform/5272/config.c
arch/m68k/platform/527x/config.c
arch/m68k/platform/528x/config.c
arch/m68k/platform/5307/config.c
arch/m68k/platform/532x/config.c
arch/m68k/platform/5407/config.c
arch/m68k/platform/54xx/config.c
arch/m68k/platform/coldfire/pit.c
arch/m68k/platform/coldfire/sltimers.c
arch/m68k/platform/coldfire/timers.c

index 3bfa7df357295b093a2b54ba111617d460957ac6..825c1c813196a7b08de0936a8101ee2b7d5820be 100644 (file)
@@ -33,9 +33,8 @@ extern void (*mach_l2_flush) (int);
 extern void (*mach_beep) (unsigned int, unsigned int);
 
 /* Hardware clock functions */
-extern void hw_timer_init(void);
+extern void hw_timer_init(irq_handler_t handler);
 extern unsigned long hw_timer_offset(void);
-extern irqreturn_t arch_timer_interrupt(int irq, void *dummy);
 
 extern void config_BSP(char *command, int len);
 
index 8394b56b2c721fac88b86ade5c05deb3fce5707c..7dc186b7a85fb27a098858a4106ac64d95abc1b4 100644 (file)
@@ -48,6 +48,7 @@ EXPORT_SYMBOL(memory_end);
 char __initdata command_line[COMMAND_LINE_SIZE];
 
 /* machine dependent timer functions */
+void (*mach_sched_init)(irq_handler_t handler) __initdata = NULL;
 int (*mach_set_clock_mmss)(unsigned long);
 int (*mach_hwclk) (int, struct rtc_time*);
 
index ca3b3b4d463039f26fd47138b271f462cfeff649..5fa42f1267065e6f472eb6dfdfe34c3b0b801a90 100644 (file)
@@ -32,12 +32,11 @@ static inline int set_rtc_mmss(unsigned long nowtime)
        return -1;
 }
 
-#ifndef CONFIG_GENERIC_CLOCKEVENTS
 /*
  * timer_interrupt() needs to keep up the real-time clock,
  * as well as call the "xtime_update()" routine every clocktick
  */
-irqreturn_t arch_timer_interrupt(int irq, void *dummy)
+static irqreturn_t timer_interrupt(int irq, void *dummy)
 {
 
        if (current->pid)
@@ -49,7 +48,6 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy)
 
        return(IRQ_HANDLED);
 }
-#endif
 
 void read_persistent_clock(struct timespec *ts)
 {
@@ -72,7 +70,7 @@ int update_persistent_clock(struct timespec now)
        return set_rtc_mmss(now.tv_sec);
 }
 
-void time_init(void)
+void __init time_init(void)
 {
-       hw_timer_init();
+       mach_sched_init(timer_interrupt);
 }
index 6fa3f800277afa22de9167ed91d005c264474a6c..7826b70b1741a04866838e6ad93d1ea5dc97c44a 100644 (file)
@@ -105,6 +105,7 @@ void __init config_BSP(char *commandp, int size)
 #endif /* CONFIG_NETtel */
 
        mach_reset = m5206_cpu_reset;
+       mach_sched_init = hw_timer_init;
        m5206_timers_init();
        m5206_uarts_init();
 
index 8a98683f1b15a4062abee4497643c23fe96edf00..61c25151d2211deaa384464a8f4699e1f5ed3cbd 100644 (file)
@@ -291,6 +291,7 @@ static void m520x_cpu_reset(void)
 void __init config_BSP(char *commandp, int size)
 {
        mach_reset = m520x_cpu_reset;
+       mach_sched_init = hw_timer_init;
        m520x_uarts_init();
        m520x_fec_init();
 #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
index 71f4436ec8098c883ad65f06aa39037b85463ec1..aa28392ca4ce7883e72ff989e5d129134695100a 100644 (file)
@@ -274,6 +274,7 @@ static void m523x_cpu_reset(void)
 void __init config_BSP(char *commandp, int size)
 {
        mach_reset = m523x_cpu_reset;
+       mach_sched_init = hw_timer_init;
 }
 
 /***************************************************************************/
index ceb31e5744a6f0c63dbe9429612a5d0d8847c44a..50e2d8f232510dcccfb15cd598a25274605c497e 100644 (file)
@@ -307,6 +307,7 @@ void m5249_cpu_reset(void)
 void __init config_BSP(char *commandp, int size)
 {
        mach_reset = m5249_cpu_reset;
+       mach_sched_init = hw_timer_init;
        m5249_timers_init();
        m5249_uarts_init();
 #ifdef CONFIG_M5249C3
index 65bb582734e1faea91d2a707e4107a55bbd90145..426e66c44736440ac29b596b1ae866915a314286 100644 (file)
@@ -146,6 +146,7 @@ void __init config_BSP(char *commandp, int size)
 #endif
 
        mach_reset = m5272_cpu_reset;
+       mach_sched_init = hw_timer_init;
 }
 
 /***************************************************************************/
index 3ebc769cefda9f44ffadd4ce08eae0b8eb593ab9..c948a16beea83386425138e8dc6abc3db860e9e6 100644 (file)
@@ -364,6 +364,7 @@ static void m527x_cpu_reset(void)
 void __init config_BSP(char *commandp, int size)
 {
        mach_reset = m527x_cpu_reset;
+       mach_sched_init = hw_timer_init;
        m527x_uarts_init();
        m527x_fec_init();
 #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
index 7abe77a2f3e3c2b8f42264dd99824b2e9d9b4d71..08f397a382bbb2b4a936c7a4ef430cf0195cae1f 100644 (file)
@@ -306,6 +306,7 @@ void __init config_BSP(char *commandp, int size)
 static int __init init_BSP(void)
 {
        mach_reset = m528x_cpu_reset;
+       mach_sched_init = hw_timer_init;
        m528x_uarts_init();
        m528x_fec_init();
 #if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
index 00900ac06a9c9e4cdb51780b5741447c940a5e6a..6bf7c1cca62755406f21f5e20997db34eb3569f1 100644 (file)
@@ -115,6 +115,7 @@ void __init config_BSP(char *commandp, int size)
 #endif
 
        mach_reset = m5307_cpu_reset;
+       mach_sched_init = hw_timer_init;
        m5307_timers_init();
        m5307_uarts_init();
 
index ca51323f957b4ec86bf7e5be18080475d089677b..3558a620a00cbba39842493e7c47f85dce821a27 100644 (file)
@@ -263,6 +263,8 @@ void __init config_BSP(char *commandp, int size)
        }
 #endif
 
+       mach_sched_init = hw_timer_init;
+
 #ifdef CONFIG_BDM_DISABLE
        /*
         * Disable the BDM clocking.  This also turns off most of the rest of
index 70ea789a400c7cfd0df53783b3dd61b539c05771..4861be602dcd53567e833218e49171056bc8abf2 100644 (file)
@@ -99,6 +99,7 @@ void m5407_cpu_reset(void)
 void __init config_BSP(char *commandp, int size)
 {
        mach_reset = m5407_cpu_reset;
+       mach_sched_init = hw_timer_init;
        m5407_timers_init();
        m5407_uarts_init();
 
index ee043540bfa2af220c89e47ec640e196c1f2444c..8282ef1c783e8dbaffcf573ca2832d504dd9278d 100644 (file)
@@ -145,6 +145,7 @@ void __init config_BSP(char *commandp, int size)
        mmu_context_init();
 #endif
        mach_reset = mcf54xx_reset;
+       mach_sched_init = hw_timer_init;
        m54xx_uarts_init();
 }
 
index 02663d25822ddb6f8ce8363c8e7501f97b299867..e62dbbcb10f610af656d65522a96711c86b2dbae 100644 (file)
@@ -149,7 +149,7 @@ static struct clocksource pit_clk = {
 
 /***************************************************************************/
 
-void hw_timer_init(void)
+void hw_timer_init(irq_handler_t handler)
 {
        cf_pit_clockevent.cpumask = cpumask_of(smp_processor_id());
        cf_pit_clockevent.mult = div_sc(FREQ, NSEC_PER_SEC, 32);
index 54e1452f853a76162f26ca4f100a51b4982db611..2027fc20b8761eeb099a218fed8522ea9159fa06 100644 (file)
@@ -81,12 +81,14 @@ void mcfslt_profile_init(void)
 static u32 mcfslt_cycles_per_jiffy;
 static u32 mcfslt_cnt;
 
+static irq_handler_t timer_interrupt;
+
 static irqreturn_t mcfslt_tick(int irq, void *dummy)
 {
        /* Reset Slice Timer 0 */
        __raw_writel(MCFSLT_SSR_BE | MCFSLT_SSR_TE, TA(MCFSLT_SSR));
        mcfslt_cnt += mcfslt_cycles_per_jiffy;
-       return arch_timer_interrupt(irq, dummy);
+       return timer_interrupt(irq, dummy);
 }
 
 static struct irqaction mcfslt_timer_irq = {
@@ -121,7 +123,7 @@ static struct clocksource mcfslt_clk = {
        .flags  = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
-void hw_timer_init(void)
+void hw_timer_init(irq_handler_t handler)
 {
        mcfslt_cycles_per_jiffy = MCF_BUSCLK / HZ;
        /*
@@ -136,6 +138,7 @@ void hw_timer_init(void)
        /* initialize mcfslt_cnt knowing that slice timers count down */
        mcfslt_cnt = mcfslt_cycles_per_jiffy;
 
+       timer_interrupt = handler;
        setup_irq(MCF_IRQ_TIMER, &mcfslt_timer_irq);
 
        clocksource_register_hz(&mcfslt_clk, MCF_BUSCLK);
index 0d90da32fcdb7631f6eec295c9e98e0476e6ba3f..d0b4e9798fdef0fb004024feeaee0dbf1bce62cc 100644 (file)
@@ -47,6 +47,8 @@ void coldfire_profile_init(void);
 static u32 mcftmr_cycles_per_jiffy;
 static u32 mcftmr_cnt;
 
+static irq_handler_t timer_interrupt;
+
 /***************************************************************************/
 
 static irqreturn_t mcftmr_tick(int irq, void *dummy)
@@ -55,7 +57,7 @@ static irqreturn_t mcftmr_tick(int irq, void *dummy)
        __raw_writeb(MCFTIMER_TER_CAP | MCFTIMER_TER_REF, TA(MCFTIMER_TER));
 
        mcftmr_cnt += mcftmr_cycles_per_jiffy;
-       return arch_timer_interrupt(irq, dummy);
+       return timer_interrupt(irq, dummy);
 }
 
 /***************************************************************************/
@@ -94,7 +96,7 @@ static struct clocksource mcftmr_clk = {
 
 /***************************************************************************/
 
-void hw_timer_init(void)
+void hw_timer_init(irq_handler_t handler)
 {
        __raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR));
        mcftmr_cycles_per_jiffy = FREQ / HZ;
@@ -110,6 +112,7 @@ void hw_timer_init(void)
 
        clocksource_register_hz(&mcftmr_clk, FREQ);
 
+       timer_interrupt = handler;
        setup_irq(MCF_IRQ_TIMER, &mcftmr_timer_irq);
 
 #ifdef CONFIG_HIGHPROFILE
This page took 0.033414 seconds and 5 git commands to generate.