mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] clocksource: fix Marvell timer read-back value
@ 2013-06-27 17:39 Sebastian Hesselbarth
  2013-06-29  8:43 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Hesselbarth @ 2013-06-27 17:39 UTC (permalink / raw)
  To: Sebastian Hesselbarth; +Cc: Thomas Petazzoni, barebox

Clocksource read callback expects incrementing timer values, while
internal timer on Marvell SoCs counts backwards. Fix value returned
by Marvell MVEBU and Orion clocksource drivers.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: barebox@lists.infradead.org
---
 drivers/clocksource/mvebu.c |    2 +-
 drivers/clocksource/orion.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/mvebu.c b/drivers/clocksource/mvebu.c
index 1a9d573..6e5ceba 100644
--- a/drivers/clocksource/mvebu.c
+++ b/drivers/clocksource/mvebu.c
@@ -42,7 +42,7 @@ static __iomem void *timer_base;
 
 uint64_t mvebu_clocksource_read(void)
 {
-	return __raw_readl(timer_base + TIMER0_VAL_OFF);
+	return 0 - __raw_readl(timer_base + TIMER0_VAL_OFF);
 }
 
 static struct clocksource cs = {
diff --git a/drivers/clocksource/orion.c b/drivers/clocksource/orion.c
index d27477a..6902c72 100644
--- a/drivers/clocksource/orion.c
+++ b/drivers/clocksource/orion.c
@@ -34,7 +34,7 @@ static __iomem void *timer_base;
 
 static uint64_t orion_clocksource_read(void)
 {
-	return __raw_readl(timer_base + TIMER0_VAL);
+	return 0 - __raw_readl(timer_base + TIMER0_VAL);
 }
 
 static struct clocksource clksrc = {
-- 
1.7.2.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-29  8:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-27 17:39 [PATCH] clocksource: fix Marvell timer read-back value Sebastian Hesselbarth
2013-06-29  8:43 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox