summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/arm/include/asm/arch-mx6/imx-regs.h5
-rw-r--r--common/main.c16
-rw-r--r--include/configs/mx6qsabre_common.h11
3 files changed, 32 insertions, 0 deletions
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h
index 4d97065..0a842a4 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -753,5 +753,10 @@ struct wdog_regs {
extern void check_cpu_temperature(void);
+/* If ROM fail back to USB recover mode, USBPH0_PWD will be clear to use USB
+ * If boot from the other mode, USB0_PWD will keep reset value
+ */
+#define is_boot_from_usb(void) (!(readl(USB_PHY0_BASE_ADDR) & (1<<20)))
+
#endif /* __ASSEMBLER__*/
#endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */
diff --git a/common/main.c b/common/main.c
index a15f020..94b3fa3 100644
--- a/common/main.c
+++ b/common/main.c
@@ -437,6 +437,15 @@ void main_loop (void)
s = getenv ("bootdelay");
bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
+#ifdef is_boot_from_usb
+ if (is_boot_from_usb()) {
+ printf("Boot from USB for mfgtools\n");
+ bootdelay = 0;
+ set_default_env("Use default environment for mfgtools\n");
+ } else {
+ printf("Normal Boot\n");
+ }
+#endif
debug ("### main_loop entered: bootdelay=%d\n\n", bootdelay);
#if defined(CONFIG_MENU_SHOW)
@@ -461,6 +470,13 @@ void main_loop (void)
else
#endif /* CONFIG_BOOTCOUNT_LIMIT */
s = getenv ("bootcmd");
+#ifdef is_boot_from_usb
+ if (is_boot_from_usb()) {
+ s = getenv("bootcmd_mfg");
+ printf("Run bootcmd_mfg: %s\n", s);
+ }
+#endif
+
#ifdef CONFIG_OF_CONTROL
/* Allow the fdt to override the boot command */
env = fdtdec_get_config_string(gd->fdt_blob, "bootcmd");
diff --git a/include/configs/mx6qsabre_common.h b/include/configs/mx6qsabre_common.h
index e2795cc..f3a7dae 100644
--- a/include/configs/mx6qsabre_common.h
+++ b/include/configs/mx6qsabre_common.h
@@ -101,6 +101,14 @@
#define CONFIG_SYS_TEXT_BASE 0x17800000
#define CONFIG_SYS_MMC_IMG_LOAD_PART 1
+#define CONFIG_MFG_ENV_SETTINGS \
+ "mfgtool_args=setenv bootargs console=${console},${baudrate} " \
+ "rdinit=/linuxrc " \
+ "enable_wait_mode=off \0"\
+ "initrd_addr=0x12C00000\0" \
+ "bootcmd_mfg=run mfgtool_args;bootm ${loadaddr} ${initrd_addr} ${fdt_addr};\0" \
+
+
#if defined(CONFIG_SYS_BOOT_NAND)
/*
* The partions' layout for NAND is:
@@ -110,6 +118,7 @@
* mtd3: left (rootfs)
*/
#define CONFIG_EXTRA_ENV_SETTINGS \
+ CONFIG_MFG_ENV_SETTINGS \
"fdt_addr=0x18000000\0" \
"fdt_high=0xffffffff\0" \
"bootargs=console=" CONFIG_CONSOLE_DEV ",115200 ubi.mtd=3 " \
@@ -122,6 +131,7 @@
#elif defined(CONFIG_SYS_BOOT_SATA)
#define CONFIG_EXTRA_ENV_SETTINGS \
+ CONFIG_MFG_ENV_SETTINGS \
"fdt_addr=0x18000000\0" \
"fdt_high=0xffffffff\0" \
"bootargs=console=" CONFIG_CONSOLE_DEV ",115200 \0"\
@@ -134,6 +144,7 @@
"bootcmd=run bootcmd_sata \0"
#else
#define CONFIG_EXTRA_ENV_SETTINGS \
+ CONFIG_MFG_ENV_SETTINGS \
"script=boot.scr\0" \
"uimage=uImage\0" \
"fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \