aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap1/time.c')
-rw-r--r--arch/arm/mach-omap1/time.c49
1 files changed, 0 insertions, 49 deletions
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index a4f8b205543..5d2b270935a 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -56,37 +56,6 @@
56#define OMAP_MPU_TIMER_BASE OMAP_MPU_TIMER1_BASE 56#define OMAP_MPU_TIMER_BASE OMAP_MPU_TIMER1_BASE
57#define OMAP_MPU_TIMER_OFFSET 0x100 57#define OMAP_MPU_TIMER_OFFSET 0x100
58 58
59/* cycles to nsec conversions taken from arch/i386/kernel/timers/timer_tsc.c,
60 * converted to use kHz by Kevin Hilman */
61/* convert from cycles(64bits) => nanoseconds (64bits)
62 * basic equation:
63 * ns = cycles / (freq / ns_per_sec)
64 * ns = cycles * (ns_per_sec / freq)
65 * ns = cycles * (10^9 / (cpu_khz * 10^3))
66 * ns = cycles * (10^6 / cpu_khz)
67 *
68 * Then we use scaling math (suggested by george at mvista.com) to get:
69 * ns = cycles * (10^6 * SC / cpu_khz / SC
70 * ns = cycles * cyc2ns_scale / SC
71 *
72 * And since SC is a constant power of two, we can convert the div
73 * into a shift.
74 * -johnstul at us.ibm.com "math is hard, lets go shopping!"
75 */
76static unsigned long cyc2ns_scale;
77#define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */
78
79static inline void set_cyc2ns_scale(unsigned long cpu_khz)
80{
81 cyc2ns_scale = (1000000 << CYC2NS_SCALE_FACTOR)/cpu_khz;
82}
83
84static inline unsigned long long cycles_2_ns(unsigned long long cyc)
85{
86 return (cyc * cyc2ns_scale) >> CYC2NS_SCALE_FACTOR;
87}
88
89
90typedef struct { 59typedef struct {
91 u32 cntl; /* CNTL_TIMER, R/W */ 60 u32 cntl; /* CNTL_TIMER, R/W */
92 u32 load_tim; /* LOAD_TIM, W */ 61 u32 load_tim; /* LOAD_TIM, W */
@@ -194,8 +163,6 @@ static struct irqaction omap_mpu_timer1_irq = {
194 163
195static __init void omap_init_mpu_timer(unsigned long rate) 164static __init void omap_init_mpu_timer(unsigned long rate)
196{ 165{
197 set_cyc2ns_scale(rate / 1000);
198
199 setup_irq(INT_TIMER1, &omap_mpu_timer1_irq); 166 setup_irq(INT_TIMER1, &omap_mpu_timer1_irq);
200 omap_mpu_timer_start(0, (rate / HZ) - 1, 1); 167 omap_mpu_timer_start(0, (rate / HZ) - 1, 1);
201 168
@@ -260,22 +227,6 @@ static void __init omap_init_clocksource(unsigned long rate)
260 printk(err, clocksource_mpu.name); 227 printk(err, clocksource_mpu.name);
261} 228}
262 229
263
264/*
265 * Scheduler clock - returns current time in nanosec units.
266 */
267unsigned long long sched_clock(void)
268{
269 unsigned long ticks = 0 - omap_mpu_timer_read(1);
270 unsigned long long ticks64;
271
272 ticks64 = omap_mpu_timer2_overflows;
273 ticks64 <<= 32;
274 ticks64 |= ticks;
275
276 return cycles_2_ns(ticks64);
277}
278
279/* 230/*
280 * --------------------------------------------------------------------------- 231 * ---------------------------------------------------------------------------
281 * Timer initialization 232 * Timer initialization