Patchwork [U-Boot,3/3] init_func: Use for eNET board

login
register
mail settings
Submitter Graeme Russ
Date April 22, 2012, 3:23 p.m.
Message ID <1335108188-21875-4-git-send-email-graeme.russ@gmail.com>
Download mbox | patch
Permalink /patch/154288/
State Deferred
Headers show

Comments

Graeme Russ - April 22, 2012, 3:23 p.m.
Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
---
 arch/x86/cpu/cpu.c               |    3 +++
 arch/x86/cpu/sc520/sc520_sdram.c |    3 +++
 arch/x86/cpu/sc520/sc520_timer.c |    2 ++
 arch/x86/lib/init_helpers.c      |   14 ++++++++++++++
 arch/x86/lib/init_wrappers.c     |   11 ++++++++++-
 arch/x86/lib/pcat_interrupts.c   |    2 ++
 arch/x86/lib/relocate.c          |    4 ++++
 board/eNET/eNET.c                |    5 +++++
 common/console.c                 |    3 +++
 common/env_dataflash.c           |    1 +
 common/env_eeprom.c              |    1 +
 common/env_fat.c                 |    1 +
 common/env_flash.c               |    2 ++
 common/env_mgdisk.c              |    1 +
 common/env_mmc.c                 |    1 +
 common/env_nand.c                |    1 +
 common/env_nowhere.c             |    1 +
 common/env_nvram.c               |    1 +
 common/env_onenand.c             |    1 +
 common/env_sf.c                  |    1 +
 common/serial.c                  |    2 ++
 common/stdio.c                   |    2 ++
 include/configs/eNET.h           |    1 +
 23 files changed, 63 insertions(+), 1 deletions(-)

Patch

diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index e9bb0d7..263df28 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -33,6 +33,7 @@ 
  */
 
 #include <common.h>
+#include <init_func.h>
 #include <command.h>
 #include <asm/processor.h>
 #include <asm/processor-flags.h>
@@ -137,6 +138,7 @@  int x86_cpu_init_f(void)
 	return 0;
 }
 int cpu_init_f(void) __attribute__((weak, alias("x86_cpu_init_f")));
+INIT_FUNC(cpu_init_f, cpu_f, RESET, , SDRAM);
 
 int x86_cpu_init_r(void)
 {
@@ -145,6 +147,7 @@  int x86_cpu_init_r(void)
 	return 0;
 }
 int cpu_init_r(void) __attribute__((weak, alias("x86_cpu_init_r")));
+INIT_FUNC(cpu_init_r, cpu_r, mem_malloc_init_r, , );
 
 void x86_enable_caches(void)
 {
diff --git a/arch/x86/cpu/sc520/sc520_sdram.c b/arch/x86/cpu/sc520/sc520_sdram.c
index 9dc1334..7033e18 100644
--- a/arch/x86/cpu/sc520/sc520_sdram.c
+++ b/arch/x86/cpu/sc520/sc520_sdram.c
@@ -22,6 +22,7 @@ 
  */
 
 #include <common.h>
+#include <init_func.h>
 #include <asm/io.h>
 #include <asm/processor-flags.h>
 #include <asm/arch/sc520.h>
@@ -51,6 +52,7 @@  int dram_init_f(void)
 
 	return 0;
 }
+INIT_FUNC(dram_init_f, dram_f, console_init_f, , SDRAM);
 
 static inline void sc520_dummy_write(void)
 {
@@ -477,3 +479,4 @@  int dram_init(void)
 
 	return 0;
 }
+INIT_FUNC(dram_init, dram_r, , board_early_init_r, );
diff --git a/arch/x86/cpu/sc520/sc520_timer.c b/arch/x86/cpu/sc520/sc520_timer.c
index 41f121f..7b25c08 100644
--- a/arch/x86/cpu/sc520/sc520_timer.c
+++ b/arch/x86/cpu/sc520/sc520_timer.c
@@ -25,6 +25,7 @@ 
  */
 
 #include <common.h>
+#include <init_func.h>
 #include <asm/io.h>
 #include <asm/interrupt.h>
 #include <asm/arch/sc520.h>
