From patchwork Fri Mar 22 03:32:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Warren X-Patchwork-Id: 229876 X-Patchwork-Delegate: albert.aribaud@free.fr 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 479792C0095 for ; Fri, 22 Mar 2013 14:32:50 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 15B774A041; Fri, 22 Mar 2013 04:32:47 +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 9RZCexRaws9n; Fri, 22 Mar 2013 04:32:46 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 548844A037; Fri, 22 Mar 2013 04:32:44 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 63BF64A037 for ; Fri, 22 Mar 2013 04:32:42 +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 z5rwuFfOHu1L for ; Fri, 22 Mar 2013 04:32:41 +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 avon.wwwdotorg.org (avon.wwwdotorg.org [70.85.31.133]) by theia.denx.de (Postfix) with ESMTPS id 32B634A033 for ; Fri, 22 Mar 2013 04:32:39 +0100 (CET) Received: from severn.wwwdotorg.org (unknown [192.168.65.5]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by avon.wwwdotorg.org (Postfix) with ESMTPS id 59D1F64F8; Thu, 21 Mar 2013 21:32:41 -0600 (MDT) Received: from dart.wwwdotorg.org (c-24-9-124-73.hsd1.co.comcast.net [24.9.124.73]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by severn.wwwdotorg.org (Postfix) with ESMTPSA id 26D6BE4634; Thu, 21 Mar 2013 21:32:36 -0600 (MDT) From: Stephen Warren To: u-boot@lists.denx.de, Albert Aribaud Date: Thu, 21 Mar 2013 21:32:30 -0600 Message-Id: <1363923150-12493-1-git-send-email-swarren@wwwdotorg.org> X-Mailer: git-send-email 1.7.10.4 X-NVConfidentiality: public X-Virus-Scanned: clamav-milter 0.96.5 at avon.wwwdotorg.org X-Virus-Status: Clean Subject: [U-Boot] [PATCH] ARM: bcm2835: fix get_timer() to return mS 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 Apparently, CONFIG_SYS_HZ must be 1000. Change this, and fix the timer driver to conform to this. Signed-off-by: Stephen Warren --- arch/arm/cpu/arm1176/bcm2835/timer.c | 13 +++++++++---- include/configs/rpi_b.h | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/arch/arm/cpu/arm1176/bcm2835/timer.c b/arch/arm/cpu/arm1176/bcm2835/timer.c index d232d7e..f550020 100644 --- a/arch/arm/cpu/arm1176/bcm2835/timer.c +++ b/arch/arm/cpu/arm1176/bcm2835/timer.c @@ -23,12 +23,17 @@ int timer_init(void) return 0; } -ulong get_timer(ulong base) +ulong get_timer_us(void) { struct bcm2835_timer_regs *regs = (struct bcm2835_timer_regs *)BCM2835_TIMER_PHYSADDR; - return readl(®s->clo) - base; + return readl(®s->clo); +} + +ulong get_timer(ulong base) +{ + return (get_timer_us() / 1000) - base; } unsigned long long get_ticks(void) @@ -46,10 +51,10 @@ void __udelay(unsigned long usec) ulong endtime; signed long diff; - endtime = get_timer(0) + usec; + endtime = get_timer_us() + usec; do { - ulong now = get_timer(0); + ulong now = get_timer_us(); diff = endtime - now; } while (diff >= 0); } diff --git a/include/configs/rpi_b.h b/include/configs/rpi_b.h index 3d55d36..c18b35b 100644 --- a/include/configs/rpi_b.h +++ b/include/configs/rpi_b.h @@ -31,7 +31,7 @@ #define CONFIG_MACH_TYPE MACH_TYPE_BCM2708 /* Timer */ -#define CONFIG_SYS_HZ 1000000 +#define CONFIG_SYS_HZ 1000 /* Memory layout */ #define CONFIG_NR_DRAM_BANKS 1