mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-04-02 12:31:31 +00:00
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>
This commit is contained in:
parent
041d42e789
commit
d9f505e3cd
1 changed files with 4 additions and 2 deletions
|
@ -31,6 +31,7 @@
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <asm/arch/ep93xx.h>
|
#include <asm/arch/ep93xx.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
|
#include <div64.h>
|
||||||
|
|
||||||
#define TIMER_CLKSEL (1 << 3)
|
#define TIMER_CLKSEL (1 << 3)
|
||||||
#define TIMER_MODE (1 << 6)
|
#define TIMER_MODE (1 << 6)
|
||||||
|
@ -44,9 +45,10 @@ static ulong lastdec;
|
||||||
|
|
||||||
static inline unsigned long clk_to_systicks(unsigned long clk_ticks)
|
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)
|
static inline unsigned long usecs_to_ticks(unsigned long usecs)
|
||||||
|
|
Loading…
Add table
Reference in a new issue