mirror of
https://github.com/genesi/linux-legacy.git
synced 2026-11-16 17:11:01 +00:00
ENGR00121913 Add sched_clock support to i.mx platform
Add sched_clock() implement for i.mx platform to support nanosecond resolution time for sched clock used by scheduler. This case is found by running Android's CTS case: android.os.cts.DebugTest, which tests the clock_gettime with CLOCK_THREAD_CPUTIME_ID clock, and needs nanosecond resolution sched clock. It returns 0 before timer initialize, return GPT counter after that. Signed-off-by: Xinyu Chen <xinyu.chen@freescale.com>
This commit is contained in:
@@ -116,6 +116,18 @@ static struct clocksource clocksource_mxc = {
|
||||
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
|
||||
};
|
||||
|
||||
unsigned long long sched_clock(void)
|
||||
{
|
||||
unsigned long long ret;
|
||||
|
||||
if (!timer_base)
|
||||
return 0;
|
||||
|
||||
ret = (unsigned long long)clocksource_mxc.read(&clocksource_mxc);
|
||||
ret = (ret * clocksource_mxc.mult_orig) >> clocksource_mxc.shift;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __init mxc_clocksource_init(struct clk *timer_clk)
|
||||
{
|
||||
unsigned int c = clk_get_rate(timer_clk);
|
||||
|
||||
Reference in New Issue
Block a user