[U-Boot] [PATCH] Modified I.MX31 targets to use lldiv().

sposelenov at emcraft.com sposelenov at emcraft.com
Sat Nov 1 15:09:48 CET 2008


Hello,

This is a patch to modify the mx31ads target to use lldiv(). Otherwise,
it fails to build by EABI toolchain.

Signed-off-by: Sergei Poselenov <sposelenov at emcraft.com>
---
 cpu/arm1136/mx31/interrupts.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/cpu/arm1136/mx31/interrupts.c b/cpu/arm1136/mx31/interrupts.c
index b36c58c..aa65d11 100644
--- a/cpu/arm1136/mx31/interrupts.c
+++ b/cpu/arm1136/mx31/interrupts.c
@@ -23,6 +23,7 @@
 
 #include <common.h>
 #include <asm/arch/mx31-regs.h>
+#include <div64.h>
 
 #define TIMER_BASE 0x53f90000 /* General purpose timer 1 */
 
@@ -41,15 +42,15 @@
 /* "time" is measured in 1 / CONFIG_SYS_HZ seconds, "tick" is internal timer period */
 #ifdef CONFIG_MX31_TIMER_HIGH_PRECISION
 /* ~0.4% error - measured with stop-watch on 100s boot-delay */
-#define TICK_TO_TIME(t)	((t) * CONFIG_SYS_HZ / CONFIG_MX31_CLK32)
-#define TIME_TO_TICK(t)	((unsigned long long)(t) * CONFIG_MX31_CLK32 / CONFIG_SYS_HZ)
-#define US_TO_TICK(t)	(((unsigned long long)(t) * CONFIG_MX31_CLK32 + \
-			999999) / 1000000)
+#define TICK_TO_TIME(t)	lldiv((t) * CONFIG_SYS_HZ, CONFIG_MX31_CLK32)
+#define TIME_TO_TICK(t)	lldiv((unsigned long long)(t) * CONFIG_MX31_CLK32, CONFIG_SYS_HZ)
+#define US_TO_TICK(t)	lldiv(((unsigned long long)(t) * CONFIG_MX31_CLK32 + \
+			999999), 1000000)
 #else
 /* ~2% error */
 #define TICK_PER_TIME	((CONFIG_MX31_CLK32 + CONFIG_SYS_HZ / 2) / CONFIG_SYS_HZ)
 #define US_PER_TICK	(1000000 / CONFIG_MX31_CLK32)
-#define TICK_TO_TIME(t)	((t) / TICK_PER_TIME)
+#define TICK_TO_TIME(t)	lldiv((t), TICK_PER_TIME) 
 #define TIME_TO_TICK(t)	((unsigned long long)(t) * TICK_PER_TIME)
 #define US_TO_TICK(t)	(((t) + US_PER_TICK - 1) / US_PER_TICK)
 #endif
-- 
1.5.6.1



More information about the U-Boot mailing list