]> git.sur5r.net Git - u-boot/blobdiff - board/freescale/p1_p2_rdb_pc/spl.c
VCMA9: remove EXT2 support
[u-boot] / board / freescale / p1_p2_rdb_pc / spl.c
index 5b8e0ffa6dea6afc63d110b336cdce8a3c3331df..8d0d850480212c881e0a8b3eb94518e7af8a27a7 100644 (file)
@@ -11,6 +11,7 @@
 #include <nand.h>
 #include <i2c.h>
 #include <fsl_esdhc.h>
+#include <spi_flash.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -19,7 +20,7 @@ static const u32 sysclk_tbl[] = {
        99999000, 11111000, 12499800, 13333200
 };
 
-ulong get_effective_memsize(void)
+phys_size_t get_effective_memsize(void)
 {
        return CONFIG_SYS_L2_SIZE;
 }
@@ -39,6 +40,10 @@ void board_init_f(ulong bootflag)
        /* Read back the register to synchronize the write. */
        in_be32(&gur->pmuxcr);
 
+#ifdef CONFIG_SPL_SPI_BOOT
+       clrbits_be32(&gur->pmuxcr, MPC85xx_PMUXCR_SD_DATA);
+#endif
+
        /* initialize selected port with appropriate baud rate */
        plat_ratio = in_be32(&gur->porpllsr) & MPC85xx_PORPLLSR_PLAT_RATIO;
        plat_ratio >>= 1;
@@ -49,6 +54,8 @@ void board_init_f(ulong bootflag)
                     bus_clk / 16 / CONFIG_BAUDRATE);
 #ifdef CONFIG_SPL_MMC_BOOT
        puts("\nSD boot...\n");
+#elif defined(CONFIG_SPL_SPI_BOOT)
+       puts("\nSPI Flash boot...\n");
 #endif
 
        /* copy code to RAM and jump to it - this should not return */
@@ -76,12 +83,21 @@ void board_init_r(gd_t *gd, ulong dest_addr)
        mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
                        CONFIG_SPL_RELOC_MALLOC_SIZE);
 
+#ifndef CONFIG_SPL_NAND_BOOT
        env_init();
+#endif
 #ifdef CONFIG_SPL_MMC_BOOT
        mmc_initialize(bd);
 #endif
        /* relocate environment function pointers etc. */
+#ifdef CONFIG_SPL_NAND_BOOT
+       nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+                           (uchar *)CONFIG_ENV_ADDR);
+       gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
+       gd->env_valid = 1;
+#else
        env_relocate();
+#endif
 
 #ifdef CONFIG_SYS_I2C
        i2c_init_all();
@@ -90,9 +106,17 @@ void board_init_r(gd_t *gd, ulong dest_addr)
 #endif
 
        gd->ram_size = initdram(0);
+#ifdef CONFIG_SPL_NAND_BOOT
+       puts("Tertiary program loader running in sram...");
+#else
        puts("Second program loader running in sram...\n");
+#endif
 
 #ifdef CONFIG_SPL_MMC_BOOT
        mmc_boot();
+#elif defined(CONFIG_SPL_SPI_BOOT)
+       spi_boot();
+#elif defined(CONFIG_SPL_NAND_BOOT)
+       nand_boot();
 #endif
 }