Skip to content
Snippets Groups Projects
Commit a7858f62 authored by Siva Durga Prasad Paladugu's avatar Siva Durga Prasad Paladugu Committed by Michal Simek
Browse files

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: default avatarSiva Durga Prasad Paladugu <sivadur@xilinx.com>
Signed-off-by: default avatarMichal Simek <michal.simek@xilinx.com>
parent eddabd16
No related branches found
No related tags found
No related merge requests found
...@@ -93,7 +93,9 @@ ulong get_timer_masked(void) ...@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment