summaryrefslogtreecommitdiff
path: root/cpu
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias@kaehlcke.net>2010-02-24 00:22:00 +0100
committerTom Rix <Tom.Rix@windriver.com>2010-03-07 12:36:35 -0600
commitd9f505e3cddbb7afce26dcfe0fd19b207ee57c09 (patch)
tree288d69c21bad9dc2c86d79a02d684d280a27fce7 /cpu
parent041d42e789aba20296ffcde92173f100a9592880 (diff)
ep93xx: Fix calculation of sys ticks in clk_to_systicks()
ep93xx: Use unsigned long long for calculation of sys ticks in clk_to_systicks() for proper handling of large intermediate values Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Diffstat (limited to 'cpu')
-rw-r--r--cpu/arm920t/ep93xx/timer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/cpu/arm920t/ep93xx/timer.c b/cpu/arm920t/ep93xx/timer.c
index 6d969d9302d..98c759c8f0a 100644
--- a/cpu/arm920t/ep93xx/timer.c
+++ b/cpu/arm920t/ep93xx/timer.c
@@ -31,6 +31,7 @@
#include <linux/types.h>
#include <asm/arch/ep93xx.h>
#include <asm/io.h>
+#include <div64.h>
#define TIMER_CLKSEL (1 << 3)
#define TIMER_MODE (1 << 6)
@@ -44,9 +45,10 @@ static ulong lastdec;
static inline unsigned long clk_to_systicks(unsigned long clk_ticks)
{
- unsigned long sys_ticks = (clk_ticks * CONFIG_SYS_HZ) / TIMER_FREQ;
+ unsigned long long sys_ticks = (clk_ticks * CONFIG_SYS_HZ);
+ do_div(sys_ticks, TIMER_FREQ);
- return sys_ticks;
+ return (unsigned long)sys_ticks;
}
static inline unsigned long usecs_to_ticks(unsigned long usecs)