@@ -69,6 +70,7 @@  int timer_init(void)
 
 	return 0;
 }
+INIT_FUNC(timer_init, timer, interrupt_init, , );
 
 /* Allow boards to override udelay implementation */
 void __udelay(unsigned long usec)
diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c
index 9f4dee0..aa88048 100644
--- a/arch/x86/lib/init_helpers.c
+++ b/arch/x86/lib/init_helpers.c
@@ -21,6 +21,7 @@ 
  * MA 02111-1307 USA
  */
 #include <common.h>
+#include <init_func.h>
 #include <command.h>
 #include <stdio_dev.h>
 #include <version.h>
@@ -50,6 +51,7 @@  int display_banner(void)
 
 	return 0;
 }
+INIT_FUNC(display_banner, banner, timer_init, , );
 
 int display_dram_config(void)
 {
@@ -64,12 +66,14 @@  int display_dram_config(void)
 
 	return 0;
 }
+INIT_FUNC(display_dram_config, display_dram, display_banner, , );
 
 int init_baudrate_f(void)
 {
 	gd->baudrate = getenv_ulong("baudrate", 10, CONFIG_BAUDRATE);
 	return 0;
 }
+INIT_FUNC(init_baudrate_f, display_dram, env_init, , );
 
 int calculate_relocation_address(void)
 {
@@ -106,6 +110,7 @@  int calculate_relocation_address(void)
 
 	return 0;
 }
+INIT_FUNC(calculate_relocation_address, calc_reloc, dram_init_f, , );
 
 int copy_gd_to_ram_f_r(void)
 {
@@ -131,12 +136,14 @@  int copy_gd_to_ram_f_r(void)
 
 	return 0;
 }
+INIT_FUNC(copy_gd_to_ram_f_r, copy_gd, SDRAM, , RELOC);
 
 int init_cache_f_r(void)
 {
 	/* Initialise the CPU cache(s) */
 	return init_cache();
 }
+INIT_FUNC(init_cache_f_r, cache_f_r, copy_gd_to_ram_f_r, , RELOC);
 
 int set_reloc_flag_r(void)
 {
@@ -144,6 +151,7 @@  int set_reloc_flag_r(void)
 
 	return 0;
 }
+INIT_FUNC(set_reloc_flag_r, reloc_flag, RELOC, , );
 
 int mem_malloc_init_r(void)
 {
@@ -152,6 +160,7 @@  int mem_malloc_init_r(void)
 
 	return 0;
 }
+INIT_FUNC(mem_malloc_init_r, malloc, init_bd_struct_r, , );
 
 bd_t bd_data;
 
@@ -162,6 +171,7 @@  int init_bd_struct_r(void)
 
 	return 0;
 }
+INIT_FUNC(init_bd_struct_r, bd_struct, set_reloc_flag_r, , );
 
 #ifndef CONFIG_SYS_NO_FLASH
 int flash_init_r(void)
@@ -177,6 +187,7 @@  int flash_init_r(void)
 
 	return 0;
 }
+INIT_FUNC(flash_init_r, flash_r, RELOC, serial_initialize_r display_dram_config, );
 #endif
 
 int init_ip_address_r(void)
@@ -186,6 +197,7 @@  int init_ip_address_r(void)
 
 	return 0;
 }
+INIT_FUNC(init_ip_address_r, ip_address, env_relocate_r, , pci_init_r stdio_init);
 
 #ifdef CONFIG_STATUS_LED
 int status_led_set_r(void)
@@ -207,6 +219,7 @@  int set_bootfile_r(void)
 
 	return 0;
 }
+INIT_FUNC(set_bootfile_r, set_bootfile, set_load_addr_r, , );
 
 int set_load_addr_r(void)
 {
@@ -215,3 +228,4 @@  int set_load_addr_r(void)
 
 	return 0;
 }
