summaryrefslogtreecommitdiffstats
path: root/arch/arm/cpu/arm1136/omap24xx/timer.c
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2013-04-15 07:46:11 -0400
committerTom Rini <trini@ti.com>2013-04-15 07:46:11 -0400
commit17059f972fa6768ebf15a575c00083b3a431b79a (patch)
tree30df6b88fa1dc57dada54f9a16ab1619cc4f3c52 /arch/arm/cpu/arm1136/omap24xx/timer.c
parent277f037074fbb73be10a7bff27079b6eb0a3bfbb (diff)
parent8960af8ba9488fc54e2e4733cbada26d3cece225 (diff)
downloadtalos-obmc-uboot-17059f972fa6768ebf15a575c00083b3a431b79a.tar.gz
talos-obmc-uboot-17059f972fa6768ebf15a575c00083b3a431b79a.zip
Merge branch 'master' of git://git.denx.de/u-boot-arm
Diffstat (limited to 'arch/arm/cpu/arm1136/omap24xx/timer.c')
-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 53015cb77d..3b6666b791 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;
OpenPOWER on IntegriCloud