summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Riesch <christian.riesch@omicron.at>2011-12-09 16:54:01 +0100
committerWolfgang Denk <wd@denx.de>2011-12-10 23:14:01 +0100
commite21b3dfb0a971dc8ba307f8af49def0fc6e816ed (patch)
tree442874d1c740cb3910a979a9d9227b126edf1339
parentb9f31cc42cb1b3d5d9745e6ac97dc6e870d24aef (diff)
downloadu-boot-imx-e21b3dfb0a971dc8ba307f8af49def0fc6e816ed.zip
u-boot-imx-e21b3dfb0a971dc8ba307f8af49def0fc6e816ed.tar.gz
u-boot-imx-e21b3dfb0a971dc8ba307f8af49def0fc6e816ed.tar.bz2
arm, davinci: Use lldiv for the 64-bit divisions in timer.c
Signed-off-by: Christian Riesch <christian.riesch@omicron.at> Cc: Tom Rini <trini@ti.com> Cc: Heiko Schocher <hs@denx.de> Cc: Wolfgang Denk <wd@denx.de>
-rw-r--r--arch/arm/cpu/arm926ejs/davinci/timer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/arm/cpu/arm926ejs/davinci/timer.c b/arch/arm/cpu/arm926ejs/davinci/timer.c
index c7bf7a5..a06d449 100644
--- a/arch/arm/cpu/arm926ejs/davinci/timer.c
+++ b/arch/arm/cpu/arm926ejs/davinci/timer.c
@@ -40,6 +40,7 @@
#include <common.h>
#include <asm/io.h>
#include <asm/arch/timer_defs.h>
+#include <div64.h>
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)