All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 06/57] arm: Move lastinc to arch_global_data
Date: Fri, 16 Nov 2012 13:19:51 -0800	[thread overview]
Message-ID: <1353100842-20126-7-git-send-email-sjg@chromium.org> (raw)
In-Reply-To: <1353100842-20126-1-git-send-email-sjg@chromium.org>

Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/arm/cpu/arm1136/mx31/timer.c        |    8 ++++----
 arch/arm/cpu/arm1136/mx35/timer.c        |    2 +-
 arch/arm/cpu/arm1136/omap24xx/timer.c    |   12 ++++++------
 arch/arm/cpu/arm920t/at91/timer.c        |   10 +++++-----
 arch/arm/cpu/arm920t/s3c24x0/timer.c     |   10 +++++-----
 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/spear/timer.c     |    2 +-
 arch/arm/cpu/arm926ejs/versatile/timer.c |    2 +-
 arch/arm/cpu/armv7/omap-common/timer.c   |   11 ++++++-----
 arch/arm/cpu/armv7/s5p-common/timer.c    |   10 +++++-----
 arch/arm/cpu/armv7/socfpga/timer.c       |   11 ++++++-----
 arch/arm/cpu/armv7/u8500/timer.c         |   10 +++++-----
 arch/arm/cpu/armv7/zynq/timer.c          |   10 +++++-----
 arch/arm/cpu/ixp/timer.c                 |    8 ++++----
 arch/arm/cpu/pxa/timer.c                 |    2 +-
 arch/arm/cpu/tegra-common/timer.c        |    8 ++++----
 arch/arm/imx-common/timer.c              |    2 +-
 arch/arm/include/asm/global_data.h       |    2 +-
 arch/mips/cpu/xburst/timer.c             |   12 ++++++------
 25 files changed, 74 insertions(+), 72 deletions(-)

diff --git a/arch/arm/cpu/arm1136/mx31/timer.c b/arch/arm/cpu/arm1136/mx31/timer.c
index 7a377cc..1a7f71e 100644
--- a/arch/arm/cpu/arm1136/mx31/timer.c
+++ b/arch/arm/cpu/arm1136/mx31/timer.c
@@ -115,12 +115,12 @@ unsigned long long get_ticks(void)
 {
 	ulong now = GPTCNT; /* current tick value */
 
-	if (now >= gd->lastinc)	/* normal mode (non roll) */
+	if (now >= gd->arch.lastinc)	/* normal mode (non roll) */
 		/* move stamp forward with absolut diff ticks */
-		gd->arch.tbl += (now - gd->lastinc);
+		gd->arch.tbl += (now - gd->arch.lastinc);
 	else			/* we have rollover of incrementer */
-		gd->arch.tbl += (0xFFFFFFFF - gd->lastinc) + now;
-	gd->lastinc = now;
+		gd->arch.tbl += (0xFFFFFFFF - gd->arch.lastinc) + now;
+	gd->arch.lastinc = now;
 	return gd->arch.tbl;
 }
 
diff --git a/arch/arm/cpu/arm1136/mx35/timer.c b/arch/arm/cpu/arm1136/mx35/timer.c
index c21ca3f..584ad15 100644
--- a/arch/arm/cpu/arm1136/mx35/timer.c
+++ b/arch/arm/cpu/arm1136/mx35/timer.c
@@ -33,7 +33,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp	(gd->arch.tbl)
-#define lastinc		(gd->lastinc)
+#define lastinc		(gd->arch.lastinc)
 
 /* General purpose timers bitfields */
 #define GPTCR_SWR       (1<<15)	/* Software reset */
diff --git a/arch/arm/cpu/arm1136/omap24xx/timer.c b/arch/arm/cpu/arm1136/omap24xx/timer.c
index e179bb5..53015cb 100644
--- a/arch/arm/cpu/arm1136/omap24xx/timer.c
+++ b/arch/arm/cpu/arm1136/omap24xx/timer.c
@@ -51,7 +51,7 @@ int timer_init (void)
 	*((int32_t *) (CONFIG_SYS_TIMERBASE + TCLR)) = val;	/* start timer */
 
 	/* reset time */
