Commit 684e94cb authored by Colin Cross's avatar Colin Cross Committed by Russell King

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.
Acked-by: default avatarJohn Stultz <johnstul@us.ibm.com>
Acked-by: default avatarLinus Walleij <linus.walleij@stericsson.com>
Tested-by: default avatarOlof Johansson <olof@lixom.net>
Signed-off-by: default avatarColin Cross <ccross@android.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 11e718a6
...@@ -91,7 +91,7 @@ static void tegra_timer_set_mode(enum clock_event_mode mode, ...@@ -91,7 +91,7 @@ static void tegra_timer_set_mode(enum clock_event_mode mode,
static cycle_t tegra_clocksource_read(struct clocksource *cs) 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 = { static struct clock_event_device tegra_clockevent = {
...@@ -106,14 +106,13 @@ static struct clocksource tegra_clocksource = { ...@@ -106,14 +106,13 @@ static struct clocksource tegra_clocksource = {
.name = "timer_us", .name = "timer_us",
.rating = 300, .rating = 300,
.read = tegra_clocksource_read, .read = tegra_clocksource_read,
.mask = 0x7FFFFFFFFFFFFFFFULL, .mask = CLOCKSOURCE_MASK(32),
.flags = CLOCK_SOURCE_IS_CONTINUOUS, .flags = CLOCK_SOURCE_IS_CONTINUOUS,
}; };
unsigned long long sched_clock(void) unsigned long long sched_clock(void)
{ {
return clocksource_cyc2ns(tegra_clocksource.read(&tegra_clocksource), return cnt32_to_63(timer_readl(TIMERUS_CNTR_1US)) * 1000;
tegra_clocksource.mult, tegra_clocksource.shift);
} }
static irqreturn_t tegra_timer_interrupt(int irq, void *dev_id) static irqreturn_t tegra_timer_interrupt(int irq, void *dev_id)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment