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>
gd->arch.tbl += gd->arch.lastinc - now;
} else {
/* 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;