summaryrefslogtreecommitdiff
path: root/arch/arm/cpu/arm1136
diff options
context:
space:
mode:
authorHunter, Jon <jon-hunter@ti.com>2013-04-03 09:35:36 +0000
committerTom Rini <trini@ti.com>2013-04-08 11:29:05 -0400
commitd1da76e9f8987529fadaa56d97d29e5d8ab8f918 (patch)
tree8aa0a50f8c2248eef4ec99d82baa608a50e8e102 /arch/arm/cpu/arm1136
parentfaad9c02562653a16a2a5ad76b841b2306e531ec (diff)
downloadu-boot-imx-d1da76e9f8987529fadaa56d97d29e5d8ab8f918.zip
u-boot-imx-d1da76e9f8987529fadaa56d97d29e5d8ab8f918.tar.gz
u-boot-imx-d1da76e9f8987529fadaa56d97d29e5d8ab8f918.tar.bz2
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: Jon Hunter <jon-hunter@ti.com>
Diffstat (limited to 'arch/arm/cpu/arm1136')
-rw-r--r--arch/arm/cpu/arm1136/omap24xx/timer.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/arm/cpu/arm1136/omap24xx/timer.c b/arch/arm/cpu/arm1136/omap24xx/timer.c
index 53015cb..3b6666b 100644
--- a/arch/arm/cpu/arm1136/omap24xx/timer.c
+++ b/arch/arm/cpu/arm1136/omap24xx/timer.c
@@ -31,13 +31,16 @@
*/
#include <common.h>
+#include <asm/io.h>
#include <asm/arch/bits.h>
#include <asm/arch/omap2420.h>
+#define TIMER_CLOCK (CONFIG_SYS_CLK_FREQ / (2 << CONFIG_SYS_PTV))
#define TIMER_LOAD_VAL 0
/* 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;
@@ -99,7 +102,8 @@ ulong get_timer_masked (void)
gd->arch.tbl += (now - gd->arch.lastinc);
} else {
/* 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;
return gd->arch.tbl;