-	gd->lastinc = READ_TIMER;	/* capture current incrementer value */
+	gd->arch.lastinc = READ_TIMER;	/* capture current incrementer value */
 	gd->arch.tbl = 0;		/* start "advancing" time stamp */
 
 	return(0);
@@ -81,7 +81,7 @@ void __udelay (unsigned long usec)
 	tmp = get_timer (0);		/* get current timestamp */
 	if ((tmo + tmp + 1) < tmp) {	/* if setting this forward will roll */
 					/* time stamp, then reset time */
-		gd->lastinc = READ_TIMER;	/* capture incrementer value */
+		gd->arch.lastinc = READ_TIMER;	/* capture incrementer value */
 		gd->arch.tbl = 0;			/* start time stamp */
 	} else {
 		tmo	+= tmp;		/* else, set advancing stamp wake up time */
@@ -94,14 +94,14 @@ ulong get_timer_masked (void)
 {
 	ulong now = READ_TIMER;		/* current tick value */
 
-	if (now >= gd->lastinc) {		/* normal mode (non roll) */
+	if (now >= gd->arch.lastinc) {		/* normal mode (non roll) */
 		/* move stamp fordward with absoulte diff ticks */
-		gd->arch.tbl += (now - gd->lastinc);
+		gd->arch.tbl += (now - gd->arch.lastinc);
 	} else {
 		/* we have rollover of incrementer */
-		gd->arch.tbl += (0xFFFFFFFF - gd->lastinc) + now;
+		gd->arch.tbl += (0xFFFFFFFF - gd->arch.lastinc) + now;
 	}
-	gd->lastinc = now;
+	gd->arch.lastinc = now;
 	return gd->arch.tbl;
 }
 
diff --git a/arch/arm/cpu/arm920t/at91/timer.c b/arch/arm/cpu/arm920t/at91/timer.c
index 439ceab..8ce7584 100644
--- a/arch/arm/cpu/arm920t/at91/timer.c
+++ b/arch/arm/cpu/arm920t/at91/timer.c
@@ -63,7 +63,7 @@ int timer_init(void)
 	writel(TIMER_LOAD_VAL, &tc->tc[0].rc);
 
 	writel(AT91_TC_CCR_SWTRG | AT91_TC_CCR_CLKEN, &tc->tc[0].ccr);
-	gd->lastinc = 0;
+	gd->arch.lastinc = 0;
 	gd->arch.tbl = 0;
 
 	return 0;
@@ -89,14 +89,14 @@ ulong get_timer_raw(void)
 
 	now = readl(&tc->tc[0].cv) & 0x0000ffff;
 
-	if (now >= gd->lastinc) {
+	if (now >= gd->arch.lastinc) {
 		/* normal mode */
-		gd->arch.tbl += now - gd->lastinc;
+		gd->arch.tbl += now - gd->arch.lastinc;
 	} else {
 		/* we have an overflow ... */
-		gd->arch.tbl += now + TIMER_LOAD_VAL - gd->lastinc;
+		gd->arch.tbl += now + TIMER_LOAD_VAL - gd->arch.lastinc;
 	}
-	gd->lastinc = now;
+	gd->arch.lastinc = now;
 
 	return gd->arch.tbl;
 }
diff --git a/arch/arm/cpu/arm920t/s3c24x0/timer.c b/arch/arm/cpu/arm920t/s3c24x0/timer.c
index eb2b8d0..d76bf18 100644
--- a/arch/arm/cpu/arm920t/s3c24x0/timer.c
+++ b/arch/arm/cpu/arm920t/s3c24x0/timer.c
@@ -62,7 +62,7 @@ int timer_init(void)
 	/* auto load, start timer 4 */
 	tmr = (tmr & ~0x0700000) | 0x0500000;
 	writel(tmr, &timers->tcon);
-	gd->lastinc = 0;
+	gd->arch.lastinc = 0;
 	gd->arch.tbl = 0;
 
 	return 0;
@@ -128,14 +128,14 @@ unsigned long long get_ticks(void)
 	struct s3c24x0_timers *timers = s3c24x0_get_base_timers();
 	ulong now = readl(&timers->tcnto4) & 0xffff;
 
-	if (gd->lastinc >= now) {
+	if (gd->arch.lastinc >= now) {
 		/* normal mode */
-		gd->arch.tbl += gd->lastinc - now;
+		gd->arch.tbl += gd->arch.lastinc - now;
 	} else {
 		/* we have an overflow ... */
-		gd->arch.tbl += gd->lastinc + gd->arch.tbu - now;
+		gd->arch.tbl += gd->arch.lastinc + gd->arch.tbu - now;
 	}
-	gd->lastinc = now;
+	gd->arch.lastinc = now;
 
 	return gd->arch.tbl;
 }
diff --git a/arch/arm/cpu/arm926ejs/kirkwood/timer.c b/arch/arm/cpu/arm926ejs/kirkwood/timer.c
index 41dc074..85e81e3 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/timer.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/timer.c
@@ -87,7 +87,7 @@ struct kwtmr_registers *kwtmr_regs = (struct kwtmr_registers *)KW_TIMER_BASE;
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp gd->arch.tbl
-#define lastdec gd->lastinc
+#define lastdec gd->arch.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 1f1900e..c6486c1 100644
--- a/arch/arm/cpu/arm926ejs/mb86r0x/timer.c
+++ b/arch/arm/cpu/arm926ejs/mb86r0x/timer.c
@@ -36,7 +36,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp gd->arch.tbl
-#define lastdec gd->lastinc
+#define lastdec gd->arch.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 8b5217f..f8bebcc 100644
--- a/arch/arm/cpu/arm926ejs/mx25/timer.c
+++ b/arch/arm/cpu/arm926ejs/mx25/timer.c
@@ -45,7 +45,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp	(gd->arch.tbl)
-#define lastinc		(gd->lastinc)
+#define lastinc		(gd->arch.lastinc)
 
 /*
  * "time" is measured in 1 / CONFIG_SYS_HZ seconds,
diff --git a/arch/arm/cpu/arm926ejs/mx27/timer.c b/arch/arm/cpu/arm926ejs/mx27/timer.c
index 06e3086..07e132a 100644
--- a/arch/arm/cpu/arm926ejs/mx27/timer.c
+++ b/arch/arm/cpu/arm926ejs/mx27/timer.c
@@ -46,7 +46,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp	(gd->arch.tbl)
-#define lastinc		(gd->lastinc)
+#define lastinc		(gd->arch.lastinc)
 
 /*
  * "time" is measured in 1 / CONFIG_SYS_HZ seconds,
diff --git a/arch/arm/cpu/arm926ejs/mxs/timer.c b/arch/arm/cpu/arm926ejs/mxs/timer.c
index a12a7e3..3738411 100644
--- a/arch/arm/cpu/arm926ejs/mxs/timer.c
+++ b/arch/arm/cpu/arm926ejs/mxs/timer.c
@@ -37,7 +37,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp (gd->arch.tbl)
-#define lastdec (gd->lastinc)
+#define lastdec (gd->arch.lastinc)
 
 /*
  * This driver uses 1kHz clock source.
diff --git a/arch/arm/cpu/arm926ejs/omap/timer.c b/arch/arm/cpu/arm926ejs/omap/timer.c
index 71b8700..34ec7b2 100644
--- a/arch/arm/cpu/arm926ejs/omap/timer.c
+++ b/arch/arm/cpu/arm926ejs/omap/timer.c
@@ -45,7 +45,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp gd->arch.tbl
-#define lastdec gd->lastinc
+#define lastdec gd->arch.lastinc
 
 int timer_init (void)
 {
diff --git a/arch/arm/cpu/arm926ejs/orion5x/timer.c b/arch/arm/cpu/arm926ejs/orion5x/timer.c
index f69af71..f723351 100644
--- a/arch/arm/cpu/arm926ejs/orion5x/timer.c
+++ b/arch/arm/cpu/arm926ejs/orion5x/timer.c
@@ -93,7 +93,7 @@ static inline ulong read_timer(void)
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp gd->arch.tbl
-#define lastdec gd->lastinc
+#define lastdec gd->arch.lastinc
 
 ulong get_timer_masked(void)
 {
diff --git a/arch/arm/cpu/arm926ejs/spear/timer.c b/arch/arm/cpu/arm926ejs/spear/timer.c
index 06ea65b..de4ba7b 100644
--- a/arch/arm/cpu/arm926ejs/spear/timer.c
+++ b/arch/arm/cpu/arm926ejs/spear/timer.c
@@ -39,7 +39,7 @@ static struct misc_regs *const misc_regs_p =
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp gd->arch.tbl
-#define lastdec gd->lastinc
+#define lastdec gd->arch.lastinc
 
 int timer_init(void)
 {
diff --git a/arch/arm/cpu/arm926ejs/versatile/timer.c b/arch/arm/cpu/arm926ejs/versatile/timer.c
index be73b93..b36d6d9 100644
--- a/arch/arm/cpu/arm926ejs/versatile/timer.c
+++ b/arch/arm/cpu/arm926ejs/versatile/timer.c
@@ -45,7 +45,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp gd->arch.tbl
-#define lastdec gd->lastinc
+#define lastdec gd->arch.lastinc
 
 #define TIMER_ENABLE	(1 << 7)
 #define TIMER_MODE_MSK	(1 << 6)
diff --git a/arch/arm/cpu/armv7/omap-common/timer.c b/arch/arm/cpu/armv7/omap-common/timer.c
index e321d53..36bea5f 100644
--- a/arch/arm/cpu/armv7/omap-common/timer.c
+++ b/arch/arm/cpu/armv7/omap-common/timer.c
@@ -56,7 +56,8 @@ int timer_init(void)
 		&timer_base->tclr);
 
 	/* reset time, capture current incrementer value time */
-	gd->lastinc = readl(&timer_base->tcrr) / (TIMER_CLOCK / CONFIG_SYS_HZ);
+	gd->arch.lastinc = readl(&timer_base->tcrr) /
+					(TIMER_CLOCK / CONFIG_SYS_HZ);
 	gd->arch.tbl = 0;	/* start "advancing" time stamp from 0 */
 
 	return 0;
@@ -91,14 +92,14 @@ 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->arch.lastinc) {	/* normal mode (non roll) */
 		/* move stamp fordward with absoulte diff ticks */
-		gd->arch.tbl += (now - gd->lastinc);
+		gd->arch.tbl += (now - gd->arch.lastinc);
 	} else {	/* we have rollover of incrementer */
 		gd->arch.tbl += ((TIMER_LOAD_VAL / (TIMER_CLOCK /
-				CONFIG_SYS_HZ)) - gd->lastinc) + now;
+				CONFIG_SYS_HZ)) - gd->arch.lastinc) + now;
 	}
