diff mbox

[U-Boot,08/57] ixp: Move timestamp to arch_global_data

Message ID 1353100842-20126-9-git-send-email-sjg@chromium.org
State Superseded, archived
Delegated to: Tom Rini
Headers show

Commit Message

Simon Glass Nov. 16, 2012, 9:19 p.m. UTC
Move this field into arch_global_data and tidy up.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 arch/arm/cpu/ixp/timer.c           |    8 ++++----
 arch/arm/include/asm/global_data.h |    6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

Comments

Marek Vasut Nov. 16, 2012, 10:22 p.m. UTC | #1
Dear Simon Glass,

> Move this field into arch_global_data and tidy up.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Ick, this driver's ugly :)

Acked-by: Marek Vasut <marex@denx.de>

Tom, is there any IXP maintainer?

> ---
>  arch/arm/cpu/ixp/timer.c           |    8 ++++----
>  arch/arm/include/asm/global_data.h |    6 +++---
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/cpu/ixp/timer.c b/arch/arm/cpu/ixp/timer.c
> index 0450b51..663d989 100644
> --- a/arch/arm/cpu/ixp/timer.c
> +++ b/arch/arm/cpu/ixp/timer.c
> @@ -70,14 +70,14 @@ unsigned long long get_ticks(void)
> 
>  	if (readl(IXP425_OSST) & IXP425_OSST_TIMER_TS_PEND) {
>  		/* rollover of timestamp timer register */
> -		gd->timestamp += (0xFFFFFFFF - gd->arch.lastinc) + now + 1;
> +		gd->arch.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->arch.lastinc);
> +		gd->arch.timestamp += (now - gd->arch.lastinc);
>  	}
>  	gd->arch.lastinc = now;
> -	return gd->timestamp;
> +	return gd->arch.timestamp;
>  }
> 
> 
> @@ -86,7 +86,7 @@ void reset_timer_masked(void)
>  	/* capture current timestamp counter */
>  	gd->arch.lastinc = readl(IXP425_OSTS_B);
>  	/* start "advancing" time stamp from 0 */
> -	gd->timestamp = 0;
> +	gd->arch.timestamp = 0;
>  }
> 
>  ulong get_timer_masked(void)
> diff --git a/arch/arm/include/asm/global_data.h
> b/arch/arm/include/asm/global_data.h index 95e23e1..35d07d0 100644
> --- a/arch/arm/include/asm/global_data.h
> +++ b/arch/arm/include/asm/global_data.h
> @@ -41,6 +41,9 @@ struct arch_global_data {
>  	unsigned long tbl;
>  	unsigned long lastinc;
>  	unsigned long long timer_reset_value;
> +#ifdef CONFIG_IXP425
> +	unsigned long timestamp;
> +#endif
>  };
> 
>  /*
> @@ -65,9 +68,6 @@ typedef	struct	global_data {
>  #ifdef CONFIG_FSL_ESDHC
>  	unsigned long	sdhc_clk;
>  #endif
> -#ifdef CONFIG_IXP425
> -	unsigned long	timestamp;
> -#endif
>  	unsigned long	relocaddr;	/* Start address of U-Boot in RAM */
>  	phys_size_t	ram_size;	/* RAM size */
>  	unsigned long	mon_len;	/* monitor len */

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/arch/arm/cpu/ixp/timer.c b/arch/arm/cpu/ixp/timer.c
index 0450b51..663d989 100644
--- a/arch/arm/cpu/ixp/timer.c
+++ b/arch/arm/cpu/ixp/timer.c
@@ -70,14 +70,14 @@  unsigned long long get_ticks(void)
 
 	if (readl(IXP425_OSST) & IXP425_OSST_TIMER_TS_PEND) {
 		/* rollover of timestamp timer register */
-		gd->timestamp += (0xFFFFFFFF - gd->arch.lastinc) + now + 1;
+		gd->arch.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->arch.lastinc);
+		gd->arch.timestamp += (now - gd->arch.lastinc);
 	}
 	gd->arch.lastinc = now;
-	return gd->timestamp;
+	return gd->arch.timestamp;
 }
 
 
@@ -86,7 +86,7 @@  void reset_timer_masked(void)
 	/* capture current timestamp counter */
 	gd->arch.lastinc = readl(IXP425_OSTS_B);
 	/* start "advancing" time stamp from 0 */
-	gd->timestamp = 0;
+	gd->arch.timestamp = 0;
 }
 
 ulong get_timer_masked(void)
diff --git a/arch/arm/include/asm/global_data.h b/arch/arm/include/asm/global_data.h
index 95e23e1..35d07d0 100644
--- a/arch/arm/include/asm/global_data.h
+++ b/arch/arm/include/asm/global_data.h
@@ -41,6 +41,9 @@  struct arch_global_data {
 	unsigned long tbl;
 	unsigned long lastinc;
 	unsigned long long timer_reset_value;
+#ifdef CONFIG_IXP425
+	unsigned long timestamp;
+#endif
 };
 
 /*
@@ -65,9 +68,6 @@  typedef	struct	global_data {
 #ifdef CONFIG_FSL_ESDHC
 	unsigned long	sdhc_clk;
 #endif
-#ifdef CONFIG_IXP425
-	unsigned long	timestamp;
-#endif
 	unsigned long	relocaddr;	/* Start address of U-Boot in RAM */
 	phys_size_t	ram_size;	/* RAM size */
 	unsigned long	mon_len;	/* monitor len */