diff options
author | Vaibhav Hiremath <hvaibhav@ti.com> | 2012-05-09 13:07:05 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2012-05-09 13:07:05 -0400 |
commit | 1fe97c8f6a1de67a5f56e029a818903d5bed8017 (patch) | |
tree | 850b55afd3750a58b553e04eb1c6e1f7a966c612 /arch/arm/mach-omap1/timer32k.c | |
parent | f36921bebdf368ac4892f8ed62fb97dd6461d459 (diff) |
ARM: OMAP: Make OMAP clocksource source selection using kernel param
Current OMAP code supports couple of clocksource options based
on compilation flag (CONFIG_OMAP_32K_TIMER). The 32KHz sync-timer
and a gptimer which can run on 32KHz or system clock (e.g 38.4 MHz).
So there can be 3 options -
1. 32KHz sync-timer
2. Sys_clock based (e.g 13/19.2/26/38.4 MHz) gptimer
3. 32KHz based gptimer.
The optional gptimer based clocksource was added so that it can
give the high precision than sync-timer, so expected usage was 2
and not 3.
Unfortunately option 2, clocksource doesn't meet the requirement of
free-running clock as per clocksource need. It stops in low power states
when sys_clock is cut. That makes gptimer based clocksource option
useless for OMAP2/3/4 devices with sys_clock as a clock input.
So, in order to use option 2, deeper idle state MUST be disabled.
Option 3 will still work but it is no better than 32K sync-timer
based clocksource.
We must support both sync timer and gptimer based clocksource as
some OMAP based derivative SoCs like AM33XX does not have the
sync timer.
Considering above, make sync-timer and gptimer clocksource runtime
selectable so that both OMAP and AMXXXX continue to use the same code.
And, in order to precisely configure/setup sched_clock for given
clocksource, decision has to be made early enough in boot sequence.
So, the solution is,
Use standard kernel parameter ("clocksource=") to override
default 32k_sync-timer, in addition to this, we also use hwmod database
lookup mechanism, through which at run-time we can identify availability
of 32k-sync timer on the device, else fall back to gptimer.
Also, moved low-level SoC specific init code to respective files,
(mach-omap1/timer32k.c and mach-omap2/timer.c)
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Kevin Hilman <khilman@ti.com>
Tested-by: Kevin Hilman <khilman@ti.com>
Cc: Benoit Cousson <b-cousson@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Tarun Kanti DebBarma <tarun.kanti@ti.com>
Cc: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap1/timer32k.c')
-rw-r--r-- | arch/arm/mach-omap1/timer32k.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/arch/arm/mach-omap1/timer32k.c b/arch/arm/mach-omap1/timer32k.c index e3613a8bcd90..eae49c3980c9 100644 --- a/arch/arm/mach-omap1/timer32k.c +++ b/arch/arm/mach-omap1/timer32k.c | |||
@@ -71,6 +71,7 @@ | |||
71 | 71 | ||
72 | /* 16xx specific defines */ | 72 | /* 16xx specific defines */ |
73 | #define OMAP1_32K_TIMER_BASE 0xfffb9000 | 73 | #define OMAP1_32K_TIMER_BASE 0xfffb9000 |
74 | #define OMAP1_32KSYNC_TIMER_BASE 0xfffbc400 | ||
74 | #define OMAP1_32K_TIMER_CR 0x08 | 75 | #define OMAP1_32K_TIMER_CR 0x08 |
75 | #define OMAP1_32K_TIMER_TVR 0x00 | 76 | #define OMAP1_32K_TIMER_TVR 0x00 |
76 | #define OMAP1_32K_TIMER_TCR 0x04 | 77 | #define OMAP1_32K_TIMER_TCR 0x04 |
@@ -186,8 +187,22 @@ int __init omap_32k_timer_init(void) | |||
186 | { | 187 | { |
187 | int ret = -ENODEV; | 188 | int ret = -ENODEV; |
188 | 189 | ||
189 | if (cpu_is_omap16xx()) | 190 | if (cpu_is_omap16xx()) { |
190 | ret = omap_init_clocksource_32k(); | 191 | void __iomem *base; |
192 | struct clk *sync32k_ick; | ||
193 | |||
194 | base = ioremap(OMAP1_32KSYNC_TIMER_BASE, SZ_1K); | ||
195 | if (!base) { | ||
196 | pr_err("32k_counter: failed to map base addr\n"); | ||
197 | return -ENODEV; | ||
198 | } | ||
199 | |||
200 | sync32k_ick = clk_get(NULL, "omap_32ksync_ick"); | ||
201 | if (!IS_ERR(sync32k_ick)) | ||
202 | clk_enable(sync32k_ick); | ||
203 | |||
204 | ret = omap_init_clocksource_32k(base); | ||
205 | } | ||
191 | 206 | ||
192 | if (!ret) | 207 | if (!ret) |
193 | omap_init_32k_timer(); | 208 | omap_init_32k_timer(); |