diff options
Diffstat (limited to 'arch/arm/mach-omap1/time.c')
-rw-r--r-- | arch/arm/mach-omap1/time.c | 58 |
1 files changed, 4 insertions, 54 deletions
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c index 485a21d31004..b8faffa44f9e 100644 --- a/arch/arm/mach-omap1/time.c +++ b/arch/arm/mach-omap1/time.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
38 | #include <linux/delay.h> | 38 | #include <linux/delay.h> |
39 | #include <linux/interrupt.h> | 39 | #include <linux/interrupt.h> |
40 | #include <linux/sched.h> | ||
41 | #include <linux/spinlock.h> | 40 | #include <linux/spinlock.h> |
42 | #include <linux/clk.h> | 41 | #include <linux/clk.h> |
43 | #include <linux/err.h> | 42 | #include <linux/err.h> |
@@ -190,30 +189,9 @@ static __init void omap_init_mpu_timer(unsigned long rate) | |||
190 | * --------------------------------------------------------------------------- | 189 | * --------------------------------------------------------------------------- |
191 | */ | 190 | */ |
192 | 191 | ||
193 | static DEFINE_CLOCK_DATA(cd); | 192 | static u32 notrace omap_mpu_read_sched_clock(void) |
194 | |||
195 | static inline unsigned long long notrace _omap_mpu_sched_clock(void) | ||
196 | { | ||
197 | u32 cyc = ~omap_mpu_timer_read(1); | ||
198 | return cyc_to_sched_clock(&cd, cyc, (u32)~0); | ||
199 | } | ||
200 | |||
201 | #ifndef CONFIG_OMAP_32K_TIMER | ||
202 | unsigned long long notrace sched_clock(void) | ||
203 | { | ||
204 | return _omap_mpu_sched_clock(); | ||
205 | } | ||
206 | #else | ||
207 | static unsigned long long notrace omap_mpu_sched_clock(void) | ||
208 | { | ||
209 | return _omap_mpu_sched_clock(); | ||
210 | } | ||
211 | #endif | ||
212 | |||
213 | static void notrace mpu_update_sched_clock(void) | ||
214 | { | 193 | { |
215 | u32 cyc = ~omap_mpu_timer_read(1); | 194 | return ~omap_mpu_timer_read(1); |
216 | update_sched_clock(&cd, cyc, (u32)~0); | ||
217 | } | 195 | } |
218 | 196 | ||
219 | static void __init omap_init_clocksource(unsigned long rate) | 197 | static void __init omap_init_clocksource(unsigned long rate) |
@@ -223,7 +201,7 @@ static void __init omap_init_clocksource(unsigned long rate) | |||
223 | "%s: can't register clocksource!\n"; | 201 | "%s: can't register clocksource!\n"; |
224 | 202 | ||
225 | omap_mpu_timer_start(1, ~0, 1); | 203 | omap_mpu_timer_start(1, ~0, 1); |
226 | init_sched_clock(&cd, mpu_update_sched_clock, 32, rate); | 204 | setup_sched_clock(omap_mpu_read_sched_clock, 32, rate); |
227 | 205 | ||
228 | if (clocksource_mmio_init(&timer->read_tim, "mpu_timer2", rate, | 206 | if (clocksource_mmio_init(&timer->read_tim, "mpu_timer2", rate, |
229 | 300, 32, clocksource_mmio_readl_down)) | 207 | 300, 32, clocksource_mmio_readl_down)) |
@@ -254,30 +232,6 @@ static inline void omap_mpu_timer_init(void) | |||
254 | } | 232 | } |
255 | #endif /* CONFIG_OMAP_MPU_TIMER */ | 233 | #endif /* CONFIG_OMAP_MPU_TIMER */ |
256 | 234 | ||
257 | #if defined(CONFIG_OMAP_MPU_TIMER) && defined(CONFIG_OMAP_32K_TIMER) | ||
258 | static unsigned long long (*preferred_sched_clock)(void); | ||
259 | |||
260 | unsigned long long notrace sched_clock(void) | ||
261 | { | ||
262 | if (!preferred_sched_clock) | ||
263 | return 0; | ||
264 | |||
265 | return preferred_sched_clock(); | ||
266 | } | ||
267 | |||
268 | static inline void preferred_sched_clock_init(bool use_32k_sched_clock) | ||
269 | { | ||
270 | if (use_32k_sched_clock) | ||
271 | preferred_sched_clock = omap_32k_sched_clock; | ||
272 | else | ||
273 | preferred_sched_clock = omap_mpu_sched_clock; | ||
274 | } | ||
275 | #else | ||
276 | static inline void preferred_sched_clock_init(bool use_32k_sched_clcok) | ||
277 | { | ||
278 | } | ||
279 | #endif | ||
280 | |||
281 | static inline int omap_32k_timer_usable(void) | 235 | static inline int omap_32k_timer_usable(void) |
282 | { | 236 | { |
283 | int res = false; | 237 | int res = false; |
@@ -299,12 +253,8 @@ static inline int omap_32k_timer_usable(void) | |||
299 | */ | 253 | */ |
300 | static void __init omap1_timer_init(void) | 254 | static void __init omap1_timer_init(void) |
301 | { | 255 | { |
302 | if (omap_32k_timer_usable()) { | 256 | if (!omap_32k_timer_usable()) |
303 | preferred_sched_clock_init(1); | ||
304 | } else { | ||
305 | omap_mpu_timer_init(); | 257 | omap_mpu_timer_init(); |
306 | preferred_sched_clock_init(0); | ||
307 | } | ||
308 | } | 258 | } |
309 | 259 | ||
310 | struct sys_timer omap1_timer = { | 260 | struct sys_timer omap1_timer = { |