[U-Boot] [PATCH 1/5] ARM:rmobile: Correct get_time_ms / get_time_us to use lldiv

Tom Rini trini at ti.com
Thu Dec 5 20:48:35 CET 2013


Cc: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj at renesas.com>
Signed-off-by: Tom Rini <trini at ti.com>
---
 arch/arm/cpu/armv7/rmobile/timer.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/armv7/rmobile/timer.c b/arch/arm/cpu/armv7/rmobile/timer.c
index 72e0c12..67a5a7a 100644
--- a/arch/arm/cpu/armv7/rmobile/timer.c
+++ b/arch/arm/cpu/armv7/rmobile/timer.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <div64.h>
 #include <asm/io.h>
 #include <asm/arch-armv7/globaltimer.h>
 #include <asm/arch/rmobile.h>
@@ -38,13 +39,12 @@ static u64 get_time_us(void)
 	u64 timer = get_cpu_global_timer();
 
 	timer = ((timer << 2) + (CLK2MHZ(CONFIG_SYS_CPU_CLK) >> 1));
-	timer /= (u64)CLK2MHZ(CONFIG_SYS_CPU_CLK);
-	return timer;
+	return lldiv(timer, CLK2MHZ(CONFIG_SYS_CPU_CLK));
 }
 
 static ulong get_time_ms(void)
 {
-	return (ulong)(get_time_us() / 1000);
+	return lldiv(get_time_us(), 1000);
 }
 
 int timer_init(void)
-- 
1.7.9.5



More information about the U-Boot mailing list