From: Christian Riesch Date: Fri, 9 Dec 2011 15:54:01 +0000 (+0100) Subject: arm, davinci: Use lldiv for the 64-bit divisions in timer.c X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=e21b3dfb0a971dc8ba307f8af49def0fc6e816ed;p=u-boot.git arm, davinci: Use lldiv for the 64-bit divisions in timer.c Signed-off-by: Christian Riesch Cc: Tom Rini Cc: Heiko Schocher Cc: Wolfgang Denk --- diff --git a/arch/arm/cpu/arm926ejs/davinci/timer.c b/arch/arm/cpu/arm926ejs/davinci/timer.c index c7bf7a5ad2..a06d449553 100644 --- a/arch/arm/cpu/arm926ejs/davinci/timer.c +++ b/arch/arm/cpu/arm926ejs/davinci/timer.c @@ -40,6 +40,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -86,14 +87,15 @@ ulong get_timer(ulong base) timer_diff = get_ticks() - gd->timer_reset_value; - return (timer_diff / (gd->timer_rate_hz / CONFIG_SYS_HZ)) - base; + return lldiv(timer_diff, (gd->timer_rate_hz / CONFIG_SYS_HZ)) - base; } void __udelay(unsigned long usec) { unsigned long long endtime; - endtime = ((unsigned long long)usec * gd->timer_rate_hz) / 1000000UL; + endtime = lldiv((unsigned long long)usec * gd->timer_rate_hz, + 1000000UL); endtime += get_ticks(); while (get_ticks() < endtime)