ARM: vf610: add bmode for Vybrid SoC
authorStefan Agner <stefan.agner@toradex.com>
Mon, 20 Apr 2015 10:54:59 +0000 (12:54 +0200)
committerStefan Agner <stefan.agner@toradex.com>
Mon, 20 Apr 2015 10:54:59 +0000 (12:54 +0200)
Implement boot mode for Vybrid SoC. Boot mode selection works much
like the i.MX6 implementation. Provide a standard set of boot modes
for the two eSDHC instances and use the reserved mode to jump into
SoC's recovery mechanism, the serial downloader.

arch/arm/cpu/armv7/vf610/generic.c
board/toradex/colibri_vf/colibri_vf.c
include/configs/colibri_vf.h

index 1bb9b8ed1d0ae7fb0409b516b146441812be177f..1b17fdf74d0c1527f8b3a3d9e16f7a42e122cd7c 100644 (file)
@@ -9,6 +9,7 @@
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/crm_regs.h>
+#include <asm/imx-common/boot_mode.h>
 #include <netdev.h>
 #ifdef CONFIG_FSL_ESDHC
 #include <fsl_esdhc.h>
@@ -304,6 +305,35 @@ int arch_cpu_init(void)
        return 0;
 }
 
+void boot_mode_apply(unsigned cfg_val)
+{
+       unsigned reg;
+       struct src *psrc = (struct src *)SRC_BASE_ADDR;
+       writel(cfg_val, &psrc->hab3);
+       reg = readl(&psrc->hab4);
+       if (cfg_val)
+               reg |= 1 << 28;
+       else
+               reg &= ~(1 << 28);
+       writel(reg, &psrc->hab4);
+}
+
+/*
+ * cfg_val will be used for
+ * Boot_cfg4[7:0]:Boot_cfg3[7:0]:Boot_cfg2[7:0]:Boot_cfg1[7:0]
+ * After reset, if GPR10[28] is 1, ROM will use GPR9[25:0]
+ * instead of SBMR1 to determine the boot device.
+ */
+const struct boot_mode soc_boot_modes[] = {
+       {"normal",      MAKE_CFGVAL(0x00, 0x00, 0x00, 0x00)},
+       /* reserved value should start ROM's serial loader */
+       {"ser",         MAKE_CFGVAL(0x40, 0x00, 0x00, 0x00)},
+       /* 4 bit bus width */
+       {"esdhc0",      MAKE_CFGVAL(0x60, 0x20, 0x00, 0x00)},
+       {"esdhc1",      MAKE_CFGVAL(0x60, 0x28, 0x00, 0x00)},
+       {NULL,          0},
+};
+
 #ifdef CONFIG_ARCH_MISC_INIT
 int arch_misc_init(void)
 {
index 7027c4457c3dde6a6fe345dbc51bdd8fdab018cb..5158346f18a1108fec6aa1c245c66f778e8aee59 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/arch/ddrmc-vf610.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/clock.h>
+#include <asm/imx-common/boot_mode.h>
 #include <mmc.h>
 #include <fsl_esdhc.h>
 #include <miiphy.h>
@@ -313,6 +314,13 @@ int board_early_init_f(void)
        return 0;
 }
 
+#ifdef CONFIG_CMD_BMODE
+static const struct boot_mode board_boot_modes[] = {
+       {"nand", MAKE_CFGVAL(0x80, 0x02, 0x00, 0x00)},
+       {NULL,   0},
+};
+#endif
+
 #ifdef CONFIG_BOARD_LATE_INIT
 int board_late_init(void)
 {
@@ -340,6 +348,10 @@ int board_late_init(void)
                setenv("bootdelay", "-1");
        }
 
+#ifdef CONFIG_CMD_BMODE
+       add_board_boot_modes(board_boot_modes);
+#endif
+
        return 0;
 }
 #endif /* CONFIG_BOARD_LATE_INIT */
index c099bed05bec250eae521be50b438019c0bf3736..982a4e5391bd62da9662733dc5c21e8284d0cc6e 100644 (file)
@@ -28,6 +28,7 @@
 
 #define CONFIG_SKIP_LOWLEVEL_INIT
 
+#define CONFIG_CMD_BMODE
 #define CONFIG_CMD_FUSE
 #ifdef CONFIG_CMD_FUSE
 #define CONFIG_MXC_OCOTP