ARM: 7205/2: sched_clock: allow sched_clock to be selected at runtime
[pandora-kernel.git] / arch / arm / plat-omap / counter_32k.c
index 04e703a..c232856 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/io.h>
-#include <linux/sched.h>
 #include <linux/clocksource.h>
 
 #include <asm/sched_clock.h>
@@ -37,41 +36,9 @@ static void __iomem *timer_32k_base;
 
 #define OMAP16XX_TIMER_32K_SYNCHRONIZED                0xfffbc410
 
-/*
- * Returns current time from boot in nsecs. It's OK for this to wrap
- * around for now, as it's just a relative time stamp.
- */
-static DEFINE_CLOCK_DATA(cd);
-
-/*
- * Constants generated by clocks_calc_mult_shift(m, s, 32768, NSEC_PER_SEC, 60).
- * This gives a resolution of about 30us and a wrap period of about 36hrs.
- */
-#define SC_MULT                4000000000u
-#define SC_SHIFT       17
-
-static inline unsigned long long notrace _omap_32k_sched_clock(void)
-{
-       u32 cyc = timer_32k_base ? __raw_readl(timer_32k_base) : 0;
-       return cyc_to_fixed_sched_clock(&cd, cyc, (u32)~0, SC_MULT, SC_SHIFT);
-}
-
-#if defined(CONFIG_OMAP_32K_TIMER) && !defined(CONFIG_OMAP_MPU_TIMER)
-unsigned long long notrace sched_clock(void)
-{
-       return _omap_32k_sched_clock();
-}
-#else
-unsigned long long notrace omap_32k_sched_clock(void)
-{
-       return _omap_32k_sched_clock();
-}
-#endif
-
-static void notrace omap_update_sched_clock(void)
+static u32 notrace omap_32k_read_sched_clock(void)
 {
-       u32 cyc = timer_32k_base ? __raw_readl(timer_32k_base) : 0;
-       update_sched_clock(&cd, cyc, (u32)~0);
+       return timer_32k_base ? __raw_readl(timer_32k_base) : 0;
 }
 
 /**
@@ -154,8 +121,7 @@ int __init omap_init_clocksource_32k(void)
                                          clocksource_mmio_readl_up))
                        printk(err, "32k_counter");
 
-               init_fixed_sched_clock(&cd, omap_update_sched_clock, 32,
-                                      32768, SC_MULT, SC_SHIFT);
+               setup_sched_clock(omap_32k_read_sched_clock, 32, 32768);
        }
        return 0;
 }