aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap/common.c
diff options
context:
space:
mode:
authorKevin Hilman <khilman@mvista.com>2007-03-08 14:32:19 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2007-04-21 16:02:55 -0400
commit075192ae807579448afcc0833bd349ccce057825 (patch)
tree5627ae9d65bc8791793fde1bc2ad8f62bc015e44 /arch/arm/plat-omap/common.c
parent89df127246f23add865f4a8f719c990e41151843 (diff)
[ARM] 4262/1: OMAP: clocksource and clockevent support
Update OMAP1 to enable support for hrtimers and dynticks by using new clocksource and clockevent infrastructure. Signed-off-by: Kevin Hilman <khilman@mvista.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/plat-omap/common.c')
-rw-r--r--arch/arm/plat-omap/common.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 57b7b93674a4..fecd3d625995 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -156,3 +156,53 @@ static int __init omap_add_serial_console(void)
156 return add_preferred_console("ttyS", line, opt); 156 return add_preferred_console("ttyS", line, opt);
157} 157}
158console_initcall(omap_add_serial_console); 158console_initcall(omap_add_serial_console);
159
160
161/*
162 * 32KHz clocksource ... always available, on pretty most chips except
163 * OMAP 730 and 1510. Other timers could be used as clocksources, with
164 * higher resolution in free-running counter modes (e.g. 12 MHz xtal),
165 * but systems won't necessarily want to spend resources that way.
166 */
167
168#if defined(CONFIG_ARCH_OMAP16XX)
169#define TIMER_32K_SYNCHRONIZED 0xfffbc410
170#elif defined(CONFIG_ARCH_OMAP24XX)
171#define TIMER_32K_SYNCHRONIZED 0x48004010
172#endif
173
174#ifdef TIMER_32K_SYNCHRONIZED
175
176#include <linux/clocksource.h>
177
178static cycle_t omap_32k_read(void)
179{
180 return omap_readl(TIMER_32K_SYNCHRONIZED);
181}
182
183static struct clocksource clocksource_32k = {
184 .name = "32k_counter",
185 .rating = 250,
186 .read = omap_32k_read,
187 .mask = CLOCKSOURCE_MASK(32),
188 .shift = 10,
189 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
190};
191
192static int __init omap_init_clocksource_32k(void)
193{
194 static char err[] __initdata = KERN_ERR
195 "%s: can't register clocksource!\n";
196
197 if (cpu_is_omap16xx() || cpu_is_omap24xx()) {
198 clocksource_32k.mult = clocksource_hz2mult(32768,
199 clocksource_32k.shift);
200
201 if (clocksource_register(&clocksource_32k))
202 printk(err, clocksource_32k.name);
203 }
204 return 0;
205}
206arch_initcall(omap_init_clocksource_32k);
207
208#endif /* TIMER_32K_SYNCHRONIZED */