[U-Boot] [PATCH 11/12] microblaze: Clean microblaze initialization

Michal Simek monstr at monstr.eu
Mon Jul 9 11:20:38 CEST 2012


Move board specific function to board_init function in board/ folder
Remove externs from generic board.c
Use board_init_f function in board.c file.

Signed-off-by: Michal Simek <monstr at monstr.eu>
---
 arch/microblaze/cpu/start.S                        |    2 +-
 arch/microblaze/lib/board.c                        |   17 +++--------------
 .../xilinx/microblaze-generic/microblaze-generic.c |   10 ++++++++++
 3 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/arch/microblaze/cpu/start.S b/arch/microblaze/cpu/start.S
index 8a2f634..8564c4e 100644
--- a/arch/microblaze/cpu/start.S
+++ b/arch/microblaze/cpu/start.S
@@ -149,7 +149,7 @@ clear_bss:
 	cmp     r6, r5, r4 /* check if we have reach the end */
 	bnei    r6, 2b
 3:	/* jumping to board_init */
-	brai	board_init
+	brai	board_init_f
 1:	bri	1b
 
 /*
diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
index 37ec665..1dee830 100644
--- a/arch/microblaze/lib/board.c
+++ b/arch/microblaze/lib/board.c
@@ -38,13 +38,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifdef CONFIG_SYS_GPIO_0
-extern int gpio_init (void);
-#endif
-#ifdef CONFIG_SYS_FSL_2
-extern void fsl_init2 (void);
-#endif
-
 /*
  * All attempts to come up with a "common" initialization sequence
  * that works for all boards and architectures failed: some of the
@@ -66,20 +59,14 @@ init_fnc_t *init_sequence[] = {
 #endif
 	serial_init,
 	console_init_f,
-#ifdef CONFIG_SYS_GPIO_0
-	gpio_init,
-#endif
 	interrupts_init,
 	timer_init,
-#ifdef CONFIG_SYS_FSL_2
-	fsl_init2,
-#endif
 	NULL,
 };
 
 unsigned long monitor_flash_len;
 
-void board_init (void)
+void board_init_f(ulong not_used)
 {
 	bd_t *bd;
 	init_fnc_t **init_fnc_ptr;
@@ -189,6 +176,8 @@ void board_init (void)
 	/* Initialize the console (after the relocation and devices init) */
 	console_init_r();
 
+	board_init();
+
 	/* Initialize from environment */
 	load_addr = getenv_ulong("loadaddr", 16, load_addr);
 
diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c
index 4a719ba..608fb20 100644
--- a/board/xilinx/microblaze-generic/microblaze-generic.c
+++ b/board/xilinx/microblaze-generic/microblaze-generic.c
@@ -31,6 +31,8 @@
 #include <asm/microblaze_intc.h>
 #include <asm/asm.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 #ifdef CONFIG_SYS_GPIO_0
@@ -69,6 +71,14 @@ int fsl_init2 (void) {
 }
 #endif
 
+void board_init(void)
+{
+	gpio_init();
+#ifdef CONFIG_SYS_FSL_2
+	fsl_init2();
+#endif
+}
+
 int board_eth_init(bd_t *bis)
 {
 	int ret = 0;
-- 
1.7.0.4



More information about the U-Boot mailing list