aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTushar Behera <tushar.behera@linaro.org>2014-02-18 10:27:19 +0530
committerTushar Behera <tushar.behera@linaro.org>2014-02-18 11:28:12 +0530
commit0cc80dee4203027f3f1ce0a45b8940fc5757f322 (patch)
tree03d449e3e1278187d102887a44dcc8b2d62ba935
parent3b151cac96ef07069bb17114d1fc4cb908eadc5c (diff)
ARMV7: S5P: Force get_timer to return milli-secondssamsung-lt-arndale_octa-2014.02-2tracking-arndale_octa
The standard definition of get_timer() returns in milli-seconds since the given base. Modify current implementation to match the definition. Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
-rw-r--r--arch/arm/cpu/armv7/s5p-common/timer.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/arm/cpu/armv7/s5p-common/timer.c b/arch/arm/cpu/armv7/s5p-common/timer.c
index 359c21f5e..57a87e279 100644
--- a/arch/arm/cpu/armv7/s5p-common/timer.c
+++ b/arch/arm/cpu/armv7/s5p-common/timer.c
@@ -52,7 +52,7 @@ int timer_init(void)
*/
unsigned long get_timer(unsigned long base)
{
- return get_timer_masked() - base;
+ return (get_timer_masked()/get_tbclk()) - base;
}
/* delay x useconds */
@@ -81,7 +81,7 @@ void __udelay(unsigned long usec)
}
/* get current timestamp */
- tmp = get_timer(0);
+ tmp = get_timer_masked();
/* if setting this fordward will roll time stamp */
/* reset "advancing" timestamp to 0, set lastinc value */
@@ -127,7 +127,7 @@ unsigned long get_timer_masked(void)
*/
unsigned long long get_ticks(void)
{
- return get_timer(0);
+ return get_timer_masked();
}
/*
@@ -136,5 +136,10 @@ unsigned long long get_ticks(void)
*/
unsigned long get_tbclk(void)
{
+ /* To avoid divide by zero, added an additional check */
+#ifdef CONFIG_SYS_HZ
return CONFIG_SYS_HZ;
+#else
+ return 1;
+#endif
}