[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>
This commit is contained in:
committed by
Russell King
parent
d7b6b35894
commit
7c38cf021b
@ -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;
|
||||
|
||||
/*
|
||||
@ -314,6 +316,15 @@ static unsigned long omap_32k_timer_gettimeoffset(void)
|
||||
return omap_32k_ticks_to_usecs(now - omap_32k_last_tick);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user