summaryrefslogtreecommitdiffstats
path: root/arch/sparc/cpu/leon3/start.S
diff options
context:
space:
mode:
authorDaniel Hellstrom <daniel@gaisler.com>2010-01-25 09:56:08 +0100
committerFrancois Retief <fgretief@spaceteq.co.za>2015-11-13 10:23:33 +0200
commitcff009ed6ff7da2e87f8213d34ed869be4373604 (patch)
tree0ef3637876bb35d7341f8eb3d656ab80e8fc198b /arch/sparc/cpu/leon3/start.S
parent3f33f6a28b7a823bfa19157353e8b7c78c63f63c (diff)
downloadblackbird-obmc-uboot-cff009ed6ff7da2e87f8213d34ed869be4373604.tar.gz
blackbird-obmc-uboot-cff009ed6ff7da2e87f8213d34ed869be4373604.zip
sparc: leon3: Added memory controller initialization using new AMBA PnP routines.
Signed-off-by: Daniel Hellstrom <daniel@gaisler.com>
Diffstat (limited to 'arch/sparc/cpu/leon3/start.S')
-rw-r--r--arch/sparc/cpu/leon3/start.S41
1 files changed, 40 insertions, 1 deletions
diff --git a/arch/sparc/cpu/leon3/start.S b/arch/sparc/cpu/leon3/start.S
index be9b3fb20b..203114970b 100644
--- a/arch/sparc/cpu/leon3/start.S
+++ b/arch/sparc/cpu/leon3/start.S
@@ -13,6 +13,12 @@
#include <asm/stack.h>
#include <asm/leon.h>
#include <version.h>
+#include <ambapp.h>
+
+/* Default Plug&Play I/O area */
+#ifndef CONFIG_AMBAPP_IOAREA
+#define CONFIG_AMBAPP_IOAREA AMBA_DEFAULT_IOAREA
+#endif
/* Entry for traps which jump to a programmer-specified trap handler. */
#define TRAPR(H) \
@@ -208,6 +214,7 @@ version_string:
.ascii U_BOOT_VERSION_STRING, "\0"
.section ".text"
+ .extern _nomem_amba_init, _nomem_memory_ctrl_init
.align 4
_hardreset:
@@ -259,6 +266,38 @@ stackp:
andn %fp, 0x0f, %fp
sub %fp, 64, %sp
+/* Obtain the address of _GLOBAL_OFFSET_TABLE_ */
+ SPARC_PIC_THUNK_CALL(l7)
+
+/* Scan AMBA Bus for AMBA buses using PnP information. All found
+ * AMBA buses I/O area will be located in i0-i5 upon return.
+ * The i0-i5 registers are later used by _nomem_amba_init2
+ */
+ambainit:
+ call _nomem_amba_init
+ sethi %hi(CONFIG_AMBAPP_IOAREA), %o0
+
+/* Scan AMBA Buses for memory controllers, then initialize the
+ * memory controllers. Note that before setting up the memory controller
+ * the stack can not be used.
+ */
+memory_ctrl_init:
+ SPARC_LOAD_ADDRESS(grlib_mctrl_handlers, l7, o0)
+
+ call _nomem_memory_ctrl_init
+ nop
+
+/* The return valu indicate how many memory controllers where found and
+ * initialized, if no memory controller was initialized, we can not continue
+ * because from here on we expect memory to be working.
+ */
+ cmp %o0, 0
+memory_ctrl_init_failed:
+ beq memory_ctrl_init_failed
+ nop
+
+/*** From now on the stack can be used. ***/
+
cpu_init_unreloc:
call cpu_init_f
nop
@@ -269,7 +308,6 @@ cpu_init_unreloc:
/* un relocated end address of monitor */
#define DATA_END __init_end
- SPARC_PIC_THUNK_CALL(l7)
reloc:
SPARC_LOAD_ADDRESS(TEXT_START, l7, g2)
SPARC_LOAD_ADDRESS(DATA_END, l7, g3)
@@ -389,6 +427,7 @@ jump:
SPARC_LOAD_ADDRESS(board_init_f, l7, o1)
set CONFIG_SYS_RELOC_MONITOR_BASE,%o2
+ SPARC_LOAD_ADDRESS(TEXT_START, l7, g1)
add %o1,%o2,%o1
sub %o1,%g1,%o1
call %o1
OpenPOWER on IntegriCloud