Skip to content
Snippets Groups Projects
Commit d1da76e9 authored by Hunter, Jon's avatar Hunter, Jon Committed by Tom Rini
Browse files

omap2420-h4: Fix get_timer() and CONFIG_SYS_HZ


The function get_timer() should return time in ms and CONFIG_SYS_HZ
should be set to 1000 by default. Fix both of these items.

Signed-off-by: default avatarJon Hunter <jon-hunter@ti.com>
parent faad9c02
No related branches found
No related tags found
No related merge requests found
...@@ -31,13 +31,16 @@ ...@@ -31,13 +31,16 @@
*/ */
#include <common.h> #include <common.h>
#include <asm/io.h>
#include <asm/arch/bits.h> #include <asm/arch/bits.h>
#include <asm/arch/omap2420.h> #include <asm/arch/omap2420.h>
#define TIMER_CLOCK (CONFIG_SYS_CLK_FREQ / (2 << CONFIG_SYS_PTV))
#define TIMER_LOAD_VAL 0 #define TIMER_LOAD_VAL 0
/* macro to read the 32 bit timer */ /* macro to read the 32 bit timer */
#define READ_TIMER (*((volatile ulong *)(CONFIG_SYS_TIMERBASE+TCRR))) #define READ_TIMER readl(CONFIG_SYS_TIMERBASE+TCRR) \
/ (TIMER_CLOCK / CONFIG_SYS_HZ)
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
...@@ -99,7 +102,8 @@ ulong get_timer_masked (void) ...@@ -99,7 +102,8 @@ ulong get_timer_masked (void)
gd->arch.tbl += (now - gd->arch.lastinc); gd->arch.tbl += (now - gd->arch.lastinc);
} else { } else {
/* we have rollover of incrementer */ /* we have rollover of incrementer */
gd->arch.tbl += (0xFFFFFFFF - gd->arch.lastinc) + now; gd->arch.tbl += ((0xFFFFFFFF / (TIMER_CLOCK / CONFIG_SYS_HZ))
- gd->arch.lastinc) + now;
} }
gd->arch.lastinc = now; gd->arch.lastinc = now;
return gd->arch.tbl; return gd->arch.tbl;
......
...@@ -190,7 +190,7 @@ ...@@ -190,7 +190,7 @@
#define CONFIG_SYS_TIMERBASE OMAP2420_GPT2 #define CONFIG_SYS_TIMERBASE OMAP2420_GPT2
#define CONFIG_SYS_PTV V_PTV /* 2^(PTV+1) */ #define CONFIG_SYS_PTV V_PTV /* 2^(PTV+1) */
#define CONFIG_SYS_HZ ((CONFIG_SYS_CLK_FREQ)/(2 << CONFIG_SYS_PTV)) #define CONFIG_SYS_HZ 1000
/*----------------------------------------------------------------------- /*-----------------------------------------------------------------------
* Physical Memory Map * Physical Memory Map
......
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