aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2007-10-30 12:21:03 -0400
committerRalf Baechle <ralf@linux-mips.org>2007-11-02 12:13:46 -0400
commitd9eec1a5d6ae54b0f7562ffe07008a33ac39e8fe (patch)
tree2da898720a0240a778df00a0488db3f9593da190 /arch/mips
parent1d0a909cfc41f17175023b939b28322e427746b4 (diff)
[MIPS] time: Code cleanups
* Do not include unnecessary headers. * Do not mention time.README. * Do not mention mips_timer_ack. * Make clocksource_mips static. It is now dedicated to c0_timer. * Initialize clocksource_mips.read statically. * Remove null_hpt_read. * Remove an argument of plat_timer_setup. It is just a placeholder. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/kernel/time.c57
-rw-r--r--arch/mips/qemu/q-irq.c1
2 files changed, 12 insertions, 46 deletions
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 622379b201aa..3284b9b4ecac 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -3,8 +3,7 @@
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net 3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 * Copyright (c) 2003, 2004 Maciej W. Rozycki 4 * Copyright (c) 2003, 2004 Maciej W. Rozycki
5 * 5 *
6 * Common time service routines for MIPS machines. See 6 * Common time service routines for MIPS machines.
7 * Documentation/mips/time.README.
8 * 7 *
9 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the 9 * under the terms of the GNU General Public License as published by the
@@ -18,28 +17,17 @@
18#include <linux/init.h> 17#include <linux/init.h>
19#include <linux/sched.h> 18#include <linux/sched.h>
20#include <linux/param.h> 19#include <linux/param.h>
21#include <linux/profile.h>
22#include <linux/time.h> 20#include <linux/time.h>
23#include <linux/timex.h> 21#include <linux/timex.h>
24#include <linux/smp.h> 22#include <linux/smp.h>
25#include <linux/kernel_stat.h>
26#include <linux/spinlock.h> 23#include <linux/spinlock.h>
27#include <linux/interrupt.h>
28#include <linux/module.h> 24#include <linux/module.h>
29#include <linux/kallsyms.h>
30 25
31#include <asm/bootinfo.h>
32#include <asm/cache.h>
33#include <asm/compiler.h>
34#include <asm/cpu.h>
35#include <asm/cpu-features.h> 26#include <asm/cpu-features.h>
36#include <asm/div64.h> 27#include <asm/div64.h>
37#include <asm/sections.h>
38#include <asm/smtc_ipi.h> 28#include <asm/smtc_ipi.h>
39#include <asm/time.h> 29#include <asm/time.h>
40 30
41#include <irq.h>
42
43/* 31/*
44 * forward reference 32 * forward reference
45 */ 33 */
@@ -63,14 +51,6 @@ int update_persistent_clock(struct timespec now)
63} 51}
64 52
65/* 53/*
66 * Null high precision timer functions for systems lacking one.
67 */
68static cycle_t null_hpt_read(void)
69{
70 return 0;
71}
72
73/*
74 * High precision timer functions for a R4k-compatible timer. 54 * High precision timer functions for a R4k-compatible timer.
75 */ 55 */
76static cycle_t c0_hpt_read(void) 56static cycle_t c0_hpt_read(void)
@@ -104,6 +84,13 @@ EXPORT_SYMBOL(perf_irq);
104 84
105unsigned int mips_hpt_frequency; 85unsigned int mips_hpt_frequency;
106 86
87static struct clocksource clocksource_mips = {
88 .name = "MIPS",
89 .read = c0_hpt_read,
90 .mask = CLOCKSOURCE_MASK(32),
91 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
92};
93
107static unsigned int __init calibrate_hpt(void) 94static unsigned int __init calibrate_hpt(void)
108{ 95{
109 cycle_t frequency, hpt_start, hpt_end, hpt_count, hz; 96 cycle_t frequency, hpt_start, hpt_end, hpt_count, hz;
@@ -146,12 +133,6 @@ static unsigned int __init calibrate_hpt(void)
146 return frequency >> log_2_loops; 133 return frequency >> log_2_loops;
147} 134}
148 135
149struct clocksource clocksource_mips = {
150 .name = "MIPS",
151 .mask = CLOCKSOURCE_MASK(32),
152 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
153};
154
155void __init clocksource_set_clock(struct clocksource *cs, unsigned int clock) 136void __init clocksource_set_clock(struct clocksource *cs, unsigned int clock)
156{ 137{
157 u64 temp; 138 u64 temp;
@@ -187,9 +168,6 @@ void __cpuinit clockevent_set_clock(struct clock_event_device *cd,
187 168
188static void __init init_mips_clocksource(void) 169static void __init init_mips_clocksource(void)
189{ 170{
190 if (!mips_hpt_frequency || clocksource_mips.read == null_hpt_read)
191 return;
192
193 /* Calclate a somewhat reasonable rating value */ 171 /* Calclate a somewhat reasonable rating value */
194 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000; 172 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000;
195 173
@@ -211,7 +189,7 @@ void __init __weak plat_time_init(void)
211 * setup_irq calls and each clock_event_device should use its own 189 * setup_irq calls and each clock_event_device should use its own
212 * struct irqrequest. 190 * struct irqrequest.
213 */ 191 */
214void __init plat_timer_setup(struct irqaction *irq) 192void __init plat_timer_setup(void)
215{ 193{
216 BUG(); 194 BUG();
217} 195}
@@ -220,21 +198,8 @@ void __init time_init(void)
220{ 198{
221 plat_time_init(); 199 plat_time_init();
222 200
223 /* Choose appropriate high precision timer routines. */ 201 if (cpu_has_counter && (mips_hpt_frequency || mips_timer_state)) {
224 if (!cpu_has_counter && !clocksource_mips.read)
225 /* No high precision timer -- sorry. */
226 clocksource_mips.read = null_hpt_read;
227 else if (!mips_hpt_frequency && !mips_timer_state) {
228 /* A high precision timer of unknown frequency. */
229 if (!clocksource_mips.read)
230 /* No external high precision timer -- use R4k. */
231 clocksource_mips.read = c0_hpt_read;
232 } else {
233 /* We know counter frequency. Or we can get it. */ 202 /* We know counter frequency. Or we can get it. */
234 if (!clocksource_mips.read) {
235 /* No external high precision timer -- use R4k. */
236 clocksource_mips.read = c0_hpt_read;
237 }
238 if (!mips_hpt_frequency) 203 if (!mips_hpt_frequency)
239 mips_hpt_frequency = calibrate_hpt(); 204 mips_hpt_frequency = calibrate_hpt();
240 205
@@ -242,8 +207,8 @@ void __init time_init(void)
242 printk("Using %u.%03u MHz high precision timer.\n", 207 printk("Using %u.%03u MHz high precision timer.\n",
243 ((mips_hpt_frequency + 500) / 1000) / 1000, 208 ((mips_hpt_frequency + 500) / 1000) / 1000,
244 ((mips_hpt_frequency + 500) / 1000) % 1000); 209 ((mips_hpt_frequency + 500) / 1000) % 1000);
210 init_mips_clocksource();
245 } 211 }
246 212
247 init_mips_clocksource();
248 mips_clockevent_init(); 213 mips_clockevent_init();
249} 214}
diff --git a/arch/mips/qemu/q-irq.c b/arch/mips/qemu/q-irq.c
index 4681757460a1..11f984767880 100644
--- a/arch/mips/qemu/q-irq.c
+++ b/arch/mips/qemu/q-irq.c
@@ -1,4 +1,5 @@
1#include <linux/init.h> 1#include <linux/init.h>
2#include <linux/interrupt.h>
2#include <linux/linkage.h> 3#include <linux/linkage.h>
3 4
4#include <asm/i8259.h> 5#include <asm/i8259.h>