summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/time.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2005-09-08 23:07:38 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-09-08 23:07:38 +0100
commit7c38cf021b42a4297bc8f860ab627734bdd6c8d1 (patch)
tree89c3b807ca90f5c7e5692ddbcd388511dc289530 /arch/arm/mach-omap1/time.c
parentd7b6b3589471c3856f1e6dc9c77abc4af962ffdb (diff)
downloadop-kernel-dev-7c38cf021b42a4297bc8f860ab627734bdd6c8d1.zip
op-kernel-dev-7c38cf021b42a4297bc8f860ab627734bdd6c8d1.tar.gz
[ARM] 2890/1: OMAP 1/4: Update omap1 specific files, take 2
Patch from Tony Lindgren This patch syncs the mainline kernel with linux-omap tree. The highlights of the patch are: - Convert more drivers to register resources in board-*.c to take advantage of the driver model by David Brownell and Ladislav Michl - Use set_irq_type() for GPIO interrupts instead of omap_set_gpio_edge_ctrl() by David Brownell - Add minimal support for handling optional add-on boards, such as OSK Mistral board with LCD and keypad, by David Brownell - Minimal support for loading functions to SRAM by Tony Lindgren - Wake up from serial port by muxing RX lines temporarily into GPIO interrupts by Tony Lindgren - 32KHz sched_clock by Tony Lindgren and Juha Yrjola Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-omap1/time.c')
-rw-r--r--arch/arm/mach-omap1/time.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/arch/arm/mach-omap1/time.c b/arch/arm/mach-omap1/time.c
index d540539..191a9b1 100644
--- a/arch/arm/mach-omap1/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -247,13 +247,6 @@ unsigned long long sched_clock(void)
#define OMAP_32K_TIMER_TCR 0x04
#define OMAP_32K_TICKS_PER_HZ (32768 / HZ)
-#if (32768 % HZ) != 0
-/* We cannot ignore modulo.
- * Potential error can be as high as several percent.
- */
-#define OMAP_32K_TICK_MODULO (32768 % HZ)
-static unsigned modulo_count = 0; /* Counts 1/HZ units */
-#endif
/*
* TRM says 1 / HZ = ( TVR + 1) / 32768, so TRV = (32768 / HZ) - 1
@@ -296,13 +289,22 @@ static inline void omap_32k_timer_stop(void)
}
/*
- * Rounds down to nearest usec
+ * 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;
+}
+
static unsigned long omap_32k_last_tick = 0;
/*
@@ -315,6 +317,15 @@ static unsigned long omap_32k_timer_gettimeoffset(void)
}
/*
+ * 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());
+}
+
+/*
* Timer interrupt for 32KHz timer. When dynamic tick is enabled, this
* function is also called from other interrupts to remove latency
* issues with dynamic tick. In the dynamic tick case, we need to lock
@@ -330,19 +341,6 @@ static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id,
now = omap_32k_sync_timer_read();
while (now - omap_32k_last_tick >= OMAP_32K_TICKS_PER_HZ) {
-#ifdef OMAP_32K_TICK_MODULO
- /* Modulo addition may put omap_32k_last_tick ahead of now
- * and cause unwanted repetition of the while loop.
- */
- if (unlikely(now - omap_32k_last_tick == ~0))
- break;
-
- modulo_count += OMAP_32K_TICK_MODULO;
- if (modulo_count > HZ) {
- ++omap_32k_last_tick;
- modulo_count -= HZ;
- }
-#endif
omap_32k_last_tick += OMAP_32K_TICKS_PER_HZ;
timer_tick(regs);
}
OpenPOWER on IntegriCloud