rk_timer: support sched_clock
author黄涛 <huangtao@rock-chips.com>
Tue, 22 Jan 2013 03:30:13 +0000 (11:30 +0800)
committer黄涛 <huangtao@rock-chips.com>
Tue, 22 Jan 2013 03:31:55 +0000 (11:31 +0800)
arch/arm/plat-rk/rk_timer.c

index 24dc1b508ce8afc1582b7fac6e66a6d38ccd6208..51e5e5934b8d672e00e5caa376e2a6a9db09371b 100644 (file)
@@ -282,3 +282,18 @@ int local_timer_ack(void)
        return 0;
 }
 #endif
+
+/*
+ * Scheduler clock - returns current time in nanosec units.
+ */
+unsigned long long notrace sched_clock(void)
+{
+       const struct clocksource *cs = &rk_timer_clocksource;
+       cycle_t cyc;
+
+       if (!timer.cs_base)
+               return 0;
+
+       cyc = ~rk_timer_read_current_value(timer.cs_base);
+       return clocksource_cyc2ns(cyc, cs->mult, cs->shift);
+}