Merge branch 'master' of git://www.denx.de/git/u-boot-imx
[oweals/u-boot.git] / board / gateworks / gw_ventana / gw_ventana_spl.c
index 84d027d441a30bbd5d665e065aa96f0154b4a8b4..d4418e554c4aac209a37126d4e6b73b009ea6c0c 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/imx-common/boot_mode.h>
 #include <asm/imx-common/iomux-v3.h>
 #include <asm/imx-common/mxc_i2c.h>
+#include <environment.h>
 #include <spl.h>
 
 #include "gsc.h"
@@ -514,10 +515,8 @@ void board_init_f(ulong dummy)
        setup_iomux_gpio(board_model, &ventana_info);
 
        /* provide some some default: 32bit 128MB */
-       if (GW_UNKNOWN == board_model) {
-               ventana_info.sdram_width = 2;
-               ventana_info.sdram_size = 3;
-       }
+       if (GW_UNKNOWN == board_model)
+               hang();
 
        /* configure MMDC for SDRAM width/size and per-model calibration */
        spl_dram_init(8 << ventana_info.sdram_width,
@@ -529,9 +528,6 @@ void board_init_f(ulong dummy)
 
        /* disable boot watchdog */
        gsc_boot_wd_disable();
-
-       /* load/boot image from boot device */
-       board_init_r(NULL, 0);
 }
 
 /* called from board_init_r after gd setup if CONFIG_SPL_BOARD_INIT defined */
@@ -554,8 +550,30 @@ void spl_board_init(void)
        default:
                puts("Unknown boot device\n");
        }
+
+       /* PMIC init */
+       setup_pmic();
 }
 
+#ifdef CONFIG_SPL_OS_BOOT
+/* return 1 if we wish to boot to uboot vs os (falcon mode) */
+int spl_start_uboot(void)
+{
+       int ret = 1;
+
+       debug("%s\n", __func__);
+#ifdef CONFIG_SPL_ENV_SUPPORT
+       env_init();
+       env_relocate_spec();
+       debug("boot_os=%s\n", getenv("boot_os"));
+       if (getenv_yesno("boot_os") == 1)
+               ret = 0;
+#endif
+       debug("%s booting %s\n", __func__, ret ? "uboot" : "linux");
+       return ret;
+}
+#endif
+
 void reset_cpu(ulong addr)
 {
 }