ARM: at91: spl: Add boot device for boot from QSPI
[oweals/u-boot.git] / arch / arm / mach-omap2 / boot-common.c
index 7ae3d8041c48ee61c3c332e79004217537a34936..26245aa1694e47283c2acdeac8e322ed06fe1b76 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <ahci.h>
+#include <environment.h>
 #include <spl.h>
 #include <asm/omap_common.h>
 #include <asm/arch/omap.h>
@@ -64,6 +65,23 @@ void save_omap_boot_params(void)
         */
        if (boot_device == BOOT_DEVICE_QSPI_4)
                boot_device = BOOT_DEVICE_SPI;
+#endif
+#ifdef CONFIG_TI816X
+       /*
+        * On PG2.0 and later TI816x the values we get when booting are not the
+        * same as on PG1.0, which is what the defines are based on.  Update
+        * them as needed.
+        */
+       if (get_cpu_rev() != 1) {
+               if (boot_device == 0x05) {
+                       omap_boot_params->boot_device = BOOT_DEVICE_NAND;
+                       boot_device = BOOT_DEVICE_NAND;
+               }
+               if (boot_device == 0x08) {
+                       omap_boot_params->boot_device = BOOT_DEVICE_MMC1;
+                       boot_device = BOOT_DEVICE_MMC1;
+               }
+       }
 #endif
        /*
         * When booting from peripheral booting, the boot device is not usable
@@ -178,13 +196,6 @@ u32 spl_boot_mode(const u32 boot_device)
 
 void spl_board_init(void)
 {
-       /*
-        * Save the boot parameters passed from romcode.
-        * We cannot delay the saving further than this,
-        * to prevent overwrites.
-        */
-       save_omap_boot_params();
-
        /* Prepare console output */
        preloader_console_init();
 
@@ -205,21 +216,6 @@ void spl_board_init(void)
 #endif
 }
 
-__weak int board_mmc_init(bd_t *bis)
-{
-       switch (spl_boot_device()) {
-       case BOOT_DEVICE_MMC1:
-               omap_mmc_init(0, 0, 0, -1, -1);
-               break;
-       case BOOT_DEVICE_MMC2:
-       case BOOT_DEVICE_MMC2_2:
-               omap_mmc_init(0, 0, 0, -1, -1);
-               omap_mmc_init(1, 0, 0, -1, -1);
-               break;
-       }
-       return 0;
-}
-
 void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
 {
        typedef void __noreturn (*image_entry_noargs_t)(u32 *);
@@ -245,8 +241,8 @@ void arch_preboot_os(void)
 int fb_set_reboot_flag(void)
 {
        printf("Setting reboot to fastboot flag ...\n");
-       setenv("dofastboot", "1");
-       saveenv();
+       env_set("dofastboot", "1");
+       env_save();
        return 0;
 }
 #endif