+INIT_FUNC(set_load_addr_r, set_load_addr, enable_interrupts_r, , );
diff --git a/arch/x86/lib/init_wrappers.c b/arch/x86/lib/init_wrappers.c
index 71449fe..87ca713 100644
--- a/arch/x86/lib/init_wrappers.c
+++ b/arch/x86/lib/init_wrappers.c
@@ -21,6 +21,7 @@ 
  * MA 02111-1307 USA
  */
 #include <common.h>
+#include <init_func.h>
 #include <serial.h>
 #include <kgdb.h>
 #include <scsi.h>
@@ -35,6 +36,7 @@  int serial_initialize_r(void)
 
 	return 0;
 }
+INIT_FUNC(serial_initialize_r, serial_multi, RELOC, display_dram_config, );
 
 int env_relocate_r(void)
 {
@@ -43,7 +45,7 @@  int env_relocate_r(void)
 
 	return 0;
 }
-
+INIT_FUNC(env_relocate_r, env_reloc, RELOC env_init, display_dram_config serial_initialize_r flash_init_r, );
 
 int pci_init_r(void)
 {
@@ -52,6 +54,7 @@  int pci_init_r(void)
 
 	return 0;
 }
+INIT_FUNC(pci_init_r, pci, cpu_r, init_ip_address_r env_relocate_r, stdio_init);
 
 int jumptable_init_r(void)
 {
@@ -59,6 +62,7 @@  int jumptable_init_r(void)
 
 	return 0;
 }
+INIT_FUNC(jumptable_init_r, jumptable, stdio_init, , );
 
 int pcmcia_init_r(void)
 {
@@ -83,6 +87,7 @@  int enable_interrupts_r(void)
 
 	return 0;
 }
+INIT_FUNC(enable_interrupts_r, enable_interrupts, , kgdb_init_r pci_init_r misc_init_r console_init_r, );
 
 int eth_initialize_r(void)
 {
@@ -91,7 +96,9 @@  int eth_initialize_r(void)
 
 	return 0;
 }
+INIT_FUNC(eth_initialize_r, eth, pci, bb_miiphy_init_r doc_init_r scsi_init_r ide_init_r set_bootfile_r set_load_addr_r, );
 
+#ifdef CONFIG_RESET_PHY_R
 int reset_phy_r(void)
 {
 #ifdef DEBUG
@@ -101,6 +108,8 @@  int reset_phy_r(void)
 
 	return 0;
 }
+INIT_FUNC(reset_phy_r, phy_reset, eth, eth_initialize_r, );
+#endif
 
 int ide_init_r(void)
 {
diff --git a/arch/x86/lib/pcat_interrupts.c b/arch/x86/lib/pcat_interrupts.c
index 5dac498..a403b7b 100644
--- a/arch/x86/lib/pcat_interrupts.c
+++ b/arch/x86/lib/pcat_interrupts.c
@@ -31,6 +31,7 @@ 
  */
 
 #include <common.h>
+#include <init_func.h>
 #include <asm/io.h>
 #include <asm/i8259.h>
 #include <asm/ibmpc.h>
@@ -82,6 +83,7 @@  int interrupt_init(void)
 
 	return 0;
 }
+INIT_FUNC(interrupt_init, pcat_interrupt, , dram_init, );
 
 void mask_irq(int irq)
 {
diff --git a/arch/x86/lib/relocate.c b/arch/x86/lib/relocate.c
index 200baab..69b0fd6 100644
--- a/arch/x86/lib/relocate.c
+++ b/arch/x86/lib/relocate.c
@@ -32,6 +32,7 @@ 
  */
 
 #include <common.h>
+#include <init_func.h>
 #include <malloc.h>
 #include <asm/u-boot-x86.h>
 #include <asm/relocate.h>
@@ -45,6 +46,7 @@  int copy_uboot_to_ram(void)
 
 	return 0;
 }
+INIT_FUNC(copy_uboot_to_ram, copy_to_ram, SDRAM, init_cache_f_r, RELOC);
 
 int clear_bss(void)
 {
@@ -55,6 +57,7 @@  int clear_bss(void)
 
 	return 0;
 }
