summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Behme <dirk.behme@googlemail.com>2010-12-11 10:50:48 -0500
committerSandeep Paulraj <s-paulraj@ti.com>2010-12-11 10:50:48 -0500
commitb03c8403cd770332778eec9142f136a9c870aaeb (patch)
tree38b1b0167cd7bb8e9c67a62380ee70e339d1a1bf
parentaac0b4b6c153c413b4541a61d9c4296eef689e07 (diff)
downloadu-boot-imx-b03c8403cd770332778eec9142f136a9c870aaeb.zip
u-boot-imx-b03c8403cd770332778eec9142f136a9c870aaeb.tar.gz
u-boot-imx-b03c8403cd770332778eec9142f136a9c870aaeb.tar.bz2
OMAP: Timer: Replace bss variable by gd
Reuse the gd->tbl value for timestamp and add gd->lastinc for lastinc bss values in the OMAP timer driver. The usage of bss values in drivers before initialisation of bss is forbidden. In that special case some data in .rel.dyn gets corrupted. Signed-off-by: Dirk Behme <dirk.behme@gmail.com> Tested-by: Steve Sakoman <steve.sakoman@linaro.org> Tested-by: John Rigby <john.rigby@linaro.org> Tested-by: Nishanth Menon <nm@ti.com> Acked-by: Nishanth Menon <nm@ti.com> Tested-by: Heiko Schocher <hs@denx.de> Tested-by: Sandeep Paulraj <s-paulraj@ti.com> Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
-rw-r--r--arch/arm/cpu/armv7/omap-common/timer.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/arch/arm/cpu/armv7/omap-common/timer.c b/arch/arm/cpu/armv7/omap-common/timer.c
index 6b8cf7b..9beebb1 100644
--- a/arch/arm/cpu/armv7/omap-common/timer.c
+++ b/arch/arm/cpu/armv7/omap-common/timer.c
@@ -35,8 +35,8 @@
#include <common.h>
#include <asm/io.h>
-static ulong timestamp;
-static ulong lastinc;
+DECLARE_GLOBAL_DATA_PTR;
+
static struct gptimer *timer_base = (struct gptimer *)CONFIG_SYS_TIMERBASE;
/*
@@ -74,7 +74,7 @@ ulong get_timer(ulong base)
void set_timer(ulong t)
{
- timestamp = t;
+ gd->tbl = t;
}
/* delay x useconds */
@@ -96,8 +96,8 @@ void __udelay(unsigned long usec)
void reset_timer_masked(void)
{
/* reset time, capture current incrementer value time */
- lastinc = readl(&timer_base->tcrr) / (TIMER_CLOCK / CONFIG_SYS_HZ);
- timestamp = 0; /* start "advancing" time stamp from 0 */
+ gd->lastinc = readl(&timer_base->tcrr) / (TIMER_CLOCK / CONFIG_SYS_HZ);
+ gd->tbl = 0; /* start "advancing" time stamp from 0 */
}
ulong get_timer_masked(void)
@@ -105,14 +105,14 @@ ulong get_timer_masked(void)
/* current tick value */
ulong now = readl(&timer_base->tcrr) / (TIMER_CLOCK / CONFIG_SYS_HZ);
- if (now >= lastinc) /* normal mode (non roll) */
+ if (now >= gd->lastinc) /* normal mode (non roll) */
/* move stamp fordward with absoulte diff ticks */
- timestamp += (now - lastinc);
+ gd->tbl += (now - gd->lastinc);
else /* we have rollover of incrementer */
- timestamp += ((TIMER_LOAD_VAL / (TIMER_CLOCK / CONFIG_SYS_HZ))
- - lastinc) + now;
- lastinc = now;
- return timestamp;
+ gd->tbl += ((TIMER_LOAD_VAL / (TIMER_CLOCK / CONFIG_SYS_HZ))
+ - gd->lastinc) + now;
+ gd->lastinc = now;
+ return gd->tbl;
}
/*