Skip to contentSkip to conversation

ARM: tegra: timer: Separate clocksource and sched_clock

PATCH In review Colin Cross 4 participants 5 messages Nov 18, 2010 – Dec 13, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: tegra: timer: Separate clocksource and sched_clock

tegra_clocksource_read should not use cnt32_to_63, wrapping is already handled in the clocksource code. Move the cnt32_to_63 into the sched_clock function, and replace the use of clocksource mult and shift with a multiplication by 1000 to convert us to ns.

Change-Id Ica1158c3fbed0ba53391f7db61180129a957511d
---
 arch/arm/mach-tegra/timer.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
arch/arm/mach-tegra/timer.c +3 -4
index 9057d6f..b49f2f5 100644
@@ -91,7 +91,7 @@ static void tegra_timer_set_mode(enum clock_event_mode mode,
 
 static cycle_t tegra_clocksource_read(struct clocksource *cs)
 {
-	return cnt32_to_63(timer_readl(TIMERUS_CNTR_1US));
+	return timer_readl(TIMERUS_CNTR_1US);
 }
 
 static struct clock_event_device tegra_clockevent = {
@@ -106,14 +106,13 @@ static struct clocksource tegra_clocksource = {
 	.name	= "timer_us",
 	.rating	= 300,
 	.read	= tegra_clocksource_read,
-	.mask	= 0x7FFFFFFFFFFFFFFFULL,
+	.mask	= CLOCKSOURCE_MASK(32),
 	.flags	= CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
 unsigned long long sched_clock(void)
 {
-	return clocksource_cyc2ns(tegra_clocksource.read(&tegra_clocksource),
-		tegra_clocksource.mult, tegra_clocksource.shift);
+	return cnt32_to_63(timer_readl(TIMERUS_CNTR_1US)) * 1000;
 }
 
 static irqreturn_t tegra_timer_interrupt(int irq, void *dev_id)
Signature · 1 line
1.7.3.1
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Colin Cross

tegra_clocksource_read should not use cnt32_to_63, wrapping is already handled in the clocksource code. Move the cnt32_to_63 into the sched_clock function, and replace the use of clocksource mult and shift with a multiplication by 1000 to convert us to ns.

Change-Id Ica1158c3fbed0ba53391f7db61180129a957511d
Acked-by on v1 1/1
#2 lore raw
In reply to Colin Cross

2010/11/18 Colin Cross <[email protected]>:

Quoted 6 lines

tegra_clocksource_read should not use cnt32_to_63, wrapping is already handled in the clocksource code. ?Move the cnt32_to_63 into the sched_clock function, and replace the use of clocksource mult and shift with a multiplication by 1000 to convert us to ns.

Change-Id: Ica1158c3fbed0ba53391f7db61180129a957511d

The Linux kernel does not use Gerrit...

Quoted 1 line

Apart from that:

Yours,
Linus Walleij

#3 lore raw
In reply to Colin Cross
Quoted 4 lines · Colin Cross

tegra_clocksource_read should not use cnt32_to_63, wrapping is already handled in the clocksource code. Move the cnt32_to_63 into the sched_clock function, and replace the use of clocksource mult and shift with a multiplication by 1000 to convert us to ns.

Colin,

Mind if I pick this up into my tree - I'm doing other work with clocksources and sched_clock() at the moment which will clash with this patch.

Thanks.

#4 lore raw
Quoted 11 lines · Russell King - ARM Linux
Quoted 4 lines · Colin Cross

tegra_clocksource_read should not use cnt32_to_63, wrapping is already handled in the clocksource code. ?Move the cnt32_to_63 into the sched_clock function, and replace the use of clocksource mult and shift with a multiplication by 1000 to convert us to ns.

Colin,

Mind if I pick this up into my tree - I'm doing other work with clocksources and sched_clock() at the moment which will clash with this patch.

Sure, I'll need to coordinate the Tegra tree with your tree already because of the GIC and SMP changes.