diff options
-rw-r--r-- | arch/mips/kernel/time.c | 57 | ||||
-rw-r--r-- | arch/mips/qemu/q-irq.c | 1 | ||||
-rw-r--r-- | include/asm-mips/time.h | 13 |
3 files changed, 12 insertions, 59 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 | */ | ||
68 | static 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 | */ |
76 | static cycle_t c0_hpt_read(void) | 56 | static cycle_t c0_hpt_read(void) |
@@ -104,6 +84,13 @@ EXPORT_SYMBOL(perf_irq); | |||
104 | 84 | ||
105 | unsigned int mips_hpt_frequency; | 85 | unsigned int mips_hpt_frequency; |
106 | 86 | ||
87 | static 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 | |||
107 | static unsigned int __init calibrate_hpt(void) | 94 | static 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 | ||
149 | struct clocksource clocksource_mips = { | ||
150 | .name = "MIPS", | ||
151 | .mask = CLOCKSOURCE_MASK(32), | ||
152 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | ||
153 | }; | ||
154 | |||
155 | void __init clocksource_set_clock(struct clocksource *cs, unsigned int clock) | 136 | void __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 | ||
188 | static void __init init_mips_clocksource(void) | 169 | static 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 | */ |
214 | void __init plat_timer_setup(struct irqaction *irq) | 192 | void __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> |
diff --git a/include/asm-mips/time.h b/include/asm-mips/time.h index a45f24a9ea66..ee1663e64da1 100644 --- a/include/asm-mips/time.h +++ b/include/asm-mips/time.h | |||
@@ -10,15 +10,10 @@ | |||
10 | * under the terms of the GNU General Public License as published by the | 10 | * under the terms of the GNU General Public License as published by the |
11 | * Free Software Foundation; either version 2 of the License, or (at your | 11 | * Free Software Foundation; either version 2 of the License, or (at your |
12 | * option) any later version. | 12 | * option) any later version. |
13 | * | ||
14 | * Please refer to Documentation/mips/time.README. | ||
15 | */ | 13 | */ |
16 | #ifndef _ASM_TIME_H | 14 | #ifndef _ASM_TIME_H |
17 | #define _ASM_TIME_H | 15 | #define _ASM_TIME_H |
18 | 16 | ||
19 | #include <linux/interrupt.h> | ||
20 | #include <linux/linkage.h> | ||
21 | #include <linux/ptrace.h> | ||
22 | #include <linux/rtc.h> | 17 | #include <linux/rtc.h> |
23 | #include <linux/spinlock.h> | 18 | #include <linux/spinlock.h> |
24 | #include <linux/clockchips.h> | 19 | #include <linux/clockchips.h> |
@@ -38,20 +33,12 @@ extern int rtc_mips_set_mmss(unsigned long); | |||
38 | /* | 33 | /* |
39 | * Timer interrupt functions. | 34 | * Timer interrupt functions. |
40 | * mips_timer_state is needed for high precision timer calibration. | 35 | * mips_timer_state is needed for high precision timer calibration. |
41 | * mips_timer_ack may be NULL if the interrupt is self-recoverable. | ||
42 | */ | 36 | */ |
43 | extern int (*mips_timer_state)(void); | 37 | extern int (*mips_timer_state)(void); |
44 | 38 | ||
45 | /* | 39 | /* |
46 | * High precision timer clocksource. | ||
47 | * If .read is NULL, an R4k-compatible timer setup is attempted. | ||
48 | */ | ||
49 | extern struct clocksource clocksource_mips; | ||
50 | |||
51 | /* | ||
52 | * board specific routines required by time_init(). | 40 | * board specific routines required by time_init(). |
53 | */ | 41 | */ |
54 | struct irqaction; | ||
55 | extern void plat_time_init(void); | 42 | extern void plat_time_init(void); |
56 | 43 | ||
57 | /* | 44 | /* |