From 574be25ea1b88ff1b7d213584b04b754f187e25d Mon Sep 17 00:00:00 2001
From: Francois Retief <fgretief@spaceteq.co.za>
Date: Thu, 29 Oct 2015 12:58:52 +0200
Subject: [PATCH] sparc: leon3: Move ambapp_bus_init() call to arch_cpu_init()
 function

Signed-off-by: Francois Retief <fgretief@spaceteq.co.za>
---
 arch/sparc/cpu/leon3/ambapp.c   | 2 +-
 arch/sparc/cpu/leon3/cpu_init.c | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/arch/sparc/cpu/leon3/ambapp.c b/arch/sparc/cpu/leon3/ambapp.c
index b8ac05faf1..47769cffd7 100644
--- a/arch/sparc/cpu/leon3/ambapp.c
+++ b/arch/sparc/cpu/leon3/ambapp.c
@@ -40,7 +40,7 @@ extern int ambapp_find_ahb(struct ambapp_bus *abus, unsigned int dev_vend,
 	int index, int type, struct ambapp_find_ahb_info *result);
 
 /************ C ROUTINES USED BY U-BOOT AMBA CORE DRIVERS ************/
-struct ambapp_bus ambapp_plb;
+struct ambapp_bus ambapp_plb __section(.data);
 
 void ambapp_bus_init(
 	unsigned int ioarea,
diff --git a/arch/sparc/cpu/leon3/cpu_init.c b/arch/sparc/cpu/leon3/cpu_init.c
index 421859e0e2..20a6a256f0 100644
--- a/arch/sparc/cpu/leon3/cpu_init.c
+++ b/arch/sparc/cpu/leon3/cpu_init.c
@@ -56,10 +56,6 @@ void cpu_init_f(void)
 	 */
 void cpu_init_f2(void)
 {
-	/* Initialize the AMBA Plug & Play bus structure, the bus
-	 * structure represents the AMBA bus that the CPU is located at.
-	 */
-	ambapp_bus_init(CONFIG_AMBAPP_IOAREA, CONFIG_SYS_CLK_FREQ, &ambapp_plb);
 }
 
 /* If cache snooping is available in hardware the result will be set
@@ -80,6 +76,11 @@ int arch_cpu_init(void)
 
 	gd->arch.snooping_available = snoop_detect();
 
+	/* Initialize the AMBA Plug & Play bus structure, the bus
+	 * structure represents the AMBA bus that the CPU is located at.
+	 */
+	ambapp_bus_init(CONFIG_AMBAPP_IOAREA, CONFIG_SYS_CLK_FREQ, &ambapp_plb);
+
 	return 0;
 }
 
-- 
2.39.5