]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - drivers/timer/altera_timer.c
dm: timer: Support 64-bit counter
[people/ms/u-boot.git] / drivers / timer / altera_timer.c
index 2364f1b00f7903cc34e98c1c3c5395f33dba85f1..89fe05b704589c45696a09b7db8b026ceca70bc2 100644 (file)
@@ -34,7 +34,7 @@ struct altera_timer_platdata {
        struct altera_timer_regs *regs;
 };
 
-static int altera_timer_get_count(struct udevice *dev, unsigned long *count)
+static int altera_timer_get_count(struct udevice *dev, u64 *count)
 {
        struct altera_timer_platdata *plat = dev->platdata;
        struct altera_timer_regs *const regs = plat->regs;
@@ -46,7 +46,7 @@ static int altera_timer_get_count(struct udevice *dev, unsigned long *count)
        /* Read timer value */
        val = readl(&regs->snapl) & 0xffff;
        val |= (readl(&regs->snaph) & 0xffff) << 16;
-       *count = ~val;
+       *count = timer_conv_64(~val);
 
        return 0;
 }