From patchwork Sun Sep 8 20:12:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 273457 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 7E9172C011E for ; Mon, 9 Sep 2013 06:14:06 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 05DDC4A062; Sun, 8 Sep 2013 22:13:50 +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 sREXDq3zB13f; Sun, 8 Sep 2013 22:13:49 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 174474A08F; Sun, 8 Sep 2013 22:13:33 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4CBEE4A062 for ; Sun, 8 Sep 2013 22:13:18 +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 IFz2J1V76WZp for ; Sun, 8 Sep 2013 22:13:12 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 BL_NJABL=SKIP(-1.5) (only DNSBL check requested) Received: from mail-oa0-f54.google.com (mail-oa0-f54.google.com [209.85.219.54]) by theia.denx.de (Postfix) with ESMTPS id 0FED54A061 for ; Sun, 8 Sep 2013 22:13:07 +0200 (CEST) Received: by mail-oa0-f54.google.com with SMTP id j10so5779261oah.41 for ; Sun, 08 Sep 2013 13:13:06 -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=422vwFoOTQ+axIM0mGQQd56RacICde4ULZJ3+8+bl8A=; b=tMj5pM7dkBZxe5e6zKIP3jZ9YU3Xi2LOOHyubzdVwX74I9HrNxcnMY9ld0EfRbBeak TfifStymkXRnMdbLE6dnME7nKxnRuU1mXR0LStaJYX9IYyUqn9RebdGWDB/LouvnEthX 29InbKZSiq43/BMZOpvfDNZMHsTWP00ilC1FfHx5jtYryevH9jeEuT++gdmI62Mr6tCf VehZd51xpeRfYh9sxlct0TTlUjAMi0z9ZBxb4ON8QZQXI2x9bo771S2HMWCOgEb0uyFK yX/79D/0JKzICWwHi9llnuorTioPolx/dn/12EoKatNv4c3kuq5yxZkCedXiifFBZZkQ isIw== X-Received: by 10.182.233.137 with SMTP id tw9mr8958469obc.87.1378671186715; Sun, 08 Sep 2013 13:13:06 -0700 (PDT) Received: from rob-laptop.grandenetworks.net (65-36-73-129.dyn.grandenetworks.net. [65.36.73.129]) by mx.google.com with ESMTPSA id z5sm9146333obg.13.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 08 Sep 2013 13:13:06 -0700 (PDT) From: Rob Herring To: u-boot@lists.denx.de Date: Sun, 8 Sep 2013 15:12:52 -0500 Message-Id: <1378671174-18535-8-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1378671174-18535-1-git-send-email-robherring2@gmail.com> References: <1378671174-18535-1-git-send-email-robherring2@gmail.com> Cc: Rob Herring Subject: [U-Boot] [PATCH 7/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 5b0721c..f204551 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