aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k
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
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')
-rw-r--r--arch/m68k/include/asm/machdep.h3
-rw-r--r--arch/m68k/kernel/setup_no.c1
-rw-r--r--arch/m68k/kernel/time_no.c8
-rw-r--r--arch/m68k/platform/5206/config.c1
-rw-r--r--arch/m68k/platform/520x/config.c1
-rw-r--r--arch/m68k/platform/523x/config.c1
-rw-r--r--arch/m68k/platform/5249/config.c1
-rw-r--r--arch/m68k/platform/5272/config.c1
-rw-r--r--arch/m68k/platform/527x/config.c1
-rw-r--r--arch/m68k/platform/528x/config.c1
-rw-r--r--arch/m68k/platform/5307/config.c1
-rw-r--r--arch/m68k/platform/532x/config.c2
-rw-r--r--arch/m68k/platform/5407/config.c1
-rw-r--r--arch/m68k/platform/54xx/config.c1
-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
17 files changed, 28 insertions, 12 deletions
diff --git a/arch/m68k/include/asm/machdep.h b/arch/m68k/include/asm/machdep.h
index 3bfa7df35729..825c1c813196 100644
--- a/arch/m68k/include/asm/machdep.h
+++ b/arch/m68k/include/asm/machdep.h
@@ -33,9 +33,8 @@ extern void (*mach_l2_flush) (int);
33extern void (*mach_beep) (unsigned int, unsigned int); 33extern void (*mach_beep) (unsigned int, unsigned int);
34 34
35/* Hardware clock functions */ 35/* Hardware clock functions */
36extern void hw_timer_init(void); 36extern void hw_timer_init(irq_handler_t handler);
37extern unsigned long hw_timer_offset(void); 37extern unsigned long hw_timer_offset(void);
38extern irqreturn_t arch_timer_interrupt(int irq, void *dummy);
39 38
40extern void config_BSP(char *command, int len); 39extern void config_BSP(char *command, int len);
41 40
diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c
index 8394b56b2c72..7dc186b7a85f 100644
--- a/arch/m68k/kernel/setup_no.c
+++ b/arch/m68k/kernel/setup_no.c
@@ -48,6 +48,7 @@ EXPORT_SYMBOL(memory_end);
48char __initdata command_line[COMMAND_LINE_SIZE]; 48char __initdata command_line[COMMAND_LINE_SIZE];
49 49
50/* machine dependent timer functions */ 50/* machine dependent timer functions */
51void (*mach_sched_init)(irq_handler_t handler) __initdata = NULL;
51int (*mach_set_clock_mmss)(unsigned long); 52int (*mach_set_clock_mmss)(unsigned long);
52int (*mach_hwclk) (int, struct rtc_time*); 53int (*mach_hwclk) (int, struct rtc_time*);
53 54
diff --git a/arch/m68k/kernel/time_no.c b/arch/m68k/kernel/time_no.c
index ca3b3b4d4630..5fa42f126706 100644
--- a/arch/m68k/kernel/time_no.c
+++ b/arch/m68k/kernel/time_no.c
@@ -32,12 +32,11 @@ static inline int set_rtc_mmss(unsigned long nowtime)
32 return -1; 32 return -1;
33} 33}
34 34
35#ifndef CONFIG_GENERIC_CLOCKEVENTS
36/* 35/*
37 * timer_interrupt() needs to keep up the real-time clock, 36 * timer_interrupt() needs to keep up the real-time clock,
38 * as well as call the "xtime_update()" routine every clocktick 37 * as well as call the "xtime_update()" routine every clocktick
39 */ 38 */
40irqreturn_t arch_timer_interrupt(int irq, void *dummy) 39static irqreturn_t timer_interrupt(int irq, void *dummy)
41{ 40{
42 41
43 if (current->pid) 42 if (current->pid)
@@ -49,7 +48,6 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy)
49 48
50 return(IRQ_HANDLED); 49 return(IRQ_HANDLED);
51} 50}
52#endif
53 51
54void read_persistent_clock(struct timespec *ts) 52void read_persistent_clock(struct timespec *ts)
55{ 53{
@@ -72,7 +70,7 @@ int update_persistent_clock(struct timespec now)
72 return set_rtc_mmss(now.tv_sec); 70 return set_rtc_mmss(now.tv_sec);
73} 71}
74 72
75void time_init(void) 73void __init time_init(void)
76{ 74{
77 hw_timer_init(); 75 mach_sched_init(timer_interrupt);
78} 76}
diff --git a/arch/m68k/platform/5206/config.c b/arch/m68k/platform/5206/config.c
index 6fa3f800277a..7826b70b1741 100644
--- a/arch/m68k/platform/5206/config.c
+++ b/arch/m68k/platform/5206/config.c
@@ -105,6 +105,7 @@ void __init config_BSP(char *commandp, int size)
105#endif /* CONFIG_NETtel */ 105#endif /* CONFIG_NETtel */
106 106
107 mach_reset = m5206_cpu_reset; 107 mach_reset = m5206_cpu_reset;
108 mach_sched_init = hw_timer_init;
108 m5206_timers_init(); 109 m5206_timers_init();
109 m5206_uarts_init(); 110 m5206_uarts_init();
110 111
diff --git a/arch/m68k/platform/520x/config.c b/arch/m68k/platform/520x/config.c
index 8a98683f1b15..61c25151d221 100644
--- a/arch/m68k/platform/520x/config.c
+++ b/arch/m68k/platform/520x/config.c
@@ -291,6 +291,7 @@ static void m520x_cpu_reset(void)
291void __init config_BSP(char *commandp, int size) 291void __init config_BSP(char *commandp, int size)
292{ 292{
293 mach_reset = m520x_cpu_reset; 293 mach_reset = m520x_cpu_reset;
294 mach_sched_init = hw_timer_init;
294 m520x_uarts_init(); 295 m520x_uarts_init();
295 m520x_fec_init(); 296 m520x_fec_init();
296#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 297#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
diff --git a/arch/m68k/platform/523x/config.c b/arch/m68k/platform/523x/config.c
index 71f4436ec809..aa28392ca4ce 100644
--- a/arch/m68k/platform/523x/config.c
+++ b/arch/m68k/platform/523x/config.c
@@ -274,6 +274,7 @@ static void m523x_cpu_reset(void)
274void __init config_BSP(char *commandp, int size) 274void __init config_BSP(char *commandp, int size)
275{ 275{
276 mach_reset = m523x_cpu_reset; 276 mach_reset = m523x_cpu_reset;
277 mach_sched_init = hw_timer_init;
277} 278}
278 279
279/***************************************************************************/ 280/***************************************************************************/
diff --git a/arch/m68k/platform/5249/config.c b/arch/m68k/platform/5249/config.c
index ceb31e5744a6..50e2d8f23251 100644
--- a/arch/m68k/platform/5249/config.c
+++ b/arch/m68k/platform/5249/config.c
@@ -307,6 +307,7 @@ void m5249_cpu_reset(void)
307void __init config_BSP(char *commandp, int size) 307void __init config_BSP(char *commandp, int size)
308{ 308{
309 mach_reset = m5249_cpu_reset; 309 mach_reset = m5249_cpu_reset;
310 mach_sched_init = hw_timer_init;
310 m5249_timers_init(); 311 m5249_timers_init();
311 m5249_uarts_init(); 312 m5249_uarts_init();
312#ifdef CONFIG_M5249C3 313#ifdef CONFIG_M5249C3
diff --git a/arch/m68k/platform/5272/config.c b/arch/m68k/platform/5272/config.c
index 65bb582734e1..426e66c44736 100644
--- a/arch/m68k/platform/5272/config.c
+++ b/arch/m68k/platform/5272/config.c
@@ -146,6 +146,7 @@ void __init config_BSP(char *commandp, int size)
146#endif 146#endif
147 147
148 mach_reset = m5272_cpu_reset; 148 mach_reset = m5272_cpu_reset;
149 mach_sched_init = hw_timer_init;
149} 150}
150 151
151/***************************************************************************/ 152/***************************************************************************/
diff --git a/arch/m68k/platform/527x/config.c b/arch/m68k/platform/527x/config.c
index 3ebc769cefda..c948a16beea8 100644
--- a/arch/m68k/platform/527x/config.c
+++ b/arch/m68k/platform/527x/config.c
@@ -364,6 +364,7 @@ static void m527x_cpu_reset(void)
364void __init config_BSP(char *commandp, int size) 364void __init config_BSP(char *commandp, int size)
365{ 365{
366 mach_reset = m527x_cpu_reset; 366 mach_reset = m527x_cpu_reset;
367 mach_sched_init = hw_timer_init;
367 m527x_uarts_init(); 368 m527x_uarts_init();
368 m527x_fec_init(); 369 m527x_fec_init();
369#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 370#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
diff --git a/arch/m68k/platform/528x/config.c b/arch/m68k/platform/528x/config.c
index 7abe77a2f3e3..08f397a382bb 100644
--- a/arch/m68k/platform/528x/config.c
+++ b/arch/m68k/platform/528x/config.c
@@ -306,6 +306,7 @@ void __init config_BSP(char *commandp, int size)
306static int __init init_BSP(void) 306static int __init init_BSP(void)
307{ 307{
308 mach_reset = m528x_cpu_reset; 308 mach_reset = m528x_cpu_reset;
309 mach_sched_init = hw_timer_init;
309 m528x_uarts_init(); 310 m528x_uarts_init();
310 m528x_fec_init(); 311 m528x_fec_init();
311#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE) 312#if defined(CONFIG_SPI_COLDFIRE_QSPI) || defined(CONFIG_SPI_COLDFIRE_QSPI_MODULE)
diff --git a/arch/m68k/platform/5307/config.c b/arch/m68k/platform/5307/config.c
index 00900ac06a9c..6bf7c1cca627 100644
--- a/arch/m68k/platform/5307/config.c
+++ b/arch/m68k/platform/5307/config.c
@@ -115,6 +115,7 @@ void __init config_BSP(char *commandp, int size)
115#endif 115#endif
116 116
117 mach_reset = m5307_cpu_reset; 117 mach_reset = m5307_cpu_reset;
118 mach_sched_init = hw_timer_init;
118 m5307_timers_init(); 119 m5307_timers_init();
119 m5307_uarts_init(); 120 m5307_uarts_init();
120 121
diff --git a/arch/m68k/platform/532x/config.c b/arch/m68k/platform/532x/config.c
index ca51323f957b..3558a620a00c 100644
--- a/arch/m68k/platform/532x/config.c
+++ b/arch/m68k/platform/532x/config.c
@@ -263,6 +263,8 @@ void __init config_BSP(char *commandp, int size)
263 } 263 }
264#endif 264#endif
265 265
266 mach_sched_init = hw_timer_init;
267
266#ifdef CONFIG_BDM_DISABLE 268#ifdef CONFIG_BDM_DISABLE
267 /* 269 /*
268 * Disable the BDM clocking. This also turns off most of the rest of 270 * Disable the BDM clocking. This also turns off most of the rest of
diff --git a/arch/m68k/platform/5407/config.c b/arch/m68k/platform/5407/config.c
index 70ea789a400c..4861be602dcd 100644
--- a/arch/m68k/platform/5407/config.c
+++ b/arch/m68k/platform/5407/config.c
@@ -99,6 +99,7 @@ void m5407_cpu_reset(void)
99void __init config_BSP(char *commandp, int size) 99void __init config_BSP(char *commandp, int size)
100{ 100{
101 mach_reset = m5407_cpu_reset; 101 mach_reset = m5407_cpu_reset;
102 mach_sched_init = hw_timer_init;
102 m5407_timers_init(); 103 m5407_timers_init();
103 m5407_uarts_init(); 104 m5407_uarts_init();
104 105
diff --git a/arch/m68k/platform/54xx/config.c b/arch/m68k/platform/54xx/config.c
index ee043540bfa2..8282ef1c783e 100644
--- a/arch/m68k/platform/54xx/config.c
+++ b/arch/m68k/platform/54xx/config.c
@@ -145,6 +145,7 @@ void __init config_BSP(char *commandp, int size)
145 mmu_context_init(); 145 mmu_context_init();
146#endif 146#endif
147 mach_reset = mcf54xx_reset; 147 mach_reset = mcf54xx_reset;
148 mach_sched_init = hw_timer_init;
148 m54xx_uarts_init(); 149 m54xx_uarts_init();
149} 150}
150 151
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