
Use do_div in TICK_TO_TIME in order to get the code through the compiler when CONFIG_MX31_CLK32 is 32768.
Signed-off-by: Magnus Lilja lilja.magnus@gmail.com ---
This is a quick patch to get the i.MX31 PDK patch to compile. If someone has a better solution to this problem please submit a patch that can replace this one.
cpu/arm1136/mx31/interrupts.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/cpu/arm1136/mx31/interrupts.c b/cpu/arm1136/mx31/interrupts.c index b36c58c..31ad4a5 100644 --- a/cpu/arm1136/mx31/interrupts.c +++ b/cpu/arm1136/mx31/interrupts.c @@ -22,6 +22,7 @@ */
#include <common.h> +#include <div64.h> #include <asm/arch/mx31-regs.h>
#define TIMER_BASE 0x53f90000 /* General purpose timer 1 */ @@ -49,7 +50,13 @@ /* ~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) +static inline ulong TICK_TO_TIME(unsigned long long t) +{ + unsigned long long res = t; + + do_div(res, TICK_PER_TIME); + return res; +} #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