Skip to contentSkip to conversation

Modified I.MX31 targets to use lldiv().

PATCH New sposelenov at emcraft.com 3 participants 5 messages Nov 1, 2008 – Nov 2, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Modified I.MX31 targets to use lldiv().

Hello,

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

---
 cpu/arm1136/mx31/interrupts.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
cpu/arm1136/mx31/interrupts.c +6 -5
index b36c58c..aa65d11 100644
@@ -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
Signature · 1 line
1.5.6.1
#1 lore raw

PATCH 1/1 Modified I.MX31 targets to use lldiv().

Dear sposelenov at emcraft.com,

Quoted 3 lines · In message <[email protected]> you wrote:

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

...

cpu/arm1136/mx31/interrupts.c line 48

Quoted 11 lines

/* "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 */

cpu/arm1136/mx31/interrupts.c +4 -4
-#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)

Lines too long.

(Yes, the original lines were too long already, too. But this is a chace to fix this, so please let's do it now.).

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A mouse is an elephant built by the Japanese.
#2 lore raw

PATCH 1/1 Modified I.MX31 targets to use lldiv().

In reply to sposelenov at emcraft.com

cpu/arm1136/mx31/interrupts.c

Quoted 14 lines · sposelenov at emcraft.com

Hello,

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

---
 cpu/arm1136/mx31/interrupts.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
cpu/arm1136/mx31/interrupts.c +0 -0
index b36c58c..aa65d11 100644

sorry

Tomohiro Masubu

already send me a patch for this with inline function

please sync with it

Best Regards,
J.

#3 lore raw

PATCH 1/1 Modified I.MX31 targets to use lldiv().

Hello,

Quoted 20 lines · Jean-Christophe PLAGNIOL-VILLARD

cpu/arm1136/mx31/interrupts.c

Quoted 15 lines · sposelenov at emcraft.com

Hello,

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

---
 cpu/arm1136/mx31/interrupts.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
cpu/arm1136/mx31/interrupts.c +0 -0
index b36c58c..aa65d11 100644

sorry

Quoted 7 lines

Tomohiro Masubu

already send me a patch for this with inline function

please sync with it

Sorry my ignorance - but how? Cannot find the patch of this author in lists.denx.de archives.

Regards,
Sergei

Quoted 4 lines

Best Regards,
J.

#4 lore raw

PATCH 1/1 Modified I.MX31 targets to use lldiv().

Quoted 25 lines · Sergei Poselenov

Hello,

Quoted 22 lines · Jean-Christophe PLAGNIOL-VILLARD

cpu/arm1136/mx31/interrupts.c

Quoted 15 lines · sposelenov at emcraft.com

Hello,

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

---
 cpu/arm1136/mx31/interrupts.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
cpu/arm1136/mx31/interrupts.c +0 -0
index b36c58c..aa65d11 100644

sorry

Tomohiro Masubu

Quoted 7 lines
Quoted 5 lines

already send me a patch for this with inline function

please sync with it

Sorry my ignorance - but how? Cannot find the patch of this author in lists.denx.de archives.

http://git.denx.de/?p=u-boot/u-boot-arm.git;a=commit;h=f924f55316792e59f6b2e90497b02b42d9f0e7b1

Best Regards,
J.