From: Lokesh Vutla Date: Thu, 16 Aug 2018 18:26:54 +0530 Subject: [U-Boot] [PATCH 3/4] dm: omap-timer: Use 64bit for counter values In-Reply-To: <20180816125655.16644-1-lokeshvutla@ti.com> References: <20180816125655.16644-1-lokeshvutla@ti.com> Message-ID: <20180816125655.16644-4-lokeshvutla@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de In order to handle counter overflows use 64 bit values for counter. Also load the initial value during probe. Signed-off-by: Lokesh Vutla --- drivers/timer/omap-timer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/timer/omap-timer.c b/drivers/timer/omap-timer.c index 313eda54b5..b8f52ef2e4 100644 --- a/drivers/timer/omap-timer.c +++ b/drivers/timer/omap-timer.c @@ -50,7 +50,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; } @@ -64,6 +64,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); -- 2.18.0