From ef22e0b1b6d93888e70545d06aa58bc5ed6a538c Mon Sep 17 00:00:00 2001 From: Kevin Hilman Date: Mon, 12 Nov 2007 23:24:03 -0800 Subject: [PATCH] --- yaml --- r: 91298 b: refs/heads/master c: f258b0c6fa6ca653c7f4e6e2846dbb7ed3af3446 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/arm/plat-omap/common.c | 17 +++++++++++++++++ trunk/arch/arm/plat-omap/timer32k.c | 26 -------------------------- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/[refs] b/[refs] index 48ae7ec3fed8..5f4792648b93 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5a3a388fbefac3705dfcde16c93fc81e6fd9378f +refs/heads/master: f258b0c6fa6ca653c7f4e6e2846dbb7ed3af3446 diff --git a/trunk/arch/arm/plat-omap/common.c b/trunk/arch/arm/plat-omap/common.c index 4f0f9c4e938e..7f1cae16cfad 100644 --- a/trunk/arch/arm/plat-omap/common.c +++ b/trunk/arch/arm/plat-omap/common.c @@ -193,6 +193,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 diff --git a/trunk/arch/arm/plat-omap/timer32k.c b/trunk/arch/arm/plat-omap/timer32k.c index ce034dc59d41..1f7365f5df24 100644 --- a/trunk/arch/arm/plat-omap/timer32k.c +++ b/trunk/arch/arm/plat-omap/timer32k.c @@ -153,32 +153,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;