video/console: Factor out actual character output
[oweals/u-boot.git] / drivers / timer / omap-timer.c
index 3f847984cb993f9d47a83a7864c922f134ddc556..a13fb7116569a0f2addf0a588288cd379eea8ffe 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;
 }
@@ -61,10 +61,12 @@ static int omap_timer_probe(struct udevice *dev)
        struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev);
        struct omap_timer_priv *priv = dev_get_priv(dev);
 
-       uc_priv->clock_rate = TIMER_CLOCK;
+       if (!uc_priv->clock_rate)
+               uc_priv->clock_rate = TIMER_CLOCK;
 
        /* 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);
@@ -102,5 +104,4 @@ U_BOOT_DRIVER(omap_timer) = {
        .priv_auto_alloc_size = sizeof(struct omap_timer_priv),
        .probe = omap_timer_probe,
        .ops    = &omap_timer_ops,
-       .flags = DM_FLAG_PRE_RELOC,
 };