]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
armv8: define usec2ticks function
authorAneesh Bansal <aneesh.bansal@freescale.com>
Tue, 8 Dec 2015 08:24:26 +0000 (13:54 +0530)
committerYork Sun <yorksun@freescale.com>
Tue, 15 Dec 2015 00:57:34 +0000 (08:57 +0800)
usec2ticks() function has been defined for ARMv8 which will
be used by SEC Driver.

Signed-off-by: Aneesh Bansal <aneesh.bansal@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>
arch/arm/cpu/armv8/generic_timer.c

index 8e60baebc53487d17556facc322003e23dfbd15f..8f47a82043b00519100bb4e600edc23c47ac8d90 100644 (file)
@@ -40,3 +40,14 @@ unsigned long timer_read_counter(void)
 #endif
        return cntpct;
 }
+
+unsigned long usec2ticks(unsigned long usec)
+{
+       ulong ticks;
+       if (usec < 1000)
+               ticks = ((usec * (get_tbclk()/1000)) + 500) / 1000;
+       else
+               ticks = ((usec / 10) * (get_tbclk() / 100000));
+
+       return ticks;
+}