summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Herring <rob.herring@calxeda.com>2013-10-04 10:22:45 -0500
committerTom Rini <trini@ti.com>2013-11-04 11:23:45 -0500
commitb3a7f22b3e096f3699d3262e114110d6e7183816 (patch)
treeb16b28baa9adc1e734937f8c06a2dff84aedf1eb
parent3dae5b510eb966214a3cc32476ca4e45029f087e (diff)
downloadblackbird-obmc-uboot-b3a7f22b3e096f3699d3262e114110d6e7183816.tar.gz
blackbird-obmc-uboot-b3a7f22b3e096f3699d3262e114110d6e7183816.zip
ARM: vexpress: convert to common timer code
Convert vexpress to use the commmon timer code. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
-rw-r--r--board/armltd/vexpress/vexpress_common.c71
-rw-r--r--include/configs/vexpress_common.h4
2 files changed, 4 insertions, 71 deletions
diff --git a/board/armltd/vexpress/vexpress_common.c b/board/armltd/vexpress/vexpress_common.c
index 56febd9525..da5cb0152b 100644
--- a/board/armltd/vexpress/vexpress_common.c
+++ b/board/armltd/vexpress/vexpress_common.c
@@ -26,9 +26,6 @@
#include <asm/arch/wdt.h>
#include "../drivers/mmc/arm_pl180_mmci.h"
-static ulong timestamp;
-static ulong lastdec;
-
static struct systimer *systimer_base = (struct systimer *)V2M_TIMER01;
static struct sysctrl *sysctrl_base = (struct sysctrl *)SCTL_BASE;
@@ -152,8 +149,6 @@ static void vexpress_timer_init(void)
writel(SYSTIMER_EN | SYSTIMER_32BIT |
readl(&systimer_base->timer0control),
&systimer_base->timer0control);
-
- reset_timer_masked();
}
int v2m_cfg_write(u32 devfn, u32 data)
@@ -183,62 +178,6 @@ void reset_cpu(ulong addr)
printf("Unable to reboot\n");
}
-/*
- * Delay x useconds AND perserve advance timstamp value
- * assumes timer is ticking at 1 msec
- */
-void __udelay(ulong usec)
-{
- ulong tmo, tmp;
-
- tmo = usec / 1000;
- tmp = get_timer(0); /* get current timestamp */
-
- /*
- * If setting this forward will roll time stamp then
- * reset "advancing" timestamp to 0 and set lastdec value
- * otherwise set the advancing stamp to the wake up time
- */
- if ((tmo + tmp + 1) < tmp)
- reset_timer_masked();
- else
- tmo += tmp;
-
- while (get_timer_masked() < tmo)
- ; /* loop till wakeup event */
-}
-
-ulong get_timer(ulong base)
-{
- return get_timer_masked() - base;
-}
-
-void reset_timer_masked(void)
-{
- lastdec = readl(&systimer_base->timer0value) / 1000;
- timestamp = 0;
-}
-
-ulong get_timer_masked(void)
-{
- ulong now = readl(&systimer_base->timer0value) / 1000;
-
- if (lastdec >= now) { /* normal mode (non roll) */
- timestamp += lastdec - now;
- } else { /* count down timer overflowed */
- /*
- * nts = ts + ld - now
- * ts = old stamp, ld = time before passing through - 1
- * now = amount of time after passing though - 1
- * nts = new "advancing time stamp"
- */
- timestamp += lastdec + SYSTIMER_RELOAD - now;
- }
- lastdec = now;
-
- return timestamp;
-}
-
void lowlevel_init(void)
{
}
@@ -247,16 +186,6 @@ ulong get_board_rev(void){
return readl((u32 *)SYS_ID);
}
-unsigned long long get_ticks(void)
-{
- return get_timer(0);
-}
-
-ulong get_tbclk(void)
-{
- return (ulong)CONFIG_SYS_HZ;
-}
-
#if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_ARMV7_VIRT)
/* Setting the address at which secondary cores start from.
* Versatile Express uses one address for all cores, so ignore corenr
diff --git a/include/configs/vexpress_common.h b/include/configs/vexpress_common.h
index 23e2007745..6da5e8f5db 100644
--- a/include/configs/vexpress_common.h
+++ b/include/configs/vexpress_common.h
@@ -131,6 +131,10 @@
#define SCTL_BASE V2M_SYSCTL
#define VEXPRESS_FLASHPROG_FLVPPEN (1 << 0)
+#define CONFIG_SYS_TIMER_RATE 1000000
+#define CONFIG_SYS_TIMER_COUNTER (0x10011000 + 0x4)
+#define CONFIG_SYS_TIMER_COUNTS_DOWN
+
/* SMSC9115 Ethernet from SMSC9118 family */
#define CONFIG_SMC911X 1
#define CONFIG_SMC911X_32_BIT 1
OpenPOWER on IntegriCloud