-	gd->lastinc = now;
+	gd->arch.lastinc = now;
 	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 1566226..e78c716 100644
--- a/arch/arm/cpu/armv7/s5p-common/timer.c
+++ b/arch/arm/cpu/armv7/s5p-common/timer.c
@@ -105,7 +105,7 @@ void reset_timer_masked(void)
 	struct s5p_timer *const timer = s5p_get_base_timer();
 
 	/* reset time */
-	gd->lastinc = readl(&timer->tcnto4);
+	gd->arch.lastinc = readl(&timer->tcnto4);
 	gd->arch.tbl = 0;
 }
 
@@ -123,12 +123,12 @@ unsigned long get_current_tick(void)
 	unsigned long now = readl(&timer->tcnto4);
 	unsigned long count_value = readl(&timer->tcntb4);
 
-	if (gd->lastinc >= now)
-		gd->arch.tbl += gd->lastinc - now;
+	if (gd->arch.lastinc >= now)
+		gd->arch.tbl += gd->arch.lastinc - now;
 	else
-		gd->arch.tbl += gd->lastinc + count_value - now;
+		gd->arch.tbl += gd->arch.lastinc + count_value - now;
 
-	gd->lastinc = now;
+	gd->arch.lastinc = now;
 
 	return gd->arch.tbl;
 }
diff --git a/arch/arm/cpu/armv7/socfpga/timer.c b/arch/arm/cpu/armv7/socfpga/timer.c
index a742121..efa28c2 100644
--- a/arch/arm/cpu/armv7/socfpga/timer.c
+++ b/arch/arm/cpu/armv7/socfpga/timer.c
@@ -80,15 +80,15 @@ ulong get_timer_masked(void)
 {
 	/* current tick value */
 	ulong now = read_timer() / (CONFIG_TIMER_CLOCK_KHZ/CONFIG_SYS_HZ);
-	if (gd->lastinc >= now) {
+	if (gd->arch.lastinc >= now) {
 		/* normal mode (non roll) */
 		/* move stamp forward with absolute diff ticks */
-		gd->arch.tbl += gd->lastinc - now;
+		gd->arch.tbl += gd->arch.lastinc - now;
 	} else {
 		/* we have overflow of the count down timer */
-		gd->arch.tbl += TIMER_LOAD_VAL - gd->lastinc + now;
+		gd->arch.tbl += TIMER_LOAD_VAL - gd->arch.lastinc + now;
 	}
-	gd->lastinc = now;
+	gd->arch.lastinc = now;
 	return gd->arch.tbl;
 }
 
@@ -98,7 +98,8 @@ ulong get_timer_masked(void)
 void reset_timer(void)
 {
 	/* capture current decrementer value time */
-	gd->lastinc = read_timer() / (CONFIG_TIMER_CLOCK_KHZ/CONFIG_SYS_HZ);
+	gd->arch.lastinc = read_timer() /
+				(CONFIG_TIMER_CLOCK_KHZ / CONFIG_SYS_HZ);
 	/* start "advancing" time stamp from 0 */
 	gd->arch.tbl = 0;
 }
diff --git a/arch/arm/cpu/armv7/u8500/timer.c b/arch/arm/cpu/armv7/u8500/timer.c
index a20897b..a4b88f3 100644
--- a/arch/arm/cpu/armv7/u8500/timer.c
+++ b/arch/arm/cpu/armv7/u8500/timer.c
@@ -100,13 +100,13 @@ ulong get_timer_masked(void)
 	/* current tick value */
 	ulong now = TICKS_TO_HZ(READ_TIMER());
 
-	if (now >= gd->lastinc) {	/* normal (non rollover) */
-		gd->arch.tbl += (now - gd->lastinc);
+	if (now >= gd->arch.lastinc) {	/* normal (non rollover) */
+		gd->arch.tbl += (now - gd->arch.lastinc);
 	} else {			/* rollover */
-		gd->arch.tbl += (TICKS_TO_HZ(TIMER_LOAD_VAL) - gd->lastinc)
-				+ now;
+		gd->arch.tbl += (TICKS_TO_HZ(TIMER_LOAD_VAL) -
+					gd->arch.lastinc) + now;
 	}
-	gd->lastinc = now;
+	gd->arch.lastinc = now;
 	return gd->arch.tbl;
 }
 
diff --git a/arch/arm/cpu/armv7/zynq/timer.c b/arch/arm/cpu/armv7/zynq/timer.c
index e126ebb..45b405a 100644
--- a/arch/arm/cpu/armv7/zynq/timer.c
+++ b/arch/arm/cpu/armv7/zynq/timer.c
@@ -83,7 +83,7 @@ int timer_init(void)
 								emask);
 
 	/* Reset time */
