aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68knommu/platform
diff options
context:
space:
mode:
authorSebastian Siewior <bigeasy@linutronix.de>2008-04-28 05:43:03 -0400
committerGreg Ungerer <gerg@uclinux.org>2008-07-23 01:11:28 -0400
commit5bed10a5ee272fbf18ce0ce764245bbb8f28e2e6 (patch)
treee358b64949a0b709982c31b87381f40821af9873 /arch/m68knommu/platform
parent95469bd64a7a9ab405b566deb8c81d4aaf67ed9e (diff)
m68knommu: add sched_clock() for the DMA timer
with this printk() and other sched_clock() user use the more precise timestamps. The highly optimized math is from arch/x86/kernel/tsc_32.c. Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de> Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Diffstat (limited to 'arch/m68knommu/platform')
-rw-r--r--arch/m68knommu/platform/coldfire/dma_timer.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/arch/m68knommu/platform/coldfire/dma_timer.c b/arch/m68knommu/platform/coldfire/dma_timer.c
index b623c993219e..772578b1084f 100644
--- a/arch/m68knommu/platform/coldfire/dma_timer.c
+++ b/arch/m68knommu/platform/coldfire/dma_timer.c
@@ -66,3 +66,19 @@ static int __init init_cf_dt_clocksource(void)
66} 66}
67 67
68arch_initcall(init_cf_dt_clocksource); 68arch_initcall(init_cf_dt_clocksource);
69
70#define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */
71#define CYC2NS_SCALE ((1000000 << CYC2NS_SCALE_FACTOR) / (DMA_FREQ / 1000))
72
73static unsigned long long cycles2ns(unsigned long cycl)
74{
75 return (unsigned long long) ((unsigned long long)cycl *
76 CYC2NS_SCALE) >> CYC2NS_SCALE_FACTOR;
77}
78
79unsigned long long sched_clock(void)
80{
81 unsigned long cycl = __raw_readl(DTCN0);
82
83 return cycles2ns(cycl);
84}