mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-26 06:30:39 +00:00
zynq: timer: Fix wrong timer calculation
Fix wrong timer calculation in get_timer_masked incase of overflow. This fixes the issue of getting wrong time from get_timer() calls. Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
This commit is contained in:
parent
eddabd1662
commit
a7858f62d7
1 changed files with 3 additions and 1 deletions
|
@ -93,7 +93,9 @@ ulong get_timer_masked(void)
|
||||||
gd->arch.tbl += gd->arch.lastinc - now;
|
gd->arch.tbl += gd->arch.lastinc - now;
|
||||||
} else {
|
} else {
|
||||||
/* We have an overflow ... */
|
/* We have an overflow ... */
|
||||||
gd->arch.tbl += gd->arch.lastinc + TIMER_LOAD_VAL - now + 1;
|
gd->arch.tbl += gd->arch.lastinc + (TIMER_LOAD_VAL /
|
||||||
|
(gd->arch.timer_rate_hz / CONFIG_SYS_HZ)) -
|
||||||
|
now + 1;
|
||||||
}
|
}
|
||||||
gd->arch.lastinc = now;
|
gd->arch.lastinc = now;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue