]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dm: omap-timer: Use 64bit for counter values
authorLokesh Vutla <lokeshvutla@ti.com>
Thu, 16 Aug 2018 12:56:54 +0000 (18:26 +0530)
committerTom Rini <trini@konsulko.com>
Tue, 11 Sep 2018 00:48:19 +0000 (20:48 -0400)
In order to handle counter overflows use 64 bit values for counter.
Also load the initial value during probe.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
drivers/timer/omap-timer.c

index 3f847984cb993f9d47a83a7864c922f134ddc556..138783b69fa0e6806524aaba86007720888273a7 100644 (file)
@@ -51,7 +51,7 @@ static int omap_timer_get_count(struct udevice *dev, u64 *count)
 {
        struct omap_timer_priv *priv = dev_get_priv(dev);
 
-       *count = readl(&priv->regs->tcrr);
+       *count = timer_conv_64(readl(&priv->regs->tcrr));
 
        return 0;
 }
@@ -65,6 +65,7 @@ static int omap_timer_probe(struct udevice *dev)
 
        /* start the counter ticking up, reload value on overflow */
        writel(0, &priv->regs->tldr);
+       writel(0, &priv->regs->tcrr);
        /* enable timer */
        writel((CONFIG_SYS_PTV << 2) | TCLR_PRE_EN | TCLR_AUTO_RELOAD |
               TCLR_START, &priv->regs->tclr);