+INIT_FUNC(clear_bss, clear_bss, SDRAM, copy_uboot_to_ram, RELOC);
 
 int do_elf_reloc_fixups(void)
 {
@@ -89,3 +92,4 @@  int do_elf_reloc_fixups(void)
 
 	return 0;
 }
+INIT_FUNC(do_elf_reloc_fixups, elf_reloc, clear_bss, , RELOC);
diff --git a/board/eNET/eNET.c b/board/eNET/eNET.c
index 2f26470..19bbbe4 100644
--- a/board/eNET/eNET.c
+++ b/board/eNET/eNET.c
@@ -22,6 +22,7 @@ 
  */
 
 #include <common.h>
+#include <init_func.h>
 #include <asm/io.h>
 #include <asm/arch/sc520.h>
 #include <net.h>
@@ -106,6 +107,7 @@  int board_early_init_f(void)
 
 	return 0;
 }
+INIT_FUNC(board_early_init_f, board_early_f, cpu_init_f, , SDRAM);
 
 static void enet_setup_pars(void)
 {
@@ -161,6 +163,7 @@  int board_early_init_r(void)
 
 	return 0;
 }
+INIT_FUNC(board_early_init_r, board_early_r, cpu_init_r, , pci);
 
 void show_boot_progress(int val)
 {
@@ -186,6 +189,8 @@  int last_stage_init(void)
 
 	return 0;
 }
+INIT_FUNC(last_stage_init, last_stage, , eth_initialize_r reset_phy_r, );
+
 
 ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
 {
diff --git a/common/console.c b/common/console.c
index 1177f7d..01e6450 100644
--- a/common/console.c
+++ b/common/console.c
@@ -22,6 +22,7 @@ 
  */
 
 #include <common.h>
+#include <init_func.h>
 #include <stdarg.h>
 #include <malloc.h>
 #include <stdio_dev.h>
@@ -588,6 +589,7 @@  int console_init_f(void)
 
 	return 0;
 }
+INIT_FUNC(console_init_f, console_f, serial_init, , SDRAM);
 
 void stdio_print_current_devices(void)
 {
@@ -775,5 +777,6 @@  int console_init_r(void)
 
 	return 0;
 }
+INIT_FUNC(console_init_r, console_r, stdio_init, jumptable_init_r, );
 
 #endif /* CONFIG_SYS_CONSOLE_IS_IN_ENV */
diff --git a/common/env_dataflash.c b/common/env_dataflash.c
index 3c5af37..423e0ad 100644
--- a/common/env_dataflash.c
+++ b/common/env_dataflash.c
@@ -114,3 +114,4 @@  int env_init(void)
 
 	return 0;
 }
+INIT_FUNC(env_init, env_init, cpu_init_f, board_early_init_f, SDRAM);
diff --git a/common/env_eeprom.c b/common/env_eeprom.c
index b66bba2..75b4e11 100644
--- a/common/env_eeprom.c
+++ b/common/env_eeprom.c
@@ -289,3 +289,4 @@  int env_init(void)
 	return 0;
 }
 #endif
+INIT_FUNC(env_init, env_init, cpu_init_f, board_early_init_f, SDRAM);
diff --git a/common/env_fat.c b/common/env_fat.c
index bad92aa..d218094 100644
--- a/common/env_fat.c
+++ b/common/env_fat.c
@@ -53,6 +53,7 @@  int env_init(void)
 
 	return 0;
 }
+INIT_FUNC(env_init, env_init, cpu_init_f, board_early_init_f, SDRAM);
 
 #ifdef CONFIG_CMD_SAVEENV
 int saveenv(void)
diff --git a/common/env_flash.c b/common/env_flash.c
index aa970d4..5714b5b 100644
--- a/common/env_flash.c
+++ b/common/env_flash.c
@@ -27,6 +27,7 @@ 
 /* #define DEBUG */
 
 #include <common.h>
+#include <init_func.h>
 #include <command.h>
 #include <environment.h>
 #include <linux/stddef.h>
@@ -117,6 +118,7 @@  int env_init(void)
 
 	return 0;
 }
+INIT_FUNC(env_init, env_init, cpu_init_f, board_early_init_f, SDRAM);
 
 #ifdef CMD_SAVEENV
 int saveenv(void)
