mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-11 07:34:31 +00:00
nds32: ag101/ag102: Fix setting lastdec and now values
The timer3 counter unit for lastdesc and now values are inconsistent in current code. The unit of "readl(&tmr->timer3_counter) / (CONFIG_SYS_CLK_FREQ / 2)" is second. However, CONFIG_SYS_HZ is defined as 1000 in board config file. This means the accuracy of "lastdec" and "now" should be in millisecond, thus fix the equation to set lastdec and now variables accordingly. Signed-off-by: Axel Lin <axel.lin@ingics.com>
This commit is contained in:
parent
e3c58b0292
commit
4fc9670513
2 changed files with 8 additions and 6 deletions
|
@ -86,7 +86,8 @@ void reset_timer_masked(void)
|
|||
#ifdef CONFIG_FTTMR010_EXT_CLK
|
||||
lastdec = readl(&tmr->timer3_counter) / (TIMER_CLOCK / CONFIG_SYS_HZ);
|
||||
#else
|
||||
lastdec = readl(&tmr->timer3_counter) / (CONFIG_SYS_CLK_FREQ / 2);
|
||||
lastdec = readl(&tmr->timer3_counter) /
|
||||
(CONFIG_SYS_CLK_FREQ / 2 / CONFIG_SYS_HZ);
|
||||
#endif
|
||||
timestamp = 0; /* start "advancing" time stamp from 0 */
|
||||
|
||||
|
@ -110,8 +111,8 @@ ulong get_timer_masked(void)
|
|||
#ifdef CONFIG_FTTMR010_EXT_CLK
|
||||
ulong now = readl(&tmr->timer3_counter) / (TIMER_CLOCK / CONFIG_SYS_HZ);
|
||||
#else
|
||||
ulong now = readl(&tmr->timer3_counter) / \
|
||||
(CONFIG_SYS_CLK_FREQ / 2 / 1024);
|
||||
ulong now = readl(&tmr->timer3_counter) /
|
||||
(CONFIG_SYS_CLK_FREQ / 2 / CONFIG_SYS_HZ);
|
||||
#endif
|
||||
|
||||
debug("%s(): now = %lx, lastdec = %lx\n", __func__, now, lastdec);
|
||||
|
|
|
@ -86,7 +86,8 @@ void reset_timer_masked(void)
|
|||
#ifdef CONFIG_FTTMR010_EXT_CLK
|
||||
lastdec = readl(&tmr->timer3_counter) / (TIMER_CLOCK / CONFIG_SYS_HZ);
|
||||
#else
|
||||
lastdec = readl(&tmr->timer3_counter) / (CONFIG_SYS_CLK_FREQ / 2);
|
||||
lastdec = readl(&tmr->timer3_counter) /
|
||||
(CONFIG_SYS_CLK_FREQ / 2 / CONFIG_SYS_HZ);
|
||||
#endif
|
||||
timestamp = 0; /* start "advancing" time stamp from 0 */
|
||||
|
||||
|
@ -110,8 +111,8 @@ ulong get_timer_masked(void)
|
|||
#ifdef CONFIG_FTTMR010_EXT_CLK
|
||||
ulong now = readl(&tmr->timer3_counter) / (TIMER_CLOCK / CONFIG_SYS_HZ);
|
||||
#else
|
||||
ulong now = readl(&tmr->timer3_counter) / \
|
||||
(CONFIG_SYS_CLK_FREQ / 2 / 1024);
|
||||
ulong now = readl(&tmr->timer3_counter) /
|
||||
(CONFIG_SYS_CLK_FREQ / 2 / CONFIG_SYS_HZ);
|
||||
#endif
|
||||
|
||||
debug("%s(): now = %lx, lastdec = %lx\n", __func__, now, lastdec);
|
||||
|
|
Loading…
Reference in a new issue