-	gd->lastinc = readl(&timer_base->counter) /
+	gd->arch.lastinc = readl(&timer_base->counter) /
 					(TIMER_TICK_HZ / CONFIG_SYS_HZ);
 	gd->arch.tbl = 0;
 
@@ -100,14 +100,14 @@ ulong get_timer_masked(void)
 
 	now = readl(&timer_base->counter) / (TIMER_TICK_HZ / CONFIG_SYS_HZ);
 
-	if (gd->lastinc >= now) {
+	if (gd->arch.lastinc >= now) {
 		/* Normal mode */
-		gd->arch.tbl += gd->lastinc - now;
+		gd->arch.tbl += gd->arch.lastinc - now;
 	} else {
 		/* We have an overflow ... */
-		gd->arch.tbl += gd->lastinc + TIMER_LOAD_VAL - now;
+		gd->arch.tbl += gd->arch.lastinc + TIMER_LOAD_VAL - now;
 	}
-	gd->lastinc = now;
+	gd->arch.lastinc = now;
 
 	return gd->arch.tbl;
 }
diff --git a/arch/arm/cpu/ixp/timer.c b/arch/arm/cpu/ixp/timer.c
index 087ddf8..0450b51 100644
--- a/arch/arm/cpu/ixp/timer.c
+++ b/arch/arm/cpu/ixp/timer.c
@@ -70,13 +70,13 @@ unsigned long long get_ticks(void)
 
 	if (readl(IXP425_OSST) & IXP425_OSST_TIMER_TS_PEND) {
 		/* rollover of timestamp timer register */
-		gd->timestamp += (0xFFFFFFFF - gd->lastinc) + now + 1;
+		gd->timestamp += (0xFFFFFFFF - gd->arch.lastinc) + now + 1;
 		writel(IXP425_OSST_TIMER_TS_PEND, IXP425_OSST);
 	} else {
 		/* move stamp forward with absolut diff ticks */
-		gd->timestamp += (now - gd->lastinc);
+		gd->timestamp += (now - gd->arch.lastinc);
 	}
