[u-boot] aspeed/timer: move static variables under arch_global_data

Message ID 20171010130925.19345-1-clg@kaod.org
State Accepted, archived
Headers show
Series
  • [u-boot] aspeed/timer: move static variables under arch_global_data
Related show

Commit Message

Cédric Le Goater Oct. 10, 2017, 1:09 p.m.
The timestamp and lastdec variables are under BSS which is a problem
as the timer_init() routine is called in the early init phase. Move
them under arch_global_data.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---

 Tested on AST2500 EVB

 arch/arm/mach-aspeed/timer.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Andrew Jeffery Oct. 20, 2017, 1:59 p.m. | #1
On Tue, 2017-10-10 at 15:09 +0200, Cédric Le Goater wrote:
> The timestamp and lastdec variables are under BSS which is a problem
> as the timer_init() routine is called in the early init phase. Move
> them under arch_global_data.

> Signed-off-by: Cédric Le Goater <clg@kaod.org>

Applied to v2016.07-aspeed-openbmc.

Cheers,

Andrew

> ---

>  Tested on AST2500 EVB

>  arch/arm/mach-aspeed/timer.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

> diff --git a/arch/arm/mach-aspeed/timer.c b/arch/arm/mach-aspeed/timer.c
> index 626f992429b6..d4a85116e80b 100644
> --- a/arch/arm/mach-aspeed/timer.c
> +++ b/arch/arm/mach-aspeed/timer.c
> @@ -31,8 +31,10 @@
>  #define READ_CLK (*(volatile ulong *)(AST_TIMER_BASE + 0))
>  #define READ_TIMER (READ_CLK / CLK_PER_HZ)
>  
> -static ulong timestamp;
> -static ulong lastdec;
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +#define timestamp gd->arch.tbl
> +#define lastdec gd->arch.lastinc
>  
>  int timer_init (void)
>  {

Patch

diff --git a/arch/arm/mach-aspeed/timer.c b/arch/arm/mach-aspeed/timer.c
index 626f992429b6..d4a85116e80b 100644
--- a/arch/arm/mach-aspeed/timer.c
+++ b/arch/arm/mach-aspeed/timer.c
@@ -31,8 +31,10 @@ 
 #define READ_CLK (*(volatile ulong *)(AST_TIMER_BASE + 0))
 #define READ_TIMER (READ_CLK / CLK_PER_HZ)
 
-static ulong timestamp;
-static ulong lastdec;
+DECLARE_GLOBAL_DATA_PTR;
+
+#define timestamp gd->arch.tbl
+#define lastdec gd->arch.lastinc
 
 int timer_init (void)
 {