]> git.sur5r.net Git - u-boot/blobdiff - arch/arm/cpu/armv7/rmobile/timer.c
arm: rmobile: alt: Add external RAM boot
[u-boot] / arch / arm / cpu / armv7 / rmobile / timer.c
index 72e0c125459f840d8f059a31364b2781c5326ba1..04700e7d34ddcd0b0680c6590b7b347486ee7925 100644 (file)
@@ -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,16 @@ 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);
+       do_div(timer, CLK2MHZ(CONFIG_SYS_CPU_CLK));
        return timer;
 }
 
 static ulong get_time_ms(void)
 {
-       return (ulong)(get_time_us() / 1000);
+       u64 us = get_time_us();
+
+       do_div(us, 1000);
+       return us;
 }
 
 int timer_init(void)