-	gd->lastinc = now;
+	gd->arch.lastinc = now;
 	return gd->timestamp;
 }
 
@@ -84,7 +84,7 @@ unsigned long long get_ticks(void)
 void reset_timer_masked(void)
 {
 	/* capture current timestamp counter */
-	gd->lastinc = readl(IXP425_OSTS_B);
+	gd->arch.lastinc = readl(IXP425_OSTS_B);
 	/* start "advancing" time stamp from 0 */
 	gd->timestamp = 0;
 }
diff --git a/arch/arm/cpu/pxa/timer.c b/arch/arm/cpu/pxa/timer.c
index 7799c14..212b31e 100644
--- a/arch/arm/cpu/pxa/timer.c
+++ b/arch/arm/cpu/pxa/timer.c
@@ -32,7 +32,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define	TIMER_LOAD_VAL	0xffffffff
 
 #define	timestamp	(gd->arch.tbl)
-#define	lastinc		(gd->lastinc)
+#define	lastinc		(gd->arch.lastinc)
 
 #if defined(CONFIG_CPU_PXA27X) || defined(CONFIG_CPU_MONAHANS)
 #define	TIMER_FREQ_HZ	3250000
diff --git a/arch/arm/cpu/tegra-common/timer.c b/arch/arm/cpu/tegra-common/timer.c
index dc9cc6c..51902e9 100644
--- a/arch/arm/cpu/tegra-common/timer.c
+++ b/arch/arm/cpu/tegra-common/timer.c
@@ -75,13 +75,13 @@ ulong get_timer_masked(void)
 	/* current tick value */
 	now = timer_get_us() / (TIMER_CLK / CONFIG_SYS_HZ);
 
-	if (now >= gd->lastinc)	/* normal mode (non roll) */
+	if (now >= gd->arch.lastinc)	/* normal mode (non roll) */
 		/* move stamp forward with absolute diff ticks */
