From patchwork Fri Feb 18 12:50:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reinhard Meyer X-Patchwork-Id: 83588 X-Patchwork-Delegate: info@emk-elektronik.de 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 5B37CB70ED for ; Fri, 18 Feb 2011 23:19:24 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B907C280FA; Fri, 18 Feb 2011 13:18:24 +0100 (CET) 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 wRD6Zf8Nboq2; Fri, 18 Feb 2011 13:18:24 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 429D728101; Fri, 18 Feb 2011 13:16:52 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 11713280A8 for ; Fri, 18 Feb 2011 13:16:37 +0100 (CET) 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 DEOk9Wi9etvB for ; Fri, 18 Feb 2011 13:16:36 +0100 (CET) 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 moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by theia.denx.de (Postfix) with ESMTP id 440C828083 for ; Fri, 18 Feb 2011 13:16:06 +0100 (CET) Received: from localhost.localdomain (p5B201A57.dip0.t-ipconnect.de [91.32.26.87]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0M0bqI-1Q4Eg41BNO-00vBIL; Fri, 18 Feb 2011 13:16:06 +0100 From: Reinhard Meyer To: u-boot@lists.denx.de Date: Fri, 18 Feb 2011 13:50:13 +0100 Message-Id: <1298033414-11481-16-git-send-email-u-boot@emk-elektronik.de> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <1298033414-11481-15-git-send-email-u-boot@emk-elektronik.de> References: <1298033414-11481-1-git-send-email-u-boot@emk-elektronik.de> <1298033414-11481-2-git-send-email-u-boot@emk-elektronik.de> <1298033414-11481-3-git-send-email-u-boot@emk-elektronik.de> <1298033414-11481-4-git-send-email-u-boot@emk-elektronik.de> <1298033414-11481-5-git-send-email-u-boot@emk-elektronik.de> <1298033414-11481-6-git-send-email-u-boot@emk-elektronik.de> <1298033414-11481-7-git-send-email-u-boot@emk-elektronik.de> <1298033414-11481-8-git-send-email-u-boot@emk-elektronik.de> <1298033414-11481-9-git-send-email-u-boot@emk-elektronik.de> <1298033414-11481-10-git-send-email-u-boot@emk-elektronik.de> <1298033414-11481-11-git-send-email-u-boot@emk-elektronik.de> <1298033414-11481-12-git-send-email-u-boot@emk-elektronik.de> <1298033414-11481-13-git-send-email-u-boot@emk-elektronik.de> <1298033414-11481-14-git-send-email-u-boot@emk-elektronik.de> <1298033414-11481-15-git-send-email-u-boot@emk-elektronik.de> X-Provags-ID: V02:K0:oMWIGKJxUTgB++0FfueTiSSKoyWOm7nt/Px8bdJIHfl a0gt8p+67+l6l1VNFAu41q2ZdpGRXEIlUDDpV8M8DYdcarA9Uo TSC+nMIzYBR1/amGV1mH0NQU7Wn2kNO8H9fi1OKLIWAAiE7ncA dqCYaz3rqMs8wI5kIa7ITHDYtArbBQ7/GUOtVgadwYkYUQRmfm epc6dcjXUaNmliAJyqUH9Ycd8IKSm9VM0OQs+GNcJE= Subject: [U-Boot] [PATCH 15/15] AT91: fix timer.c - remove reset_timer() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 Signed-off-by: Reinhard Meyer --- arch/arm/cpu/arm926ejs/at91/timer.c | 27 +++++++++++---------------- 1 files changed, 11 insertions(+), 16 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/at91/timer.c b/arch/arm/cpu/arm926ejs/at91/timer.c index 87a5b63..a087687 100644 --- a/arch/arm/cpu/arm926ejs/at91/timer.c +++ b/arch/arm/cpu/arm926ejs/at91/timer.c @@ -103,33 +103,28 @@ unsigned long long get_ticks(void) void __udelay(unsigned long usec) { - unsigned long long tmp; + unsigned long long start; ulong tmo; - tmo = usec_to_tick(usec); - tmp = get_ticks() + tmo; /* get current timestamp */ - - while (get_ticks() < tmp) /* loop till event */ - ; + start = get_ticks(); /* get current timestamp */ + tmo = usec_to_tick(usec); /* convert usecs to ticks */ + while ((get_ticks() - start) < tmo) + ; /* loop till time has passed */ } /* - * reset_timer() and get_timer(base) are a pair of functions that are used by - * some timeout/sleep mechanisms in u-boot. + * get_timer(base) can be used to check for timeouts or + * to measure elasped time relative to an event: * - * reset_timer() marks the current time as epoch and - * get_timer(base) works relative to that epoch. + * ulong start_time = get_timer(0) sets start_time to the current + * time value. + * get_timer(start_time) returns the time elapsed since then. * * The time is used in CONFIG_SYS_HZ units! */ -void reset_timer(void) -{ - gd->timer_reset_value = get_ticks(); -} - ulong get_timer(ulong base) { - return tick_to_time(get_ticks() - gd->timer_reset_value) - base; + return tick_to_time(get_ticks()) - base; } /*