]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ARM: OMAP: Move 32k-based sched_clock() to common code
authorKevin Hilman <khilman@mvista.com>
Mon, 12 Nov 2007 23:24:03 +0000 (15:24 -0800)
committerTony Lindgren <tony@atomide.com>
Fri, 23 Nov 2007 19:12:44 +0000 (11:12 -0800)
Since 32k timer code is moving to OMAP1 specific dir, move the
32k-based sched_clock() into common code where it is based on the 32k
sync counter and can be used even when using MPU timer.

While moving, change the ticks-to-nsecs conversion to use the helper
functions provided by clocksource.h.

Also removed the unused ticks_to_usec, leaving only ticks_to_nsec.

Signed-off-by: Kevin Hilman <khilman@mvista.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/plat-omap/common.c
arch/arm/plat-omap/timer32k.c

index 87077af2255baa6a58aca3c957efd4998eef945c..f0e75c2f313259515f8aaa081c080b27d5c00744 100644 (file)
@@ -213,6 +213,23 @@ static struct clocksource clocksource_32k = {
        .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
+/*
+ * Rounds down to nearest nsec.
+ */
+unsigned long long omap_32k_ticks_to_nsecs(unsigned long ticks_32k)
+{
+       return cyc2ns(&clocksource_32k, ticks_32k);
+}
+
+/*
+ * 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.
+ */
+unsigned long long sched_clock(void)
+{
+       return omap_32k_ticks_to_nsecs(omap_32k_read());
+}
+
 static int __init omap_init_clocksource_32k(void)
 {
        static char err[] __initdata = KERN_ERR
index 61fdf417574965c0b781d38172f51e3ad5b59104..905e735cdfb1c798599e47e823943941d54442ca 100644 (file)
@@ -159,32 +159,6 @@ static inline unsigned long omap_32k_sync_timer_read(void)
        return omap_readl(TIMER_32K_SYNCHRONIZED);
 }
 
-/*
- * Rounds down to nearest usec. Note that this will overflow for larger values.
- */
-static inline unsigned long omap_32k_ticks_to_usecs(unsigned long ticks_32k)
-{
-       return (ticks_32k * 5*5*5*5*5*5) >> 9;
-}
-
-/*
- * Rounds down to nearest nsec.
- */
-static inline unsigned long long
-omap_32k_ticks_to_nsecs(unsigned long ticks_32k)
-{
-       return (unsigned long long) ticks_32k * 1000 * 5*5*5*5*5*5 >> 9;
-}
-
-/*
- * 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.
- */
-unsigned long long sched_clock(void)
-{
-       return omap_32k_ticks_to_nsecs(omap_32k_sync_timer_read());
-}
-
 static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id)
 {
        struct clock_event_device *evt = &clockevent_32k_timer;