From patchwork Fri Dec 14 06:48:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 206325 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 ECE922C0097 for ; Fri, 14 Dec 2012 17:58:55 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 638E24A1D6; Fri, 14 Dec 2012 07:58:44 +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 5OQW+FsMMpDd; Fri, 14 Dec 2012 07:58:44 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8996A4A119; Fri, 14 Dec 2012 07:55:19 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C7CA74A132 for ; Fri, 14 Dec 2012 07:53:21 +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 O91sMP43vxCG for ; Fri, 14 Dec 2012 07:53:19 +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-la0-f74.google.com (mail-la0-f74.google.com [209.85.215.74]) by theia.denx.de (Postfix) with ESMTPS id C5D404A14B for ; Fri, 14 Dec 2012 07:50:22 +0100 (CET) Received: by mail-la0-f74.google.com with SMTP id v3so155525lag.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=CZeEC3mQtu0eWzQVYGPnhkjllFOFk3viYtFielYh/bY=; b=e7yXCVJtzWjp4yZEwKtp3W6PUPSKuU1atkqVFx9qI90L8P08ZlF4cLCTpfTGHGpGM3 ga1oiSd28JgGvMkFp/zJkw3YVV6HmPYCf8DvTicy4LWUSQBI+Bqb8WBXsHR1GC1MWwKM BO4yzrflJShIdTvKq75AiWOk6uVsGOaigXc7jtsxxWW+a7V3d9+uKSvBqghhzV5/8ulH kQsgEqTrQvC+67tuRkO9UpRZy1XtxtZszavvXz3Fdd04P9oV4iSmLDEPgAJJNjmnJfJi ATXtWLIV6CwLjqYwY31dp1+eE33VDgw1AS7knbtQlv+u/MVxF52xidbgltGEBsCnJJ0H 1Fmw== Received: by 10.14.224.201 with SMTP id x49mr4610130eep.5.1355467820342; Thu, 13 Dec 2012 22:50:20 -0800 (PST) Received: from hpza10.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id g9si962748eeo.1.2012.12.13.22.50.20 (version=TLSv1/SSLv3 cipher=AES128-SHA); Thu, 13 Dec 2012 22:50:20 -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 A00B1200063; Thu, 13 Dec 2012 22:50:19 -0800 (PST) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 05B4516099F; Thu, 13 Dec 2012 22:50:18 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Date: Thu, 13 Dec 2012 22:48:34 -0800 Message-Id: <1355467767-29575-6-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: ALoCoQmAxwu3UkMCxC2OylHIeCgc8YSFlRvLCAM3FmMFLUw1wEncL5v7CYN2cz7YXCJHkeFsm5ByAqy5xxtcOF4D9fnla9MOuSZjQd3AYU65VY2LWBiCe3iRV9piNZj2pB05ue9zkKAwZ3/VnbxFUXWxk73vzVMZA0OaDPp6inKPeU8TWco3N5ZazflNZH5V/mxdWNCJ2ZvM Cc: Tom Rini Subject: [U-Boot] [PATCH v2 05/58] arm: Move tbl to 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/arm1136/mx31/timer.c | 6 +++--- arch/arm/cpu/arm1136/mx35/timer.c | 2 +- arch/arm/cpu/arm1136/omap24xx/timer.c | 17 ++++++++++------- arch/arm/cpu/arm920t/a320/timer.c | 8 ++++---- arch/arm/cpu/arm920t/at91/timer.c | 8 ++++---- arch/arm/cpu/arm920t/s3c24x0/timer.c | 8 ++++---- arch/arm/cpu/arm926ejs/armada100/timer.c | 14 +++++++------- arch/arm/cpu/arm926ejs/at91/timer.c | 8 ++++---- arch/arm/cpu/arm926ejs/davinci/timer.c | 6 +++--- arch/arm/cpu/arm926ejs/kirkwood/timer.c | 2 +- arch/arm/cpu/arm926ejs/mb86r0x/timer.c | 2 +- arch/arm/cpu/arm926ejs/mx25/timer.c | 2 +- arch/arm/cpu/arm926ejs/mx27/timer.c | 2 +- arch/arm/cpu/arm926ejs/mxs/timer.c | 2 +- arch/arm/cpu/arm926ejs/omap/timer.c | 2 +- arch/arm/cpu/arm926ejs/orion5x/timer.c | 2 +- arch/arm/cpu/arm926ejs/pantheon/timer.c | 14 +++++++------- arch/arm/cpu/arm926ejs/spear/timer.c | 2 +- arch/arm/cpu/arm926ejs/versatile/timer.c | 2 +- arch/arm/cpu/armv7/omap-common/timer.c | 15 ++++++++------- arch/arm/cpu/armv7/s5p-common/timer.c | 8 ++++---- arch/arm/cpu/armv7/socfpga/timer.c | 8 ++++---- arch/arm/cpu/armv7/u8500/timer.c | 12 +++++++----- arch/arm/cpu/armv7/zynq/timer.c | 8 ++++---- arch/arm/cpu/pxa/timer.c | 2 +- arch/arm/cpu/tegra-common/timer.c | 6 +++--- arch/arm/imx-common/timer.c | 2 +- arch/arm/include/asm/global_data.h | 2 +- arch/mips/cpu/xburst/timer.c | 12 ++++++------ 29 files changed, 95 insertions(+), 89 deletions(-) diff --git a/arch/arm/cpu/arm1136/mx31/timer.c b/arch/arm/cpu/arm1136/mx31/timer.c index 36266da..7a377cc 100644 --- a/arch/arm/cpu/arm1136/mx31/timer.c +++ b/arch/arm/cpu/arm1136/mx31/timer.c @@ -117,11 +117,11 @@ unsigned long long get_ticks(void) if (now >= gd->lastinc) /* normal mode (non roll) */ /* move stamp forward with absolut diff ticks */ - gd->tbl += (now - gd->lastinc); + gd->arch.tbl += (now - gd->lastinc); else /* we have rollover of incrementer */ - gd->tbl += (0xFFFFFFFF - gd->lastinc) + now; + gd->arch.tbl += (0xFFFFFFFF - gd->lastinc) + now; gd->lastinc = now; - return gd->tbl; + return gd->arch.tbl; } ulong get_timer_masked(void) diff --git a/arch/arm/cpu/arm1136/mx35/timer.c b/arch/arm/cpu/arm1136/mx35/timer.c index 9680b7f..c21ca3f 100644 --- a/arch/arm/cpu/arm1136/mx35/timer.c +++ b/arch/arm/cpu/arm1136/mx35/timer.c @@ -32,7 +32,7 @@ DECLARE_GLOBAL_DATA_PTR; -#define timestamp (gd->tbl) +#define timestamp (gd->arch.tbl) #define lastinc (gd->lastinc) /* General purpose timers bitfields */ diff --git a/arch/arm/cpu/arm1136/omap24xx/timer.c b/arch/arm/cpu/arm1136/omap24xx/timer.c index e929ae4..e179bb5 100644 --- a/arch/arm/cpu/arm1136/omap24xx/timer.c +++ b/arch/arm/cpu/arm1136/omap24xx/timer.c @@ -52,7 +52,7 @@ int timer_init (void) /* reset time */ gd->lastinc = READ_TIMER; /* capture current incrementer value */ - gd->tbl = 0; /* start "advancing" time stamp */ + gd->arch.tbl = 0; /* start "advancing" time stamp */ return(0); } @@ -82,7 +82,7 @@ void __udelay (unsigned long usec) if ((tmo + tmp + 1) < tmp) { /* if setting this forward will roll */ /* time stamp, then reset time */ gd->lastinc = READ_TIMER; /* capture incrementer value */ - gd->tbl = 0; /* start time stamp */ + gd->arch.tbl = 0; /* start time stamp */ } else { tmo += tmp; /* else, set advancing stamp wake up time */ } @@ -94,12 +94,15 @@ ulong get_timer_masked (void) { ulong now = READ_TIMER; /* current tick value */ - if (now >= gd->lastinc) /* normal mode (non roll) */ - gd->tbl += (now - gd->lastinc); /* move stamp fordward with absoulte diff ticks */ - else /* we have rollover of incrementer */ - gd->tbl += (0xFFFFFFFF - gd->lastinc) + now; + if (now >= gd->lastinc) { /* normal mode (non roll) */ + /* move stamp fordward with absoulte diff ticks */ + gd->arch.tbl += (now - gd->lastinc); + } else { + /* we have rollover of incrementer */ + gd->arch.tbl += (0xFFFFFFFF - gd->lastinc) + now; + } gd->lastinc = now; - return gd->tbl; + return gd->arch.tbl; } /* waits specified delay value and resets timestamp */ diff --git a/arch/arm/cpu/arm920t/a320/timer.c b/arch/arm/cpu/arm920t/a320/timer.c index 781533b..512fb9d 100644 --- a/arch/arm/cpu/arm920t/a320/timer.c +++ b/arch/arm/cpu/arm920t/a320/timer.c @@ -75,7 +75,7 @@ int timer_init(void) writel(cr, &tmr->cr); gd->arch.timer_rate_hz = TIMER_CLOCK; - gd->arch.tbu = gd->tbl = 0; + gd->arch.tbu = gd->arch.tbl = 0; return 0; } @@ -89,10 +89,10 @@ unsigned long long get_ticks(void) ulong now = TIMER_LOAD_VAL - readl(&tmr->timer3_counter); /* increment tbu if tbl has rolled over */ - if (now < gd->tbl) + if (now < gd->arch.tbl) gd->arch.tbu++; - gd->tbl = now; - return (((unsigned long long)gd->arch.tbu) << 32) | gd->tbl; + gd->arch.tbl = now; + return (((unsigned long long)gd->arch.tbu) << 32) | gd->arch.tbl; } void __udelay(unsigned long usec) diff --git a/arch/arm/cpu/arm920t/at91/timer.c b/arch/arm/cpu/arm920t/at91/timer.c index 91607b5..439ceab 100644 --- a/arch/arm/cpu/arm920t/at91/timer.c +++ b/arch/arm/cpu/arm920t/at91/timer.c @@ -64,7 +64,7 @@ int timer_init(void) writel(AT91_TC_CCR_SWTRG | AT91_TC_CCR_CLKEN, &tc->tc[0].ccr); gd->lastinc = 0; - gd->tbl = 0; + gd->arch.tbl = 0; return 0; } @@ -91,14 +91,14 @@ ulong get_timer_raw(void) if (now >= gd->lastinc) { /* normal mode */ - gd->tbl += now - gd->lastinc; + gd->arch.tbl += now - gd->lastinc; } else { /* we have an overflow ... */ - gd->tbl += now + TIMER_LOAD_VAL - gd->lastinc; + gd->arch.tbl += now + TIMER_LOAD_VAL - gd->lastinc; } gd->lastinc = now; - return gd->tbl; + return gd->arch.tbl; } ulong get_timer_masked(void) diff --git a/arch/arm/cpu/arm920t/s3c24x0/timer.c b/arch/arm/cpu/arm920t/s3c24x0/timer.c index e59e614..eb2b8d0 100644 --- a/arch/arm/cpu/arm920t/s3c24x0/timer.c +++ b/arch/arm/cpu/arm920t/s3c24x0/timer.c @@ -63,7 +63,7 @@ int timer_init(void) tmr = (tmr & ~0x0700000) | 0x0500000; writel(tmr, &timers->tcon); gd->lastinc = 0; - gd->tbl = 0; + gd->arch.tbl = 0; return 0; } @@ -130,14 +130,14 @@ unsigned long long get_ticks(void) if (gd->lastinc >= now) { /* normal mode */ - gd->tbl += gd->lastinc - now; + gd->arch.tbl += gd->lastinc - now; } else { /* we have an overflow ... */ - gd->tbl += gd->lastinc + gd->arch.tbu - now; + gd->arch.tbl += gd->lastinc + gd->arch.tbu - now; } gd->lastinc = now; - return gd->tbl; + return gd->arch.tbl; } /* diff --git a/arch/arm/cpu/arm926ejs/armada100/timer.c b/arch/arm/cpu/arm926ejs/armada100/timer.c index 18ffd0c..948607f 100644 --- a/arch/arm/cpu/arm926ejs/armada100/timer.c +++ b/arch/arm/cpu/arm926ejs/armada100/timer.c @@ -61,7 +61,7 @@ struct armd1tmr_registers { #define COUNT_RD_REQ 0x1 DECLARE_GLOBAL_DATA_PTR; -/* Using gd->arch.tbu from timestamp and gd->tbl for lastdec */ +/* Using gd->arch.tbu from timestamp and gd->arch.tbl for lastdec */ /* For preventing risk of instability in reading counter value, * first set read request to register cvwr and then read same @@ -82,14 +82,14 @@ ulong get_timer_masked(void) { ulong now = read_timer(); - if (now >= gd->tbl) { + if (now >= gd->arch.tbl) { /* normal mode */ - gd->arch.tbu += now - gd->tbl; + gd->arch.tbu += now - gd->arch.tbl; } else { /* we have an overflow ... */ - gd->arch.tbu += now + TIMER_LOAD_VAL - gd->tbl; + gd->arch.tbu += now + TIMER_LOAD_VAL - gd->arch.tbl; } - gd->tbl = now; + gd->arch.tbl = now; return gd->arch.tbu; } @@ -135,8 +135,8 @@ int timer_init(void) /* Enable timer 0 */ writel(0x1, &armd1timers->cer); - /* init the gd->arch.tbu and gd->tbl value */ - gd->tbl = read_timer(); + /* init the gd->arch.tbu and gd->arch.tbl value */ + gd->arch.tbl = read_timer(); gd->arch.tbu = 0; return 0; diff --git a/arch/arm/cpu/arm926ejs/at91/timer.c b/arch/arm/cpu/arm926ejs/at91/timer.c index f691518..4443fef 100644 --- a/arch/arm/cpu/arm926ejs/at91/timer.c +++ b/arch/arm/cpu/arm926ejs/at91/timer.c @@ -80,7 +80,7 @@ int timer_init(void) writel(TIMER_LOAD_VAL | AT91_PIT_MR_EN , &pit->mr); gd->arch.timer_rate_hz = gd->arch.mck_rate_hz / 16; - gd->arch.tbu = gd->tbl = 0; + gd->arch.tbu = gd->arch.tbl = 0; return 0; } @@ -95,10 +95,10 @@ unsigned long long get_ticks(void) ulong now = readl(&pit->piir); /* increment tbu if tbl has rolled over */ - if (now < gd->tbl) + if (now < gd->arch.tbl) gd->arch.tbu++; - gd->tbl = now; - return (((unsigned long long)gd->arch.tbu) << 32) | gd->tbl; + gd->arch.tbl = now; + return (((unsigned long long)gd->arch.tbu) << 32) | gd->arch.tbl; } void __udelay(unsigned long usec) diff --git a/arch/arm/cpu/arm926ejs/davinci/timer.c b/arch/arm/cpu/arm926ejs/davinci/timer.c index e28e6e3..b620bf7 100644 --- a/arch/arm/cpu/arm926ejs/davinci/timer.c +++ b/arch/arm/cpu/arm926ejs/davinci/timer.c @@ -74,11 +74,11 @@ unsigned long long get_ticks(void) unsigned long now = readl(&timer->tim34); /* increment tbu if tbl has rolled over */ - if (now < gd->tbl) + if (now < gd->arch.tbl) gd->arch.tbu++; - gd->tbl = now; + gd->arch.tbl = now; - return (((unsigned long long)gd->arch.tbu) << 32) | gd->tbl; + return (((unsigned long long)gd->arch.tbu) << 32) | gd->arch.tbl; } ulong get_timer(ulong base) diff --git a/arch/arm/cpu/arm926ejs/kirkwood/timer.c b/arch/arm/cpu/arm926ejs/kirkwood/timer.c index f5d0160..41dc074 100644 --- a/arch/arm/cpu/arm926ejs/kirkwood/timer.c +++ b/arch/arm/cpu/arm926ejs/kirkwood/timer.c @@ -86,7 +86,7 @@ struct kwtmr_registers *kwtmr_regs = (struct kwtmr_registers *)KW_TIMER_BASE; DECLARE_GLOBAL_DATA_PTR; -#define timestamp gd->tbl +#define timestamp gd->arch.tbl #define lastdec gd->lastinc ulong get_timer_masked(void) diff --git a/arch/arm/cpu/arm926ejs/mb86r0x/timer.c b/arch/arm/cpu/arm926ejs/mb86r0x/timer.c index 75314b9..1f1900e 100644 --- a/arch/arm/cpu/arm926ejs/mb86r0x/timer.c +++ b/arch/arm/cpu/arm926ejs/mb86r0x/timer.c @@ -35,7 +35,7 @@ DECLARE_GLOBAL_DATA_PTR; -#define timestamp gd->tbl +#define timestamp gd->arch.tbl #define lastdec gd->lastinc static inline unsigned long long tick_to_time(unsigned long long tick) diff --git a/arch/arm/cpu/arm926ejs/mx25/timer.c b/arch/arm/cpu/arm926ejs/mx25/timer.c index 4dc4041..8b5217f 100644 --- a/arch/arm/cpu/arm926ejs/mx25/timer.c +++ b/arch/arm/cpu/arm926ejs/mx25/timer.c @@ -44,7 +44,7 @@ DECLARE_GLOBAL_DATA_PTR; -#define timestamp (gd->tbl) +#define timestamp (gd->arch.tbl) #define lastinc (gd->lastinc) /* diff --git a/arch/arm/cpu/arm926ejs/mx27/timer.c b/arch/arm/cpu/arm926ejs/mx27/timer.c index a5dd684..06e3086 100644 --- a/arch/arm/cpu/arm926ejs/mx27/timer.c +++ b/arch/arm/cpu/arm926ejs/mx27/timer.c @@ -45,7 +45,7 @@ DECLARE_GLOBAL_DATA_PTR; -#define timestamp (gd->tbl) +#define timestamp (gd->arch.tbl) #define lastinc (gd->lastinc) /* diff --git a/arch/arm/cpu/arm926ejs/mxs/timer.c b/arch/arm/cpu/arm926ejs/mxs/timer.c index 4ed75e6..a12a7e3 100644 --- a/arch/arm/cpu/arm926ejs/mxs/timer.c +++ b/arch/arm/cpu/arm926ejs/mxs/timer.c @@ -36,7 +36,7 @@ DECLARE_GLOBAL_DATA_PTR; -#define timestamp (gd->tbl) +#define timestamp (gd->arch.tbl) #define lastdec (gd->lastinc) /* diff --git a/arch/arm/cpu/arm926ejs/omap/timer.c b/arch/arm/cpu/arm926ejs/omap/timer.c index 390c9c8..71b8700 100644 --- a/arch/arm/cpu/arm926ejs/omap/timer.c +++ b/arch/arm/cpu/arm926ejs/omap/timer.c @@ -44,7 +44,7 @@ DECLARE_GLOBAL_DATA_PTR; -#define timestamp gd->tbl +#define timestamp gd->arch.tbl #define lastdec gd->lastinc int timer_init (void) diff --git a/arch/arm/cpu/arm926ejs/orion5x/timer.c b/arch/arm/cpu/arm926ejs/orion5x/timer.c index 8a8aaf1..f69af71 100644 --- a/arch/arm/cpu/arm926ejs/orion5x/timer.c +++ b/arch/arm/cpu/arm926ejs/orion5x/timer.c @@ -92,7 +92,7 @@ static inline ulong read_timer(void) DECLARE_GLOBAL_DATA_PTR; -#define timestamp gd->tbl +#define timestamp gd->arch.tbl #define lastdec gd->lastinc ulong get_timer_masked(void) diff --git a/arch/arm/cpu/arm926ejs/pantheon/timer.c b/arch/arm/cpu/arm926ejs/pantheon/timer.c index 701d439..2d9ddba 100644 --- a/arch/arm/cpu/arm926ejs/pantheon/timer.c +++ b/arch/arm/cpu/arm926ejs/pantheon/timer.c @@ -60,7 +60,7 @@ struct panthtmr_registers { #define COUNT_RD_REQ 0x1 DECLARE_GLOBAL_DATA_PTR; -/* Using gd->arch.tbu from timestamp and gd->tbl for lastdec */ +/* Using gd->arch.tbu from timestamp and gd->arch.tbl for lastdec */ /* * For preventing risk of instability in reading counter value, @@ -90,14 +90,14 @@ ulong get_timer_masked(void) { ulong now = read_timer(); - if (now >= gd->tbl) { + if (now >= gd->arch.tbl) { /* normal mode */ - gd->arch.tbu += now - gd->tbl; + gd->arch.tbu += now - gd->arch.tbl; } else { /* we have an overflow ... */ - gd->arch.tbu += now + TIMER_LOAD_VAL - gd->tbl; + gd->arch.tbu += now + TIMER_LOAD_VAL - gd->arch.tbl; } - gd->tbl = now; + gd->arch.tbl = now; return gd->arch.tbu; } @@ -144,8 +144,8 @@ int timer_init(void) /* Enable timer 0 */ writel(0x1, &panthtimers->cer); - /* init the gd->arch.tbu and gd->tbl value */ - gd->tbl = read_timer(); + /* init the gd->arch.tbu and gd->arch.tbl value */ + gd->arch.tbl = read_timer(); gd->arch.tbu = 0; return 0; diff --git a/arch/arm/cpu/arm926ejs/spear/timer.c b/arch/arm/cpu/arm926ejs/spear/timer.c index 1dc7860..06ea65b 100644 --- a/arch/arm/cpu/arm926ejs/spear/timer.c +++ b/arch/arm/cpu/arm926ejs/spear/timer.c @@ -38,7 +38,7 @@ static struct misc_regs *const misc_regs_p = DECLARE_GLOBAL_DATA_PTR; -#define timestamp gd->tbl +#define timestamp gd->arch.tbl #define lastdec gd->lastinc int timer_init(void) diff --git a/arch/arm/cpu/arm926ejs/versatile/timer.c b/arch/arm/cpu/arm926ejs/versatile/timer.c index f58e151..be73b93 100644 --- a/arch/arm/cpu/arm926ejs/versatile/timer.c +++ b/arch/arm/cpu/arm926ejs/versatile/timer.c @@ -44,7 +44,7 @@ DECLARE_GLOBAL_DATA_PTR; -#define timestamp gd->tbl +#define timestamp gd->arch.tbl #define lastdec gd->lastinc #define TIMER_ENABLE (1 << 7) diff --git a/arch/arm/cpu/armv7/omap-common/timer.c b/arch/arm/cpu/armv7/omap-common/timer.c index 9f8bc93..e321d53 100644 --- a/arch/arm/cpu/armv7/omap-common/timer.c +++ b/arch/arm/cpu/armv7/omap-common/timer.c @@ -57,7 +57,7 @@ int timer_init(void) /* reset time, capture current incrementer value time */ gd->lastinc = readl(&timer_base->tcrr) / (TIMER_CLOCK / CONFIG_SYS_HZ); - gd->tbl = 0; /* start "advancing" time stamp from 0 */ + gd->arch.tbl = 0; /* start "advancing" time stamp from 0 */ return 0; } @@ -91,14 +91,15 @@ ulong get_timer_masked(void) /* current tick value */ ulong now = readl(&timer_base->tcrr) / (TIMER_CLOCK / CONFIG_SYS_HZ); - if (now >= gd->lastinc) /* normal mode (non roll) */ + if (now >= gd->lastinc) { /* normal mode (non roll) */ /* move stamp fordward with absoulte diff ticks */ - gd->tbl += (now - gd->lastinc); - else /* we have rollover of incrementer */ - gd->tbl += ((TIMER_LOAD_VAL / (TIMER_CLOCK / CONFIG_SYS_HZ)) - - gd->lastinc) + now; + gd->arch.tbl += (now - gd->lastinc); + } else { /* we have rollover of incrementer */ + gd->arch.tbl += ((TIMER_LOAD_VAL / (TIMER_CLOCK / + CONFIG_SYS_HZ)) - gd->lastinc) + now; + } gd->lastinc = now; - return gd->tbl; + return gd->arch.tbl; } /* diff --git a/arch/arm/cpu/armv7/s5p-common/timer.c b/arch/arm/cpu/armv7/s5p-common/timer.c index bb0e795..1566226 100644 --- a/arch/arm/cpu/armv7/s5p-common/timer.c +++ b/arch/arm/cpu/armv7/s5p-common/timer.c @@ -106,7 +106,7 @@ void reset_timer_masked(void) /* reset time */ gd->lastinc = readl(&timer->tcnto4); - gd->tbl = 0; + gd->arch.tbl = 0; } unsigned long get_timer_masked(void) @@ -124,13 +124,13 @@ unsigned long get_current_tick(void) unsigned long count_value = readl(&timer->tcntb4); if (gd->lastinc >= now) - gd->tbl += gd->lastinc - now; + gd->arch.tbl += gd->lastinc - now; else - gd->tbl += gd->lastinc + count_value - now; + gd->arch.tbl += gd->lastinc + count_value - now; gd->lastinc = now; - return gd->tbl; + return gd->arch.tbl; } /* diff --git a/arch/arm/cpu/armv7/socfpga/timer.c b/arch/arm/cpu/armv7/socfpga/timer.c index 321e9b4..a742121 100644 --- a/arch/arm/cpu/armv7/socfpga/timer.c +++ b/arch/arm/cpu/armv7/socfpga/timer.c @@ -83,13 +83,13 @@ ulong get_timer_masked(void) if (gd->lastinc >= now) { /* normal mode (non roll) */ /* move stamp forward with absolute diff ticks */ - gd->tbl += gd->lastinc - now; + gd->arch.tbl += gd->lastinc - now; } else { /* we have overflow of the count down timer */ - gd->tbl += TIMER_LOAD_VAL - gd->lastinc + now; + gd->arch.tbl += TIMER_LOAD_VAL - gd->lastinc + now; } gd->lastinc = now; - return gd->tbl; + return gd->arch.tbl; } /* @@ -100,5 +100,5 @@ void reset_timer(void) /* capture current decrementer value time */ gd->lastinc = read_timer() / (CONFIG_TIMER_CLOCK_KHZ/CONFIG_SYS_HZ); /* start "advancing" time stamp from 0 */ - gd->tbl = 0; + gd->arch.tbl = 0; } diff --git a/arch/arm/cpu/armv7/u8500/timer.c b/arch/arm/cpu/armv7/u8500/timer.c index bb9165b..a20897b 100644 --- a/arch/arm/cpu/armv7/u8500/timer.c +++ b/arch/arm/cpu/armv7/u8500/timer.c @@ -100,12 +100,14 @@ ulong get_timer_masked(void) /* current tick value */ ulong now = TICKS_TO_HZ(READ_TIMER()); - if (now >= gd->lastinc) /* normal (non rollover) */ - gd->tbl += (now - gd->lastinc); - else /* rollover */ - gd->tbl += (TICKS_TO_HZ(TIMER_LOAD_VAL) - gd->lastinc) + now; + if (now >= gd->lastinc) { /* normal (non rollover) */ + gd->arch.tbl += (now - gd->lastinc); + } else { /* rollover */ + gd->arch.tbl += (TICKS_TO_HZ(TIMER_LOAD_VAL) - gd->lastinc) + + now; + } gd->lastinc = now; - return gd->tbl; + return gd->arch.tbl; } /* Delay x useconds */ diff --git a/arch/arm/cpu/armv7/zynq/timer.c b/arch/arm/cpu/armv7/zynq/timer.c index 323e7b5..e126ebb 100644 --- a/arch/arm/cpu/armv7/zynq/timer.c +++ b/arch/arm/cpu/armv7/zynq/timer.c @@ -85,7 +85,7 @@ int timer_init(void) /* Reset time */ gd->lastinc = readl(&timer_base->counter) / (TIMER_TICK_HZ / CONFIG_SYS_HZ); - gd->tbl = 0; + gd->arch.tbl = 0; return 0; } @@ -102,14 +102,14 @@ ulong get_timer_masked(void) if (gd->lastinc >= now) { /* Normal mode */ - gd->tbl += gd->lastinc - now; + gd->arch.tbl += gd->lastinc - now; } else { /* We have an overflow ... */ - gd->tbl += gd->lastinc + TIMER_LOAD_VAL - now; + gd->arch.tbl += gd->lastinc + TIMER_LOAD_VAL - now; } gd->lastinc = now; - return gd->tbl; + return gd->arch.tbl; } void __udelay(unsigned long usec) diff --git a/arch/arm/cpu/pxa/timer.c b/arch/arm/cpu/pxa/timer.c index a8f7462..7799c14 100644 --- a/arch/arm/cpu/pxa/timer.c +++ b/arch/arm/cpu/pxa/timer.c @@ -31,7 +31,7 @@ DECLARE_GLOBAL_DATA_PTR; #define TIMER_LOAD_VAL 0xffffffff -#define timestamp (gd->tbl) +#define timestamp (gd->arch.tbl) #define lastinc (gd->lastinc) #if defined(CONFIG_CPU_PXA27X) || defined(CONFIG_CPU_MONAHANS) diff --git a/arch/arm/cpu/tegra-common/timer.c b/arch/arm/cpu/tegra-common/timer.c index 034ea5a..dc9cc6c 100644 --- a/arch/arm/cpu/tegra-common/timer.c +++ b/arch/arm/cpu/tegra-common/timer.c @@ -77,12 +77,12 @@ ulong get_timer_masked(void) if (now >= gd->lastinc) /* normal mode (non roll) */ /* move stamp forward with absolute diff ticks */ - gd->tbl += (now - gd->lastinc); + gd->arch.tbl += (now - gd->lastinc); else /* we have rollover of incrementer */ - gd->tbl += ((TIMER_LOAD_VAL / (TIMER_CLK / CONFIG_SYS_HZ)) + gd->arch.tbl += ((TIMER_LOAD_VAL / (TIMER_CLK / CONFIG_SYS_HZ)) - gd->lastinc) + now; gd->lastinc = now; - return gd->tbl; + return gd->arch.tbl; } /* diff --git a/arch/arm/imx-common/timer.c b/arch/arm/imx-common/timer.c index b021903..de21e44 100644 --- a/arch/arm/imx-common/timer.c +++ b/arch/arm/imx-common/timer.c @@ -48,7 +48,7 @@ static struct mxc_gpt *cur_gpt = (struct mxc_gpt *)GPT1_BASE_ADDR; DECLARE_GLOBAL_DATA_PTR; -#define timestamp (gd->tbl) +#define timestamp (gd->arch.tbl) #define lastinc (gd->lastinc) static inline unsigned long long tick_to_time(unsigned long long tick) diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h index 5d37061..41bef04 100644 --- a/arch/arm/include/asm/global_data.h +++ b/arch/arm/include/asm/global_data.h @@ -38,6 +38,7 @@ struct arch_global_data { /* "static data" needed by most of timer.c on ARM platforms */ unsigned long timer_rate_hz; unsigned long tbu; + unsigned long tbl; }; /* @@ -64,7 +65,6 @@ typedef struct global_data { #endif #ifdef CONFIG_ARM /* "static data" needed by most of timer.c on ARM platforms */ - unsigned long tbl; unsigned long long timer_reset_value; unsigned long lastinc; #endif diff --git a/arch/mips/cpu/xburst/timer.c b/arch/mips/cpu/xburst/timer.c index b6b3855..8ac8bf7 100644 --- a/arch/mips/cpu/xburst/timer.c +++ b/arch/mips/cpu/xburst/timer.c @@ -35,7 +35,7 @@ void reset_timer_masked(void) { /* reset time */ gd->lastinc = readl(&tcu->tcnt0); - gd->tbl = 0; + gd->arch.tbl = 0; } ulong get_timer_masked(void) @@ -43,15 +43,15 @@ ulong get_timer_masked(void) ulong now = readl(&tcu->tcnt0); if (gd->lastinc <= now) - gd->tbl += now - gd->lastinc; /* normal mode */ + gd->arch.tbl += now - gd->lastinc; /* normal mode */ else { /* we have an overflow ... */ - gd->tbl += TIMER_FDATA + now - gd->lastinc; + gd->arch.tbl += TIMER_FDATA + now - gd->lastinc; } gd->lastinc = now; - return gd->tbl; + return gd->arch.tbl; } void udelay_masked(unsigned long usec) @@ -95,7 +95,7 @@ int timer_init(void) writeb(1 << TIMER_CHAN, &tcu->tesr); /* start counting up */ gd->lastinc = 0; - gd->tbl = 0; + gd->arch.tbl = 0; return 0; } @@ -112,7 +112,7 @@ ulong get_timer(ulong base) void set_timer(ulong t) { - gd->tbl = t; + gd->arch.tbl = t; } void __udelay(unsigned long usec)