diff options
| author | Stanislav Meduna <stano@meduna.org> | 2012-11-08 17:39:14 -0500 |
|---|---|---|
| committer | Shawn Guo <shawn.guo@linaro.org> | 2012-11-11 20:27:30 -0500 |
| commit | 67948adad178a041cd545c3f9b2bd077b1c5d7a1 (patch) | |
| tree | 6511c3bd9c432b40d2b398b1a72663fced360cbf | |
| parent | 24196d5c597272b1e5c57903f2e3c7996e607117 (diff) | |
ARM: mxs: Setup scheduler clock
Setup scheduler clock on ARM MXS platforms with a 32-bit timrot
such as i.MX28. This allows the scheduler to use sub-jiffy resolution.
The corresponding change for 16-bit v1 timrots is not possible
at the moment due to rounding issues with clock values wrapping
faster than once per several seconds in the common ARM platform code.
Signed-off-by: Stanislav Meduna <stano@meduna.org>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
| -rw-r--r-- | arch/arm/mach-mxs/timer.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/arm/mach-mxs/timer.c b/arch/arm/mach-mxs/timer.c index 7c3792613392..856f4c796061 100644 --- a/arch/arm/mach-mxs/timer.c +++ b/arch/arm/mach-mxs/timer.c | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | #include <linux/of_irq.h> | 29 | #include <linux/of_irq.h> |
| 30 | 30 | ||
| 31 | #include <asm/mach/time.h> | 31 | #include <asm/mach/time.h> |
| 32 | #include <asm/sched_clock.h> | ||
| 32 | #include <mach/mxs.h> | 33 | #include <mach/mxs.h> |
| 33 | #include <mach/common.h> | 34 | #include <mach/common.h> |
| 34 | 35 | ||
| @@ -233,15 +234,22 @@ static struct clocksource clocksource_mxs = { | |||
| 233 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 234 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
| 234 | }; | 235 | }; |
| 235 | 236 | ||
| 237 | static u32 notrace mxs_read_sched_clock_v2(void) | ||
| 238 | { | ||
| 239 | return ~readl_relaxed(mxs_timrot_base + HW_TIMROT_RUNNING_COUNTn(1)); | ||
| 240 | } | ||
| 241 | |||
| 236 | static int __init mxs_clocksource_init(struct clk *timer_clk) | 242 | static int __init mxs_clocksource_init(struct clk *timer_clk) |
| 237 | { | 243 | { |
| 238 | unsigned int c = clk_get_rate(timer_clk); | 244 | unsigned int c = clk_get_rate(timer_clk); |
| 239 | 245 | ||
| 240 | if (timrot_is_v1()) | 246 | if (timrot_is_v1()) |
| 241 | clocksource_register_hz(&clocksource_mxs, c); | 247 | clocksource_register_hz(&clocksource_mxs, c); |
| 242 | else | 248 | else { |
| 243 | clocksource_mmio_init(mxs_timrot_base + HW_TIMROT_RUNNING_COUNTn(1), | 249 | clocksource_mmio_init(mxs_timrot_base + HW_TIMROT_RUNNING_COUNTn(1), |
| 244 | "mxs_timer", c, 200, 32, clocksource_mmio_readl_down); | 250 | "mxs_timer", c, 200, 32, clocksource_mmio_readl_down); |
| 251 | setup_sched_clock(mxs_read_sched_clock_v2, 32, c); | ||
| 252 | } | ||
| 245 | 253 | ||
| 246 | return 0; | 254 | return 0; |
| 247 | } | 255 | } |
