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>
This commit is contained in:
parent
24196d5c59
commit
67948adad1
|
@ -29,6 +29,7 @@
|
||||||
#include <linux/of_irq.h>
|
#include <linux/of_irq.h>
|
||||||
|
|
||||||
#include <asm/mach/time.h>
|
#include <asm/mach/time.h>
|
||||||
|
#include <asm/sched_clock.h>
|
||||||
#include <mach/mxs.h>
|
#include <mach/mxs.h>
|
||||||
#include <mach/common.h>
|
#include <mach/common.h>
|
||||||
|
|
||||||
|
@ -233,15 +234,22 @@ static struct clocksource clocksource_mxs = {
|
||||||
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
|
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static u32 notrace mxs_read_sched_clock_v2(void)
|
||||||
|
{
|
||||||
|
return ~readl_relaxed(mxs_timrot_base + HW_TIMROT_RUNNING_COUNTn(1));
|
||||||
|
}
|
||||||
|
|
||||||
static int __init mxs_clocksource_init(struct clk *timer_clk)
|
static int __init mxs_clocksource_init(struct clk *timer_clk)
|
||||||
{
|
{
|
||||||
unsigned int c = clk_get_rate(timer_clk);
|
unsigned int c = clk_get_rate(timer_clk);
|
||||||
|
|
||||||
if (timrot_is_v1())
|
if (timrot_is_v1())
|
||||||
clocksource_register_hz(&clocksource_mxs, c);
|
clocksource_register_hz(&clocksource_mxs, c);
|
||||||
else
|
else {
|
||||||
clocksource_mmio_init(mxs_timrot_base + HW_TIMROT_RUNNING_COUNTn(1),
|
clocksource_mmio_init(mxs_timrot_base + HW_TIMROT_RUNNING_COUNTn(1),
|
||||||
"mxs_timer", c, 200, 32, clocksource_mmio_readl_down);
|
"mxs_timer", c, 200, 32, clocksource_mmio_readl_down);
|
||||||
|
setup_sched_clock(mxs_read_sched_clock_v2, 32, c);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue