summaryrefslogtreecommitdiff
path: root/drivers/timer
diff options
context:
space:
mode:
authorLokesh Vutla <lokeshvutla@ti.com>2018-08-16 15:56:54 +0300
committerTom Rini <trini@konsulko.com>2018-09-11 03:48:19 +0300
commit3ee15a51809998dda6bb94eea85237eb9fe698f0 (patch)
tree1d7991e8931709716e89231a95843c736e6ea4fb /drivers/timer
parentc76382ff7f213d7d182fa8a1dfb2df114deb075f (diff)
downloadu-boot-3ee15a51809998dda6bb94eea85237eb9fe698f0.tar.xz
dm: omap-timer: Use 64bit for counter values
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>
Diffstat (limited to 'drivers/timer')
-rw-r--r--drivers/timer/omap-timer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/timer/omap-timer.c b/drivers/timer/omap-timer.c
index 3f847984cb..138783b69f 100644
--- a/drivers/timer/omap-timer.c
+++ b/drivers/timer/omap-timer.c
@@ -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);