aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/platform/coldfire
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@uclinux.org>2012-01-23 00:34:58 -0500
committerGreg Ungerer <gerg@uclinux.org>2012-03-04 18:43:04 -0500
commit35aefb2645d1ae7576699b2d7b66d6c9503113fc (patch)
treed2976ce7f95983751e42c33bcb61923a120aa072 /arch/m68k/platform/coldfire
parent9517746131f62294ddd922bcd288415be5104c23 (diff)
m68knommu: modify timer init code to make it consistent with m68k code
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>
Diffstat (limited to 'arch/m68k/platform/coldfire')
-rw-r--r--arch/m68k/platform/coldfire/pit.c2
-rw-r--r--arch/m68k/platform/coldfire/sltimers.c7
-rw-r--r--arch/m68k/platform/coldfire/timers.c7
3 files changed, 11 insertions, 5 deletions
diff --git a/arch/m68k/platform/coldfire/pit.c b/arch/m68k/platform/coldfire/pit.c
index 02663d25822d..e62dbbcb10f6 100644
--- a/arch/m68k/platform/coldfire/pit.c
+++ b/arch/m68k/platform/coldfire/pit.c
@@ -149,7 +149,7 @@ static struct clocksource pit_clk = {
149 149
150/***************************************************************************/ 150/***************************************************************************/
151 151
152void hw_timer_init(void) 152void hw_timer_init(irq_handler_t handler)
153{ 153{
154 cf_pit_clockevent.cpumask = cpumask_of(smp_processor_id()); 154 cf_pit_clockevent.cpumask = cpumask_of(smp_processor_id());
155 cf_pit_clockevent.mult = div_sc(FREQ, NSEC_PER_SEC, 32); 155 cf_pit_clockevent.mult = div_sc(FREQ, NSEC_PER_SEC, 32);
diff --git a/arch/m68k/platform/coldfire/sltimers.c b/arch/m68k/platform/coldfire/sltimers.c
index 54e1452f853a..2027fc20b876 100644
--- a/arch/m68k/platform/coldfire/sltimers.c
+++ b/arch/m68k/platform/coldfire/sltimers.c
@@ -81,12 +81,14 @@ void mcfslt_profile_init(void)
81static u32 mcfslt_cycles_per_jiffy; 81static u32 mcfslt_cycles_per_jiffy;
82static u32 mcfslt_cnt; 82static u32 mcfslt_cnt;
83 83
84static irq_handler_t timer_interrupt;
85
84static irqreturn_t mcfslt_tick(int irq, void *dummy) 86static irqreturn_t mcfslt_tick(int irq, void *dummy)
85{ 87{
86 /* Reset Slice Timer 0 */ 88 /* Reset Slice Timer 0 */
87 __raw_writel(MCFSLT_SSR_BE | MCFSLT_SSR_TE, TA(MCFSLT_SSR)); 89 __raw_writel(MCFSLT_SSR_BE | MCFSLT_SSR_TE, TA(MCFSLT_SSR));
88 mcfslt_cnt += mcfslt_cycles_per_jiffy; 90 mcfslt_cnt += mcfslt_cycles_per_jiffy;
89 return arch_timer_interrupt(irq, dummy); 91 return timer_interrupt(irq, dummy);
90} 92}
91 93
92static struct irqaction mcfslt_timer_irq = { 94static struct irqaction mcfslt_timer_irq = {
@@ -121,7 +123,7 @@ static struct clocksource mcfslt_clk = {
121 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 123 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
122}; 124};
123 125
124void hw_timer_init(void) 126void hw_timer_init(irq_handler_t handler)
125{ 127{
126 mcfslt_cycles_per_jiffy = MCF_BUSCLK / HZ; 128 mcfslt_cycles_per_jiffy = MCF_BUSCLK / HZ;
127 /* 129 /*
@@ -136,6 +138,7 @@ void hw_timer_init(void)
136 /* initialize mcfslt_cnt knowing that slice timers count down */ 138 /* initialize mcfslt_cnt knowing that slice timers count down */
137 mcfslt_cnt = mcfslt_cycles_per_jiffy; 139 mcfslt_cnt = mcfslt_cycles_per_jiffy;
138 140
141 timer_interrupt = handler;
139 setup_irq(MCF_IRQ_TIMER, &mcfslt_timer_irq); 142 setup_irq(MCF_IRQ_TIMER, &mcfslt_timer_irq);
140 143
141 clocksource_register_hz(&mcfslt_clk, MCF_BUSCLK); 144 clocksource_register_hz(&mcfslt_clk, MCF_BUSCLK);
diff --git a/arch/m68k/platform/coldfire/timers.c b/arch/m68k/platform/coldfire/timers.c
index 0d90da32fcdb..d0b4e9798fde 100644
--- a/arch/m68k/platform/coldfire/timers.c
+++ b/arch/m68k/platform/coldfire/timers.c
@@ -47,6 +47,8 @@ void coldfire_profile_init(void);
47static u32 mcftmr_cycles_per_jiffy; 47static u32 mcftmr_cycles_per_jiffy;
48static u32 mcftmr_cnt; 48static u32 mcftmr_cnt;
49 49
50static irq_handler_t timer_interrupt;
51
50/***************************************************************************/ 52/***************************************************************************/
51 53
52static irqreturn_t mcftmr_tick(int irq, void *dummy) 54static irqreturn_t mcftmr_tick(int irq, void *dummy)
@@ -55,7 +57,7 @@ static irqreturn_t mcftmr_tick(int irq, void *dummy)
55 __raw_writeb(MCFTIMER_TER_CAP | MCFTIMER_TER_REF, TA(MCFTIMER_TER)); 57 __raw_writeb(MCFTIMER_TER_CAP | MCFTIMER_TER_REF, TA(MCFTIMER_TER));
56 58
57 mcftmr_cnt += mcftmr_cycles_per_jiffy; 59 mcftmr_cnt += mcftmr_cycles_per_jiffy;
58 return arch_timer_interrupt(irq, dummy); 60 return timer_interrupt(irq, dummy);
59} 61}
60 62
61/***************************************************************************/ 63/***************************************************************************/
@@ -94,7 +96,7 @@ static struct clocksource mcftmr_clk = {
94 96
95/***************************************************************************/ 97/***************************************************************************/
96 98
97void hw_timer_init(void) 99void hw_timer_init(irq_handler_t handler)
98{ 100{
99 __raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR)); 101 __raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR));
100 mcftmr_cycles_per_jiffy = FREQ / HZ; 102 mcftmr_cycles_per_jiffy = FREQ / HZ;
@@ -110,6 +112,7 @@ void hw_timer_init(void)
110 112
111 clocksource_register_hz(&mcftmr_clk, FREQ); 113 clocksource_register_hz(&mcftmr_clk, FREQ);
112 114
115 timer_interrupt = handler;
113 setup_irq(MCF_IRQ_TIMER, &mcftmr_timer_irq); 116 setup_irq(MCF_IRQ_TIMER, &mcftmr_timer_irq);
114 117
115#ifdef CONFIG_HIGHPROFILE 118#ifdef CONFIG_HIGHPROFILE