imx: ventana: detect pmic using i2c probe instead of board model
[oweals/u-boot.git] / board / gateworks / gw_ventana / gw_ventana_spl.c
index e3d4e572c2f196074bb0c44e86fde4c41368ea64..8fe0cae9f56030a51026a6277314f40262623abf 100644 (file)
@@ -476,12 +476,14 @@ static void spl_dram_init(int width, int size_mb, int board_model)
                debug("4gB density\n");
        }
 
-       if (!mem) {
-               puts("Error: Invalid Memory Configuration\n");
-               hang();
-       }
-       if (!calib) {
-               puts("Error: Invalid Board Calibration Configuration\n");
+       if (!(mem && calib)) {
+               puts("Error: Invalid Calibration/Board Configuration\n");
+               printf("MEM    : %s\n", mem ? "OKAY" : "NULL");
+               printf("CALIB  : %s\n", calib ? "OKAY" : "NULL");
+               printf("CPUTYPE: %s\n",
+                      is_cpu_type(MXC_CPU_MX6Q) ? "IMX6Q" : "IMX6DL");
+               printf("SIZE_MB: %d\n", size_mb);
+               printf("WIDTH  : %d\n", width);
                hang();
        }
 
@@ -528,10 +530,13 @@ void board_init_f(ulong dummy)
        struct ventana_board_info ventana_info;
        int board_model;
 
+       /* setup clock gating */
+       ccgr_init();
+
        /* setup AIPS and disable watchdog */
        arch_cpu_init();
 
-       ccgr_init();
+       /* setup AXI */
        gpr_init();
 
        /* iomux and setup of i2c */
@@ -565,6 +570,28 @@ void board_init_f(ulong dummy)
        board_init_r(NULL, 0);
 }
 
+/* called from board_init_r after gd setup if CONFIG_SPL_BOARD_INIT defined */
+/* its our chance to print info about boot device */
+void spl_board_init(void)
+{
+       /* determine boot device from SRC_SBMR1 (BOOT_CFG[4:1]) or SRC_GPR9 */
+       u32 boot_device = spl_boot_device();
+
+       switch (boot_device) {
+       case BOOT_DEVICE_MMC1:
+               puts("Booting from MMC\n");
+               break;
+       case BOOT_DEVICE_NAND:
+               puts("Booting from NAND\n");
+               break;
+       case BOOT_DEVICE_SATA:
+               puts("Booting from SATA\n");
+               break;
+       default:
+               puts("Unknown boot device\n");
+       }
+}
+
 void reset_cpu(ulong addr)
 {
 }