Magnus Damm | 25 Nov 2008 13:59
Picon

[PATCH 3/8] sh: timer rewrite V2, timer_inc helper code

From: Magnus Damm <damm <at> igel.co.jp>

This patch adds clock source/event helper code for incrementing timers.

Normally tickless operation requires two timers, one for the clock source
and another one for a oneshot timer event. This helper code makes it
possible to use a single timer for both clock source and clock event,
ie tickless with a single incrementing timer. Useful on for instance
processors where all timers except one needs to be disabled for deep sleep.

The clock source is calculated from the running hardware timer plus a
software controlled counter which together form a 64 bit value. High
accuracy of the clock source is kept by never reprogramming the hardware
counter, only the hardware match value.

Clock events are handled by reading out current hardware counter value
and reprogramming the match register. Both periodic and oneshot modes
are supported.

The helper code only supports incrementing timer hardware which at
matching time resets and generates an interrupt but keeps on counting.
Timers counting down are not supported.

Signed-off-by: Magnus Damm <damm <at> igel.co.jp>
---

 Same as V1.

 drivers/clocksource/timer_inc.c |  358 +++++++++++++++++++++++++++++++++++++++
 include/linux/timer_inc.h       |   40 ++++
(Continue reading)


Gmane