]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
powerpc: Add cpu_secondary_init_r to allow for initialization post env setup
authorKumar Gala <galak@kernel.crashing.org>
Wed, 2 Feb 2011 17:23:50 +0000 (11:23 -0600)
committerKumar Gala <galak@kernel.crashing.org>
Mon, 4 Apr 2011 14:24:41 +0000 (09:24 -0500)
We can simplify some cpu/SoC level initialization by moving it to be
after the environment and non-volatile storage is setup as there might
be dependancies on such things in various boot configurations.

For example for FSL SoC's with QE if we boot from NAND we need it setup
to extra the ucode image to initialize the QE.  If we always do this
after environment & non-volatile storage is working we can have the code
be the same regardless of NOR, NAND, SPI, MMC boot.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
arch/powerpc/cpu/mpc85xx/cpu_init.c
arch/powerpc/lib/board.c

index 8ece970097246c2fe1b102935ad78b439fe7ce3a..215b7b3808b50017021ad456aae7f8767d6ee2eb 100644 (file)
@@ -384,12 +384,6 @@ int cpu_init_r(void)
 
        enable_cpc();
 
-#ifdef CONFIG_QE
-       uint qe_base = CONFIG_SYS_IMMR + 0x00080000; /* QE immr base */
-       qe_init(qe_base);
-       qe_reset();
-#endif
-
        /* needs to be in ram since code uses global static vars */
        fsl_serdes_init();
 
@@ -449,3 +443,12 @@ int sata_initialize(void)
        return 1;
 }
 #endif
+
+void cpu_secondary_init_r(void)
+{
+#ifdef CONFIG_QE
+       uint qe_base = CONFIG_SYS_IMMR + 0x00080000; /* QE immr base */
+       qe_init(qe_base);
+       qe_reset();
+#endif
+}
index 4719f8c6967a4761dd28cae35b9df9f040e70db4..83fb0744f547f576edf21264b72f46762abc012f 100644 (file)
@@ -186,6 +186,12 @@ int __board_flash_wp_on(void)
 }
 int board_flash_wp_on(void) __attribute__((weak, alias("__board_flash_wp_on")));
 
+void __cpu_secondary_init_r(void)
+{
+}
+void cpu_secondary_init_r(void)
+__attribute__((weak, alias("__cpu_secondary_init_r")));
+
 static int init_func_ram (void)
 {
 #ifdef CONFIG_BOARD_TYPES
@@ -797,6 +803,14 @@ void board_init_r (gd_t *id, ulong dest_addr)
        /* relocate environment function pointers etc. */
        env_relocate ();
 
+       /*
+        * after non-volatile devices & environment is setup and cpu code have
+        * another round to deal with any initialization that might require
+        * full access to the environment or loading of some image (firmware)
+        * from a non-volatile device
+        */
+       cpu_secondary_init_r();
+
        /*
         * Fill in missing fields of bd_info.
         * We do this here, where we have "normal" access to the