From patchwork Fri Dec 14 06:48:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 206304 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 DF62A2C008E for ; Fri, 14 Dec 2012 17:54:37 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0664E4A120; Fri, 14 Dec 2012 07:54:36 +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 3N5WiDU9Ch+q; Fri, 14 Dec 2012 07:54:35 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7C4734A184; Fri, 14 Dec 2012 07:51:29 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 057204A122 for ; Fri, 14 Dec 2012 07:50:43 +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 xqXJHUJ75VAC for ; Fri, 14 Dec 2012 07:50:42 +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 mail-we0-f202.google.com (mail-we0-f202.google.com [74.125.82.202]) by theia.denx.de (Postfix) with ESMTPS id 0ED294A119 for ; Fri, 14 Dec 2012 07:50:21 +0100 (CET) Received: by mail-we0-f202.google.com with SMTP id t57so157395wey.3 for ; Thu, 13 Dec 2012 22:50:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=rf4DNbLO2ov1zhHVNAitcrVRvxm2oPUGete12+aQ6JA=; b=Z0Tn/61FL/2F5sGqFmhUO6olIvCPbkjuOLv1fM9+e8sOQQgAIcNpeKzqvjeV0ZDNHX 9j6+aycRXRfO4LZqChZaWEvQJ9HBLQ3eWkY4XxPHnhzPpRt6NXuJ0RzeJ3UgDWKdYpE8 onWu6FM2HYrb1LTf5GC/yBa6PJAfJ0dSBMMV8NmZw1BKRdOot7R1DLTq9u8jRmgUVAm9 mbSYBkgMwEdpKl4X6ezSMaX5AlA6nlttG0RHTa+FVf/Aiw/Zsz7+9M0AkHpr5mFcFQqS kF//qPAr7OH2Cpxb/OC9tq3E+EZ3epUwkdmGOVxKeQMiSFKP5+pT7sLwLE4lsZfD9nKV HseA== Received: by 10.14.0.196 with SMTP id 44mr4613402eeb.6.1355467819963; Thu, 13 Dec 2012 22:50:19 -0800 (PST) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id z44si963249een.0.2012.12.13.22.50.19 (version=TLSv1/SSLv3 cipher=AES128-SHA); Thu, 13 Dec 2012 22:50:19 -0800 (PST) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by hpza10.eem.corp.google.com (Postfix) with ESMTP id 6F4CE20005C; Thu, 13 Dec 2012 22:50:19 -0800 (PST) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id CCBCB160886; Thu, 13 Dec 2012 22:50:18 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Date: Thu, 13 Dec 2012 22:48:32 -0800 Message-Id: <1355467767-29575-4-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1355467767-29575-1-git-send-email-sjg@chromium.org> References: <1355467767-29575-1-git-send-email-sjg@chromium.org> X-Gm-Message-State: ALoCoQl3zkRPgYWt+ljaaScimdbXkWGyRzjHt2sV0UyHmrvZrZqa+MYznJjMYdhbTG+bsom35ddR0kTqFvmKGL4ye1hiI147thAJSXXOdDrykSnjQOJ8/CRrQ+KJMQPTLpX4LoYsamrSxSsVk/RelrMvlVkcRXAs8ZYhi4BEUpAS3H0E9RzXHSkC8txhI9Xp+/xTNj3qi8v2 Cc: Tom Rini Subject: [U-Boot] [PATCH v2 03/58] arm: Move timer_rate_hz into arch_global_data 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 Move this field into arch_global_data and tidy up. Signed-off-by: Simon Glass --- Changes in v2: None arch/arm/cpu/arm920t/a320/timer.c | 8 ++++---- arch/arm/cpu/arm920t/s3c24x0/timer.c | 4 ++-- arch/arm/cpu/arm926ejs/at91/timer.c | 8 ++++---- arch/arm/cpu/arm926ejs/davinci/timer.c | 9 +++++---- arch/arm/include/asm/global_data.h | 3 ++- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/arch/arm/cpu/arm920t/a320/timer.c b/arch/arm/cpu/arm920t/a320/timer.c index 4bfcef2..2873643 100644 --- a/arch/arm/cpu/arm920t/a320/timer.c +++ b/arch/arm/cpu/arm920t/a320/timer.c @@ -31,14 +31,14 @@ DECLARE_GLOBAL_DATA_PTR; static inline unsigned long long tick_to_time(unsigned long long tick) { tick *= CONFIG_SYS_HZ; - do_div(tick, gd->timer_rate_hz); + do_div(tick, gd->arch.timer_rate_hz); return tick; } static inline unsigned long long usec_to_tick(unsigned long long usec) { - usec *= gd->timer_rate_hz; + usec *= gd->arch.timer_rate_hz; do_div(usec, 1000000); return usec; @@ -74,7 +74,7 @@ int timer_init(void) cr |= FTTMR010_TM3_ENABLE; writel(cr, &tmr->cr); - gd->timer_rate_hz = TIMER_CLOCK; + gd->arch.timer_rate_hz = TIMER_CLOCK; gd->tbu = gd->tbl = 0; return 0; @@ -126,5 +126,5 @@ ulong get_timer(ulong base) */ ulong get_tbclk(void) { - return gd->timer_rate_hz; + return gd->arch.timer_rate_hz; } diff --git a/arch/arm/cpu/arm920t/s3c24x0/timer.c b/arch/arm/cpu/arm920t/s3c24x0/timer.c index d8668be..7694fea 100644 --- a/arch/arm/cpu/arm920t/s3c24x0/timer.c +++ b/arch/arm/cpu/arm920t/s3c24x0/timer.c @@ -52,7 +52,7 @@ int timer_init(void) * @33.25MHz and 15625 @ 50 MHz */ gd->tbu = get_PCLK() / (2 * 16 * 100); - gd->timer_rate_hz = get_PCLK() / (2 * 16); + gd->arch.timer_rate_hz = get_PCLK() / (2 * 16); } /* load value for 10 ms timeout */ writel(gd->tbu, &timers->tcntb4); @@ -93,7 +93,7 @@ ulong get_timer_masked(void) { ulong tmr = get_ticks(); - return tmr / (gd->timer_rate_hz / CONFIG_SYS_HZ); + return tmr / (gd->arch.timer_rate_hz / CONFIG_SYS_HZ); } void udelay_masked(unsigned long usec) diff --git a/arch/arm/cpu/arm926ejs/at91/timer.c b/arch/arm/cpu/arm926ejs/at91/timer.c index 641ae3e..061ccaf 100644 --- a/arch/arm/cpu/arm926ejs/at91/timer.c +++ b/arch/arm/cpu/arm926ejs/at91/timer.c @@ -52,14 +52,14 @@ DECLARE_GLOBAL_DATA_PTR; static inline unsigned long long tick_to_time(unsigned long long tick) { tick *= CONFIG_SYS_HZ; - do_div(tick, gd->timer_rate_hz); + do_div(tick, gd->arch.timer_rate_hz); return tick; } static inline unsigned long long usec_to_tick(unsigned long long usec) { - usec *= gd->timer_rate_hz; + usec *= gd->arch.timer_rate_hz; do_div(usec, 1000000); return usec; @@ -79,7 +79,7 @@ int timer_init(void) /* Enable PITC */ writel(TIMER_LOAD_VAL | AT91_PIT_MR_EN , &pit->mr); - gd->timer_rate_hz = gd->arch.mck_rate_hz / 16; + gd->arch.timer_rate_hz = gd->arch.mck_rate_hz / 16; gd->tbu = gd->tbl = 0; return 0; @@ -132,5 +132,5 @@ ulong get_timer(ulong base) */ ulong get_tbclk(void) { - return gd->timer_rate_hz; + return gd->arch.timer_rate_hz; } diff --git a/arch/arm/cpu/arm926ejs/davinci/timer.c b/arch/arm/cpu/arm926ejs/davinci/timer.c index 93c9e60..7e852b5 100644 --- a/arch/arm/cpu/arm926ejs/davinci/timer.c +++ b/arch/arm/cpu/arm926ejs/davinci/timer.c @@ -60,7 +60,7 @@ int timer_init(void) writel(0x0, &timer->tim34); writel(TIMER_LOAD_VAL, &timer->prd34); writel(2 << 22, &timer->tcr); - gd->timer_rate_hz = CONFIG_SYS_HZ_CLOCK / TIM_CLK_DIV; + gd->arch.timer_rate_hz = CONFIG_SYS_HZ_CLOCK / TIM_CLK_DIV; gd->timer_reset_value = 0; return(0); @@ -87,14 +87,15 @@ ulong get_timer(ulong base) timer_diff = get_ticks() - gd->timer_reset_value; - return lldiv(timer_diff, (gd->timer_rate_hz / CONFIG_SYS_HZ)) - base; + return lldiv(timer_diff, + (gd->arch.timer_rate_hz / CONFIG_SYS_HZ)) - base; } void __udelay(unsigned long usec) { unsigned long long endtime; - endtime = lldiv((unsigned long long)usec * gd->timer_rate_hz, + endtime = lldiv((unsigned long long)usec * gd->arch.timer_rate_hz, 1000000UL); endtime += get_ticks(); @@ -108,7 +109,7 @@ void __udelay(unsigned long usec) */ ulong get_tbclk(void) { - return gd->timer_rate_hz; + return gd->arch.timer_rate_hz; } #ifdef CONFIG_HW_WATCHDOG diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h index ba7814a..7a2f644 100644 --- a/arch/arm/include/asm/global_data.h +++ b/arch/arm/include/asm/global_data.h @@ -35,6 +35,8 @@ struct arch_global_data { unsigned long pllb_rate_hz; unsigned long at91_pllb_usb_init; #endif + /* "static data" needed by most of timer.c on ARM platforms */ + unsigned long timer_rate_hz; }; /* @@ -61,7 +63,6 @@ typedef struct global_data { #endif #ifdef CONFIG_ARM /* "static data" needed by most of timer.c on ARM platforms */ - unsigned long timer_rate_hz; unsigned long tbl; unsigned long tbu; unsigned long long timer_reset_value;