-		gd->arch.tbl += (now - gd->lastinc);
+		gd->arch.tbl += (now - gd->arch.lastinc);
 	else	/* we have rollover of incrementer */
 		gd->arch.tbl += ((TIMER_LOAD_VAL / (TIMER_CLK / CONFIG_SYS_HZ))
-				- gd->lastinc) + now;
-	gd->lastinc = now;
+				- gd->arch.lastinc) + now;
+	gd->arch.lastinc = now;
 	return gd->arch.tbl;
 }
 
diff --git a/arch/arm/imx-common/timer.c b/arch/arm/imx-common/timer.c
index de21e44..ab37d64 100644
--- a/arch/arm/imx-common/timer.c
+++ b/arch/arm/imx-common/timer.c
@@ -49,7 +49,7 @@ static struct mxc_gpt *cur_gpt = (struct mxc_gpt *)GPT1_BASE_ADDR;
 DECLARE_GLOBAL_DATA_PTR;
 
 #define timestamp (gd->arch.tbl)
-#define lastinc (gd->lastinc)
+#define lastinc (gd->arch.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 41bef04..7d7f3cf 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -39,6 +39,7 @@ struct arch_global_data {
 	unsigned long timer_rate_hz;
 	unsigned long tbu;
 	unsigned long tbl;
+	unsigned long lastinc;
 };
 
 /*
@@ -66,7 +67,6 @@ typedef	struct	global_data {
 #ifdef CONFIG_ARM
 	/* "static data" needed by most of timer.c on ARM platforms */
 	unsigned long long	timer_reset_value;
-	unsigned long	lastinc;
 #endif
 #ifdef CONFIG_IXP425
 	unsigned long	timestamp;
diff --git a/arch/mips/cpu/xburst/timer.c b/arch/mips/cpu/xburst/timer.c
index 8ac8bf7..8c33d3c 100644
--- a/arch/mips/cpu/xburst/timer.c
+++ b/arch/mips/cpu/xburst/timer.c
@@ -34,7 +34,7 @@ static struct jz4740_tcu *tcu = (struct jz4740_tcu *)JZ4740_TCU_BASE;
 void reset_timer_masked(void)
 {
 	/* reset time */
-	gd->lastinc = readl(&tcu->tcnt0);
+	gd->arch.lastinc = readl(&tcu->tcnt0);
 	gd->arch.tbl = 0;
 }
 
@@ -42,14 +42,14 @@ ulong get_timer_masked(void)
 {
 	ulong now = readl(&tcu->tcnt0);
 
-	if (gd->lastinc <= now)
-		gd->arch.tbl += now - gd->lastinc; /* normal mode */
+	if (gd->arch.lastinc <= now)
+		gd->arch.tbl += now - gd->arch.lastinc; /* normal mode */
 	else {
 		/* we have an overflow ... */
-		gd->arch.tbl += TIMER_FDATA + now - gd->lastinc;
+		gd->arch.tbl += TIMER_FDATA + now - gd->arch.lastinc;
 	}
 
-	gd->lastinc = now;
+	gd->arch.lastinc = now;
 
 	return gd->arch.tbl;
 }
@@ -94,7 +94,7 @@ int timer_init(void)
 	writel(1 << TIMER_CHAN, &tcu->tscr); /* enable timer clock */
 	writeb(1 << TIMER_CHAN, &tcu->tesr); /* start counting up */
 
-	gd->lastinc = 0;
+	gd->arch.lastinc = 0;
 	gd->arch.tbl = 0;
 
 	return 0;
-- 
1.7.7.3

  parent reply	other threads:[~2012-11-16 21:19 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-16 21:19 [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 01/57] Add architecture-specific global data Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 02/57] at91: Move at91 global data into arch_global_data Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 03/57] arm: Move timer_rate_hz " Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 04/57] arm: Move tbu to arch_global_data Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 05/57] arm: Move tbl " Simon Glass
2012-11-16 21:19 ` Simon Glass [this message]
2012-11-16 21:19 ` [U-Boot] [PATCH 07/57] arm: Move timer_reset_value " Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 08/57] ixp: Move timestamp " Simon Glass
2012-11-16 22:22   ` Marek Vasut
2012-11-16 21:19 ` [U-Boot] [PATCH 09/57] nds32: Drop tlb_addr from global data Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 10/57] arm: Move tlb_addr to arch_global_data Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 11/57] x86: Move gdt_addr, new_gd_addr " Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 12/57] x86: Remove reset_status, relocoff from global_data Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 13/57] x86: Move new_gd_addr to arch_global_data Simon Glass
2012-11-18  1:07   ` Graeme Russ
2012-12-14  6:34     ` Simon Glass
2012-11-16 21:19 ` [U-Boot] [PATCH 14/57] ppc: Move brg_clk " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 15/57] ppc: Remove extra pci_clk fields from global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 16/57] ppc: Move clock fields to arch_global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 17/57] ppc: Move mpc83xx " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 18/57] ppc: Move lbc_clk and cpu " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 19/57] ppc: m68k: Move i2c1_clk, i2c2_clk " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 20/57] ppc: Move CONFIG_QE " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 21/57] ppc: Move used_laws " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 22/57] ppc: Move used_tlb_cams " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 23/57] ppc: Move mpc5xxx clocks " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 24/57] ppc: Move mpc512x " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 25/57] ppc: Move mpc8220 " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 26/57] ppc: Move reset_status " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 27/57] ppc: Move arbiter fields " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 28/57] ppc: Move dp_alloc_base, dp_alloc_top " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 29/57] arm: Move uart_clk " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 30/57] ppc: Move mirror_hack " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 31/57] ppc: Remove console_addr from global data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 32/57] ppc: Move fpga_state to arch_global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 33/57] ppc: Move wdt_last " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 34/57] ppc: Move kbd_status " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 35/57] ppc: arm: Move sdhc_clk into arch_global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 36/57] sparc: Drop kbd_status and reset_status from global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 37/57] m68k: Move CONFIG_EXTRA_CLOCK to arch_global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 38/57] mips: Move per_clk and dev_clk " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 39/57] avr32: Move stack_end " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 40/57] avr32: Move cpu_hz " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 41/57] sandbox: Move ram_buf " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 42/57] Add generic global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 43/57] Only use fb_base if we have a display Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 44/57] arm: Use generic global_data Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 45/57] avr32: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 46/57] blackfin: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 47/57] m68k: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 48/57] microblaze: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 49/57] mips: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 50/57] nds32: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 51/57] nios2: " Simon Glass
2012-11-20  4:01   ` Thomas Chou
2012-11-16 21:20 ` [U-Boot] [PATCH 52/57] openrisc: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 53/57] powerpc: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 54/57] sandbox: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 55/57] sh: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 56/57] sparc: " Simon Glass
2012-11-16 21:20 ` [U-Boot] [PATCH 57/57] x86: " Simon Glass
2012-11-20  7:25 ` [U-Boot] [PATCH 0/57] RFC: Move arch-specific global data into its own structure Wolfgang Denk
2012-11-20 14:06   ` Simon Glass
2012-11-28 23:57     ` Simon Glass
2012-12-03 14:54     ` Tom Rini
2012-12-03 22:02       ` Graeme Russ
2012-12-03 22:19         ` Simon Glass
2012-12-03 23:39           ` Tom Rini
2012-12-03 23:45             ` Graeme Russ
2012-12-04 19:27               ` Wolfgang Denk
2012-12-05  0:02                 ` Simon Glass
2012-12-04 19:25           ` Wolfgang Denk
2012-12-05  1:14             ` Graeme Russ
2012-12-06  0:33               ` Simon Glass
2012-12-04 19:05         ` Wolfgang Denk
2012-12-04 19:20       ` Wolfgang Denk
2012-12-04 19:17     ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1353100842-20126-7-git-send-email-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.