]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - arch/arm/cpu/armv7/mx6/soc.c
imx-common/cmd_bmode.c: add imx bmode (bootmode) command
[karo-tx-uboot.git] / arch / arm / cpu / armv7 / mx6 / soc.c
index 84b458c7eb0d68863c03779dfcb3bf186f149a5c..7380ffe46c544c225d7d62afc0789512147e541f 100644 (file)
@@ -29,6 +29,7 @@
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
+#include <asm/imx-common/boot_mode.h>
 
 u32 get_cpu_rev(void)
 {
@@ -141,3 +142,38 @@ void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
 
 }
 #endif
+
+void boot_mode_apply(unsigned cfg_val)
+{
+       unsigned reg;
+       struct src_regs *psrc = (struct src_regs *)SRC_BASE_ADDR;
+       writel(cfg_val, &psrc->gpr9);
+       reg = readl(&psrc->gpr10);
+       if (cfg_val)
+               reg |= 1 << 28;
+       else
+               reg &= ~(1 << 28);
+       writel(reg, &psrc->gpr10);
+}
+/*
+ * 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 copy GPR9[25:0]
+ * to SBMR1, which will determine the boot device.
+ */
+const struct boot_mode soc_boot_modes[] = {
+       {"normal",      MAKE_CFGVAL(0x00, 0x00, 0x00, 0x00)},
+       /* reserved value should start rom usb */
+       {"usb",         MAKE_CFGVAL(0x01, 0x00, 0x00, 0x00)},
+       {"sata",        MAKE_CFGVAL(0x20, 0x00, 0x00, 0x00)},
+       {"escpi1:0",    MAKE_CFGVAL(0x30, 0x00, 0x00, 0x08)},
+       {"escpi1:1",    MAKE_CFGVAL(0x30, 0x00, 0x00, 0x18)},
+       {"escpi1:2",    MAKE_CFGVAL(0x30, 0x00, 0x00, 0x28)},
+       {"escpi1:3",    MAKE_CFGVAL(0x30, 0x00, 0x00, 0x38)},
+       /* 4 bit bus width */
+       {"esdhc1",      MAKE_CFGVAL(0x40, 0x20, 0x00, 0x00)},
+       {"esdhc2",      MAKE_CFGVAL(0x40, 0x28, 0x00, 0x00)},
+       {"esdhc3",      MAKE_CFGVAL(0x40, 0x30, 0x00, 0x00)},
+       {"esdhc4",      MAKE_CFGVAL(0x40, 0x38, 0x00, 0x00)},
+       {NULL,          0},
+};