diff options
author | Aneesh Bansal <aneesh.bansal@freescale.com> | 2015-12-08 13:54:26 +0530 |
---|---|---|
committer | York Sun <yorksun@freescale.com> | 2015-12-15 08:57:34 +0800 |
commit | b644d3e932f133bbb8b577c1965eae399b7df99e (patch) | |
tree | 40fb9d499ab8222f453d4ee7652fdc8afca3cd0e | |
parent | beedbc2ea0e71c779b92e4d74b928a266d3e86f9 (diff) | |
download | u-boot-imx-b644d3e932f133bbb8b577c1965eae399b7df99e.zip u-boot-imx-b644d3e932f133bbb8b577c1965eae399b7df99e.tar.gz u-boot-imx-b644d3e932f133bbb8b577c1965eae399b7df99e.tar.bz2 |
armv8: define usec2ticks function
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>
-rw-r--r-- | arch/arm/cpu/armv8/generic_timer.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/arm/cpu/armv8/generic_timer.c b/arch/arm/cpu/armv8/generic_timer.c index 8e60bae..8f47a82 100644 --- a/arch/arm/cpu/armv8/generic_timer.c +++ b/arch/arm/cpu/armv8/generic_timer.c @@ -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; +} |