diff options
Diffstat (limited to 'arch/arm/mach-omap1')
-rw-r--r-- | arch/arm/mach-omap1/time.c | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c index a4f8b2055437..f6cf2b7e52be 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 | */ | ||
76 | static unsigned long cyc2ns_scale; | ||
77 | #define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */ | ||
78 | |||
79 | static inline void set_cyc2ns_scale(unsigned long cpu_khz) | ||
80 | { | ||
81 | cyc2ns_scale = (1000000 << CYC2NS_SCALE_FACTOR)/cpu_khz; | ||
82 | } | ||
83 | |||
84 | static inline unsigned long long cycles_2_ns(unsigned long long cyc) | ||
85 | { | ||
86 | return (cyc * cyc2ns_scale) >> CYC2NS_SCALE_FACTOR; | ||
87 | } | ||
88 | |||
89 | |||
90 | typedef struct { | 59 | typedef 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 | ||
195 | static __init void omap_init_mpu_timer(unsigned long rate) | 164 | static __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 | ||