]> git.neil.brown.name Git - history.git/commitdiff
[ARM] Add SA11x0 sched_clock() implementation.
authorRussell King <rmk@flint.arm.linux.org.uk>
Fri, 27 Feb 2004 15:16:18 +0000 (15:16 +0000)
committerRussell King <rmk@flint.arm.linux.org.uk>
Fri, 27 Feb 2004 15:16:18 +0000 (15:16 +0000)
arch/arm/mach-sa1100/generic.c

index a0cc45fa591f13e4c70d3c5ac15419b89c527dc4..ba8c384dedd616022dee24ac2284e865cb26d314 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/cpufreq.h>
 #include <linux/ioport.h>
 
+#include <asm/div64.h>
 #include <asm/hardware.h>
 #include <asm/system.h>
 #include <asm/pgtable.h>
@@ -111,6 +112,21 @@ unsigned int cpufreq_get(unsigned int cpu)
 EXPORT_SYMBOL(cpufreq_get);
 #endif
 
+/*
+ * This is the SA11x0 sched_clock implementation.  This has
+ * a resolution of 271ns, and a maximum value of 1165s.
+ *  ( * 1E9 / 3686400 => * 78125 / 288)
+ */
+unsigned long long sched_clock(void)
+{
+       unsigned long long v;
+
+       v = (unsigned long long)OSCR * 78125;
+       do_div(v, 288);
+
+       return v;
+}
+
 /*
  * Default power-off for SA1100
  */