public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] Modified I.MX31 targets to use lldiv().
@ 2008-11-01 14:09 sposelenov at emcraft.com
  2008-11-01 14:43 ` Wolfgang Denk
  2008-11-02  9:33 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 6+ messages in thread
From: sposelenov at emcraft.com @ 2008-11-01 14:09 UTC (permalink / raw)
  To: u-boot

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@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

^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] Modified I.MX31 targets to use lldiv().
@ 2008-11-01 14:09 sposelenov at emcraft.com
  0 siblings, 0 replies; 6+ messages in thread
From: sposelenov at emcraft.com @ 2008-11-01 14:09 UTC (permalink / raw)
  To: u-boot



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-11-02 19:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-01 14:09 [U-Boot] [PATCH] Modified I.MX31 targets to use lldiv() sposelenov at emcraft.com
2008-11-01 14:43 ` Wolfgang Denk
2008-11-02  9:33 ` Jean-Christophe PLAGNIOL-VILLARD
2008-11-02 19:23   ` Sergei Poselenov
2008-11-02 19:46     ` Jean-Christophe PLAGNIOL-VILLARD
  -- strict thread matches above, loose matches on Subject: below --
2008-11-01 14:09 sposelenov at emcraft.com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox