diff mbox series

[v2,1/8] timer: orion-timer: Use timer_conv_64() to fix timer wrap around

Message ID 20220902062554.1197435-2-sr@denx.de
State Superseded
Delegated to: Stefan Roese
Headers show
Series Enable CONFIG_TIMER for all Kirkwood / MVEBU boards | expand

Commit Message

Stefan Roese Sept. 2, 2022, 6:25 a.m. UTC
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.

Suggested-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier-oss@weidmueller.com>
Signed-off-by: Stefan Roese <sr@denx.de>
---
v2:
- New patch

 drivers/timer/orion-timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Walle Sept. 2, 2022, 7:44 a.m. UTC | #1
Am 2022-09-02 08:25, schrieb Stefan Roese:
> 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")

Ahh. Sorry about that. I've missed that conversation which is also
in lib/time.c in a different call tree.

Maybe this can be picked to master (if this series is going into
next)?

-michael
Stefan Roese Sept. 2, 2022, 7:45 a.m. UTC | #2
On 02.09.22 09:44, Michael Walle wrote:
> Am 2022-09-02 08:25, schrieb Stefan Roese:
>> 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")
> 
> Ahh. Sorry about that. I've missed that conversation which is also
> in lib/time.c in a different call tree.
> 
> Maybe this can be picked to master (if this series is going into
> next)?

That's my plan. To pull this patch only in this release cycle and
queue the rest for next.

Thanks,
Stefan
diff mbox series

Patch

diff --git a/drivers/timer/orion-timer.c b/drivers/timer/orion-timer.c
index fd30e1bf036c..d7d1a1b24462 100644
--- a/drivers/timer/orion-timer.c
+++ b/drivers/timer/orion-timer.c
@@ -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)