From patchwork Fri Oct 4 15:22:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 280651 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 566EC2C00A7 for ; Sat, 5 Oct 2013 01:25:06 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0D7BB4A0AF; Fri, 4 Oct 2013 17:24:43 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1K3uduABE8jn; Fri, 4 Oct 2013 17:24:42 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 89B9E4A0C1; Fri, 4 Oct 2013 17:23:48 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9F3804A081 for ; Fri, 4 Oct 2013 17:23:35 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 89ESWDl1BzpM for ; Fri, 4 Oct 2013 17:23:30 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by theia.denx.de (Postfix) with ESMTPS id 7BD5C4A08A for ; Fri, 4 Oct 2013 17:23:16 +0200 (CEST) Received: by mail-ie0-f180.google.com with SMTP id u16so9431341iet.11 for ; Fri, 04 Oct 2013 08:23:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RXyozefOVPryazilGlzHoS+ToqwP8W3AZqZsAoZNnT4=; b=Zdogf1DNXpf7BkI3ATmvhoE3gEuYqVOGhFRpwOPGcp5PuYEJiy28MQz2EJjygHUAVJ C3Z/qVbR67npWzp7+v9mC+wsoz+rBi6EXdkr9pHCvP6asB65cE5ecBu3mhY+tsR8qmp5 hgBPr6Fv2+lvZJijoYPK9Tjml8xW12epZ2wB6Sn398cKnUMqRNKCgE4BwKNmxMHRFR9r jTn+seasyWcpCkz+xe9yL5UQkOtyj4ejUXCtduKl3i+jWw42Wh4ThtXZBw6yPsqVhxJ7 rJ0isavK9rSa+6HkdXBpwOgnEm7VIYvc4jrR2vqh5oHtSmOGF4gB34DgWHbXg+/GrR+q nd9A== X-Received: by 10.50.6.71 with SMTP id y7mr6873931igy.8.1380900195653; Fri, 04 Oct 2013 08:23:15 -0700 (PDT) Received: from rob-laptop.calxeda.com ([173.226.190.126]) by mx.google.com with ESMTPSA id f5sm7421998igc.4.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 04 Oct 2013 08:23:15 -0700 (PDT) From: Rob Herring To: u-boot@lists.denx.de Date: Fri, 4 Oct 2013 10:22:45 -0500 Message-Id: <1380900168-23791-7-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1380900168-23791-1-git-send-email-robherring2@gmail.com> References: <1378671174-18535-1-git-send-email-robherring2@gmail.com> <1380900168-23791-1-git-send-email-robherring2@gmail.com> Cc: Rob Herring Subject: [U-Boot] [PATCH v2 6/9] ARM: vexpress: convert to common timer code X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Rob Herring Convert vexpress to use the commmon timer code. Signed-off-by: Rob Herring --- 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 #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