linux/arch/arm/mach-davinci
Mark A. Greer 3abd5acfff davinci: Add compare register support to timer code
The Timer64p timer has 8 compare registers that can
be used to generate interrupts when the timer value
matches the compare reg's value.  They do not disturb
the timer itself.  This can be useful when there is
only one timer available for both clock events and
clocksource.

When enabled, the clocksource remains a continuous
32-bit counter but the clock event will no longer
support periodic interrupts.  Instead only oneshot
timers will be supported and implemented by setting
the compare register to the current timer value plus
the period that the clock event subsystem is requesting.

Compare registers support is enabled automatically
when the following conditions are met:
1) The same timer is being used for clock events
   and clocksource.
2) The timer is the bottom half (32 bits) of the
   64-bit timer (hardware limitation).
3) The the compare register offset and irq are
   not zero.

Since the timer is always running, there is a hardware
race in timer32_config() between reading the current
timer value, and adding the period to the current
timer value and writing the compare register.
Testing on a da830 evm board with the timer clocked
at 24 MHz and the processor clocked at 300 MHz,
showed the number of counter ticks to do this ranged
from 20-53 (~1-2.2 usecs) but usually around 41 ticks.
This includes some artifacts from collecting the
information.  So, the minimum period should be
at least 5 usecs to be safe.

There is also an non-critical lower limit that
the period should be since there is no point in
setting an event that is much shorter than the
time it takes to set the event, and get & handle
the timer interrupt for that event.  There can
also be all sorts of delays from activities
occuring elsewhere in the system (including
hardware activitis like cache & TLB management).
These are virtually impossible to quantify so a
minimum period of 50 usecs was chosen.  That will
certianly be enough to avoid the actual hardware
race but hopefully not large enough to cause
unreasonably course-grained timers.

Signed-off-by: Mark A. Greer <mgreer@mvista.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
2009-05-28 15:17:48 -07:00
..
include/mach davinci: Add compare register support to timer code 2009-05-28 15:17:48 -07:00
board-dm355-evm.c davinci: Encapsulate SoC-specific data in a structure 2009-05-26 08:14:04 -07:00
board-dm355-leopard.c davinci: Encapsulate SoC-specific data in a structure 2009-05-26 08:14:04 -07:00
board-dm644x-evm.c davinci: Factor out emac mac address handling 2009-05-28 15:17:47 -07:00
board-dm646x-evm.c davinci: Factor out emac mac address handling 2009-05-28 15:17:47 -07:00
board-sffsdr.c davinci: Move emac platform_data to SoC-specific files 2009-05-28 15:17:45 -07:00
clock.c davinci: Add support for multiple PSCs 2009-05-26 08:16:46 -07:00
clock.h davinci: Add support for multiple PSCs 2009-05-26 08:16:46 -07:00
common.c davinci: Integrate cp_intc support into low-level irq code 2009-05-28 15:17:47 -07:00
cp_intc.c davinci: INTC: add support for TI cp_intc 2009-05-26 07:18:14 -07:00
devices.c davinci: Factor out emac mac address handling 2009-05-28 15:17:47 -07:00
dm355.c davinci: Move serial platform_device into SoC-specific files 2009-05-28 15:17:41 -07:00
dm644x.c davinci: Move emac platform_data to SoC-specific files 2009-05-28 15:17:45 -07:00
dm646x.c davinci: Move emac platform_data to SoC-specific files 2009-05-28 15:17:45 -07:00
dma.c davinci: add EDMA driver 2009-04-27 09:49:42 -07:00
gpio.c davinci: Make GPIO code more generic 2009-05-28 15:16:30 -07:00
io.c davinci: Encapsulate SoC-specific data in a structure 2009-05-26 08:14:04 -07:00
irq.c davinci: Move interrupt ctlr info to SoC infrastructure 2009-05-26 08:18:09 -07:00
Kconfig davinci: Integrate cp_intc support into low-level irq code 2009-05-28 15:17:47 -07:00
Makefile davinci: Integrate cp_intc support into low-level irq code 2009-05-28 15:17:47 -07:00
Makefile.boot [ARM] 4303/3: base kernel support for TI DaVinci 2007-05-11 17:26:55 +01:00
mux.c davinci: Move pinmux setup info to SoC infrastructure 2009-05-26 08:17:16 -07:00
mux.h davinci: update pin-multiplexing support 2009-04-27 09:49:46 -07:00
psc.c davinci: Add support for multiple PSCs 2009-05-26 08:16:46 -07:00
serial.c davinci: Move serial platform_device into SoC-specific files 2009-05-28 15:17:41 -07:00
time.c davinci: Add compare register support to timer code 2009-05-28 15:17:48 -07:00
usb.c davinci: add arch_ioremap() which uses existing static mappings 2009-04-23 09:31:09 -07:00