mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2026-03-06 09:21:26 +01:00
qca: ipq806x: Fixed timer driver
The logic used to calculate tick count in _udelay() was always giving Zero. Updated the logic to make it work across QCA boards. Change-Id: Iebc5905003ad99e66b299de3beabb80ce40ce710 Signed-off-by: Aditya Kumar Patra S <apatr@codeaurora.org>
This commit is contained in:
parent
467a26184d
commit
6d2e7fc8a6
1 changed files with 9 additions and 3 deletions
|
|
@ -137,12 +137,18 @@ void __udelay(unsigned long usec)
|
|||
unsigned long long last;
|
||||
unsigned long long runcount;
|
||||
|
||||
val = (usec * GPT_FREQ);
|
||||
if (usec == 0)
|
||||
return;
|
||||
|
||||
val = (usec * GPT_FREQ_KHZ) / 1000;
|
||||
if (val == 0 )
|
||||
val = 1; /* Wait for atleast 1 tick */
|
||||
|
||||
last = read_counter();
|
||||
do {
|
||||
now = read_counter();
|
||||
if (last > now)
|
||||
runcount = (GPT_FREQ - last) + now;
|
||||
runcount = (TIMER_LOAD_VAL - last) + now;
|
||||
else
|
||||
runcount = now - last;
|
||||
} while (runcount < val);
|
||||
|
|
@ -177,7 +183,7 @@ ulong get_timer_masked(void)
|
|||
/* move stamp forward with absolute diff ticks */
|
||||
} else {
|
||||
/* we have overflow of the count down timer */
|
||||
timestamp += now + (TIMER_LOAD_VAL - lastinc);
|
||||
timestamp += now + (gpt_to_sys_freq(TIMER_LOAD_VAL) - lastinc);
|
||||
}
|
||||
lastinc = now;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue