@@ -198,15 +198,20 @@ static void __init omap2_gp_clocksource_init(void)
*/
static DEFINE_CLOCK_DATA(cd);
static struct omap_dm_timer *gpt_clocksource;
-static cycle_t clocksource_read_cycles(struct clocksource *cs)
+static cycle_t notrace clocksource_read_cycles(struct clocksource *cs)
{
return (cycle_t)omap_dm_timer_read_counter(gpt_clocksource);
}
+static cycle_t notrace clocksource_gpt_read_dummy(struct clocksource *cs)
+{
+ return 0;
+}
+
static struct clocksource clocksource_gpt = {
.name = "gp timer",
.rating = 300,
- .read = clocksource_read_cycles,
+ .read = clocksource_gpt_read_dummy,
.mask = CLOCKSOURCE_MASK(32),
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
@@ -220,6 +225,12 @@ static void notrace dmtimer_update_sched_clock(void)
update_sched_clock(&cd, cyc, (u32)~0);
}
+unsigned long long notrace sched_clock(void)
+{
+ u32 cyc = clocksource_gpt.read(&clocksource_gpt);
+ return cyc_to_sched_clock(&cd, cyc, (u32)~0);
+}
+
/* Setup free-running counter for clocksource */
static void __init omap2_gp_clocksource_init(void)
{
@@ -240,6 +251,7 @@ static void __init omap2_gp_clocksource_init(void)
omap_dm_timer_set_load_start(gpt, 1, 0);
+ clocksource_gpt.read = clocksource_read_cycles;
init_sched_clock(&cd, dmtimer_update_sched_clock, 32, tick_rate);
if (clocksource_register_hz(&clocksource_gpt, tick_rate))
@@ -126,13 +126,13 @@ static inline unsigned long long notrace
_omap_32k_sched_clock(void)
return cyc_to_fixed_sched_clock(&cd, cyc, (u32)~0, SC_MULT, SC_SHIFT);
}
-#ifndef CONFIG_OMAP_MPU_TIMER
-unsigned long long notrace sched_clock(void)
+#ifdef CONFIG_OMAP_MPU_TIMER
+unsigned long long notrace omap_32k_sched_clock(void)
{
return _omap_32k_sched_clock();
}
-#else
-unsigned long long notrace omap_32k_sched_clock(void)
+#elif defined(CONFIG_OMAP_32K_TIMER)
+unsigned long long notrace sched_clock(void)
{
return _omap_32k_sched_clock();
}
@@ -700,7 +700,7 @@ void omap_dm_timer_write_status(struct
omap_dm_timer *timer, unsigned int value)
}
EXPORT_SYMBOL_GPL(omap_dm_timer_write_status);
-unsigned int omap_dm_timer_read_counter(struct omap_dm_timer *timer)
+unsigned int notrace omap_dm_timer_read_counter(struct omap_dm_timer *timer)
{
unsigned int l;