Skip to content
Snippets Groups Projects
Commit e21b3dfb authored by Christian Riesch's avatar Christian Riesch Committed by Wolfgang Denk
Browse files

arm, davinci: Use lldiv for the 64-bit divisions in timer.c


Signed-off-by: default avatarChristian Riesch <christian.riesch@omicron.at>
Cc: Tom Rini <trini@ti.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
parent b9f31cc4
No related branches found
No related tags found
No related merge requests found
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <common.h> #include <common.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/arch/timer_defs.h> #include <asm/arch/timer_defs.h>
#include <div64.h>
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
...@@ -86,14 +87,15 @@ ulong get_timer(ulong base) ...@@ -86,14 +87,15 @@ ulong get_timer(ulong base)
timer_diff = get_ticks() - gd->timer_reset_value; 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) void __udelay(unsigned long usec)
{ {
unsigned long long endtime; 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(); endtime += get_ticks();
while (get_ticks() < endtime) while (get_ticks() < endtime)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment