]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
timer: orion-timer: Use timer_conv_64() to fix timer wrap around
authorStefan Roese <sr@denx.de>
Thu, 15 Sep 2022 14:20:36 +0000 (16:20 +0200)
committerStefan Roese <sr@denx.de>
Sun, 18 Sep 2022 10:41:57 +0000 (12:41 +0200)
While testing on some Kirkwood platforms it was noticed that the timer
did not function correctly all the time. The driver did not correctly
handle 32bit timer value wrap arounds. Using the timer_conv_64()
conversion function fixes this issue.

Fixes: e9e73d78a8fb ("timer: add orion-timer support")
Suggested-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier-oss@weidmueller.com>
Signed-off-by: Stefan Roese <sr@denx.de>
Tested-by: Tony Dinh <mibodhi@gmail.com>
drivers/timer/orion-timer.c

index fd30e1bf036cd201189a8df25d496d3be0fcef52..d7d1a1b24462cc0d87d1b2ff8a31ef7be5879933 100644 (file)
@@ -19,7 +19,7 @@ static uint64_t orion_timer_get_count(struct udevice *dev)
 {
        struct orion_timer_priv *priv = dev_get_priv(dev);
 
-       return ~readl(priv->base + TIMER0_VAL);
+       return timer_conv_64(~readl(priv->base + TIMER0_VAL));
 }
 
 static int orion_timer_probe(struct udevice *dev)