Patchwork [U-Boot,1/6] ARM: highbank: fix us_to_tick calculation

login
register
mail settings
Submitter Rob Herring
Date Feb. 2, 2012, 2:57 a.m.
Message ID <1328151477-8026-2-git-send-email-robherring2@gmail.com>
Download mbox | patch
Permalink /patch/139066/
State Accepted
Commit ceb2071c6bdb9b0f6cfe9b0adecbe8d657be496e
Delegated to: Albert ARIBAUD
Headers show

Comments

Rob Herring - Feb. 2, 2012, 2:57 a.m.
From: Rob Herring <rob.herring@calxeda.com>

udelay calls were off due to failing to convert us to ns. Fix this and drop
the unnecessary shifts since NS_PER_TICK is only 7ns.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 arch/arm/cpu/armv7/highbank/timer.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Patch

diff --git a/arch/arm/cpu/armv7/highbank/timer.c b/arch/arm/cpu/armv7/highbank/timer.c
index d8a0288..d5b6cb6 100644
--- a/arch/arm/cpu/armv7/highbank/timer.c
+++ b/arch/arm/cpu/armv7/highbank/timer.c
@@ -66,10 +66,10 @@  static inline unsigned long long time_to_tick(unsigned long long time)
 
 static inline unsigned long long us_to_tick(unsigned long long us)
 {
-	unsigned long long tick = us << 16;
+	unsigned long long tick = us * 1000;
 	tick += NS_PER_TICK - 1;
 	do_div(tick, NS_PER_TICK);
-	return tick >> 16;
+	return tick;
 }
 
 unsigned long long get_ticks(void)