diff --git a/common/env_mgdisk.c b/common/env_mgdisk.c
index d00e141..e5ffaad 100644
--- a/common/env_mgdisk.c
+++ b/common/env_mgdisk.c
@@ -74,3 +74,4 @@  int env_init(void)
 
 	return 0;
 }
+INIT_FUNC(env_init, env_init, cpu_init_f, board_early_init_f, SDRAM);
diff --git a/common/env_mmc.c b/common/env_mmc.c
index 0c58ae1..dc8a21a 100644
--- a/common/env_mmc.c
+++ b/common/env_mmc.c
@@ -62,6 +62,7 @@  int env_init(void)
 
 	return 0;
 }
+INIT_FUNC(env_init, env_init, cpu_init_f, board_early_init_f, SDRAM);
 
 static int init_mmc_for_env(struct mmc *mmc)
 {
diff --git a/common/env_nand.c b/common/env_nand.c
index e8daec9..10e84f0 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -134,6 +134,7 @@  int env_init(void)
 
 	return 0;
 }
+INIT_FUNC(env_init, env_init, cpu_init_f, board_early_init_f, SDRAM);
 
 #ifdef CMD_SAVEENV
 /*
diff --git a/common/env_nowhere.c b/common/env_nowhere.c
index 18fcf2c..04d35e5 100644
--- a/common/env_nowhere.c
+++ b/common/env_nowhere.c
@@ -49,3 +49,4 @@  int env_init(void)
 
 	return 0;
 }
+INIT_FUNC(env_init, env_init, cpu_init_f, board_early_init_f, SDRAM);
diff --git a/common/env_nvram.c b/common/env_nvram.c
index 6483db3..0487de0 100644
--- a/common/env_nvram.c
+++ b/common/env_nvram.c
@@ -134,3 +134,4 @@  int env_init(void)
 
 	return 0;
 }
+INIT_FUNC(env_init, env_init, cpu_init_f, board_early_init_f, SDRAM);
diff --git a/common/env_onenand.c b/common/env_onenand.c
index 652665a..ec98de5 100644
--- a/common/env_onenand.c
+++ b/common/env_onenand.c
@@ -135,3 +135,4 @@  int env_init(void)
 
 	return 0;
 }
+INIT_FUNC(env_init, env_init, cpu_init_f, board_early_init_f, SDRAM);
diff --git a/common/env_sf.c b/common/env_sf.c
index bbd472f..84fd3b2 100644
--- a/common/env_sf.c
+++ b/common/env_sf.c
@@ -349,3 +349,4 @@  int env_init(void)
 
 	return 0;
 }
+INIT_FUNC(env_init, env_init, cpu_init_f, board_early_init_f, SDRAM);
diff --git a/common/serial.c b/common/serial.c
index 75cc1bb..920c5d3 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -22,6 +22,7 @@ 
  */
 
 #include <common.h>
+#include <init_func.h>
 #include <serial.h>
 #include <stdio_dev.h>
 #include <post.h>
@@ -190,6 +191,7 @@  int serial_init(void)
 {
 	return get_current()->init();
 }
+INIT_FUNC(serial_init, serial_f, init_baudrate_f, , SDRAM);
 
 void serial_setbrg(void)
 {
diff --git a/common/stdio.c b/common/stdio.c
index 1bf9ba0..6472259 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -22,6 +22,7 @@ 
  */
 
 #include <config.h>
+#include <init_func.h>
 #include <common.h>
 #include <stdarg.h>
 #include <malloc.h>
@@ -242,3 +243,4 @@  int stdio_init (void)
 
 	return (0);
 }
+INIT_FUNC(stdio_init, stdio, env_relocate_r, , );
diff --git a/include/configs/eNET.h b/include/configs/eNET.h
index d5c9cad..57cecff 100644
--- a/include/configs/eNET.h
+++ b/include/configs/eNET.h
@@ -29,6 +29,7 @@ 
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#define CONFIG_INIT_FUNC
 /*
  * High Level Configuration Options
  * (easy to change)