mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-01-25 03:15:17 +00:00
ep93xx timer: Fix resolution of get_ticks()
ep93xx timer: Make get_ticks() return a value in CONFIG_SYS_HZ resolution, as announced by get_tbclk() Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
This commit is contained in:
parent
39ecbfcce0
commit
dea86bb9aa
1 changed files with 9 additions and 6 deletions
|
@ -69,7 +69,7 @@ static inline unsigned long read_timer(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* timer without interrupts
|
* Get the number of ticks (in CONFIG_SYS_HZ resolution)
|
||||||
*/
|
*/
|
||||||
unsigned long long get_ticks(void)
|
unsigned long long get_ticks(void)
|
||||||
{
|
{
|
||||||
|
@ -83,12 +83,12 @@ unsigned long long get_ticks(void)
|
||||||
|
|
||||||
timer.last_update = now;
|
timer.last_update = now;
|
||||||
|
|
||||||
return timer.ticks;
|
return clk_to_systicks(timer.ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long get_timer_masked(void)
|
unsigned long get_timer_masked(void)
|
||||||
{
|
{
|
||||||
return clk_to_systicks(get_ticks());
|
return get_ticks();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long get_timer(unsigned long base)
|
unsigned long get_timer(unsigned long base)
|
||||||
|
@ -109,10 +109,13 @@ void reset_timer(void)
|
||||||
|
|
||||||
void __udelay(unsigned long usec)
|
void __udelay(unsigned long usec)
|
||||||
{
|
{
|
||||||
const unsigned long target = get_ticks() + usecs_to_ticks(usec);
|
/* read the timer and update timer.ticks */
|
||||||
|
get_ticks();
|
||||||
|
|
||||||
while (get_ticks() < target)
|
const unsigned long long target = timer.ticks + usecs_to_ticks(usec);
|
||||||
/* noop */;
|
|
||||||
|
while (timer.ticks < target)
|
||||||
|
get_ticks();
|
||||||
}
|
}
|
||||||
|
|
||||||
int timer_init(void)
|
int timer_init(void)
|
||||||
|
|
Loading…
Reference in a new issue