public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Rob Herring <robherring2@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 6/9] ARM: vexpress: convert to common timer code
Date: Fri,  4 Oct 2013 10:22:45 -0500	[thread overview]
Message-ID: <1380900168-23791-7-git-send-email-robherring2@gmail.com> (raw)
In-Reply-To: <1380900168-23791-1-git-send-email-robherring2@gmail.com>

From: Rob Herring <rob.herring@calxeda.com>

Convert vexpress to use the commmon timer code.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 board/armltd/vexpress/vexpress_common.c | 71 ---------------------------------
 include/configs/vexpress_common.h       |  4 ++
 2 files changed, 4 insertions(+), 71 deletions(-)

diff --git a/board/armltd/vexpress/vexpress_common.c b/board/armltd/vexpress/vexpress_common.c
index 4c7a7f4..25438fb 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)
 {
 }
@@ -246,13 +185,3 @@ void lowlevel_init(void)
 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;
-}
diff --git a/include/configs/vexpress_common.h b/include/configs/vexpress_common.h
index 75a4500..46bab0b 100644
--- a/include/configs/vexpress_common.h
+++ b/include/configs/vexpress_common.h
@@ -132,6 +132,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
-- 
1.8.1.2

  parent reply	other threads:[~2013-10-04 15:22 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-08 20:12 [U-Boot] [PATCH 0/9] Consolidate ARM timer code Rob Herring
2013-09-08 20:12 ` [U-Boot] [PATCH 1/9] ARM: add common timer functions Rob Herring
2013-09-08 20:12 ` [U-Boot] [PATCH 2/9] examples: enable gc-sections option Rob Herring
2013-09-08 20:12 ` [U-Boot] [PATCH 3/9] time: create default __udelay Rob Herring
2013-09-08 20:12 ` [U-Boot] [PATCH 4/9] ARM: highbank: convert to common timer code Rob Herring
2013-09-08 20:12 ` [U-Boot] [PATCH 5/9] ARM: mx25: " Rob Herring
2013-09-08 23:56   ` Benoît Thébaudeau
2013-09-09 21:00     ` Rob Herring
2013-09-10 10:25       ` Benoît Thébaudeau
2013-09-10 16:20         ` Rob Herring
2013-09-08 20:12 ` [U-Boot] [PATCH 6/9] ARM: mx27: " Rob Herring
2013-09-08 20:12 ` [U-Boot] [PATCH 7/9] ARM: vexpress: " Rob Herring
2013-09-08 20:12 ` [U-Boot] [PATCH 8/9] ARM: socfpga: " Rob Herring
2013-09-08 20:12 ` [U-Boot] [PATCH 9/9] ARM: tegra: " Rob Herring
2013-09-09  5:53 ` [U-Boot] [PATCH 0/9] Consolidate ARM " Wolfgang Denk
2013-09-09 14:52   ` Rob Herring
2013-09-09 15:37     ` Wolfgang Denk
2013-09-09  7:13 ` Lukasz Majewski
2013-09-09 18:55   ` Rob Herring
2013-10-04 15:22 ` [U-Boot] [PATCH v2 0/9] Consolidate " Rob Herring
2013-10-04 15:22   ` [U-Boot] [PATCH v2 1/9] examples: enable gc-sections option Rob Herring
2013-10-04 15:22   ` [U-Boot] [PATCH v2 2/9] Introduce common timer functions Rob Herring
2013-10-04 15:22   ` [U-Boot] [PATCH v2 3/9] sh: convert to common timer code Rob Herring
2013-10-04 15:22   ` [U-Boot] [PATCH v2 4/9] ARM: highbank: " Rob Herring
2013-10-04 15:22   ` [U-Boot] [PATCH v2 5/9] ARM: mx25: " Rob Herring
2013-10-04 15:22   ` Rob Herring [this message]
2013-10-04 15:22   ` [U-Boot] [PATCH v2 7/9] ARM: socfpga: " Rob Herring
2013-10-04 15:22   ` [U-Boot] [PATCH v2 8/9] ARM: tegra: " Rob Herring
2013-10-04 15:22   ` [U-Boot] [PATCH v2 9/9] ARM: versatile: " Rob Herring
2013-11-04 21:31   ` [U-Boot] [PATCH v2 0/9] Consolidate " Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1380900168-23791-7-git-send-email-robherring2@gmail.com \
    --to=robherring2@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox