From 66ee69234795c0596f84b25f06b7fbc2e8ed214c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 13 Dec 2012 20:48:34 +0000 Subject: arm: Move tbl to arch_global_data Move this field into arch_global_data and tidy up. Signed-off-by: Simon Glass --- 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 ++++---- 5 files changed, 27 insertions(+), 24 deletions(-) (limited to 'arch/arm/cpu/armv7') 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) -- cgit v1.1