diff options
-rw-r--r-- | arch/arm/include/asm/arch-mx6/imx-regs.h | 7 | ||||
-rw-r--r-- | common/autoboot.c | 22 | ||||
-rw-r--r-- | common/main.c | 4 | ||||
-rw-r--r-- | include/configs/mx6sabre_common.h | 19 |
4 files changed, 52 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 f572c7b..20273e4 100644 --- a/arch/arm/include/asm/arch-mx6/imx-regs.h +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h @@ -1154,4 +1154,11 @@ extern void vadc_power_down(void); #endif #endif /* __ASSEMBLER__*/ + +/* + * 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 /* __ASM_ARCH_MX6_IMX_REGS_H__ */ diff --git a/common/autoboot.c b/common/autoboot.c index c27cc2c..f5184a0 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -13,6 +13,10 @@ #include <menu.h> #include <post.h> +#ifdef is_boot_from_usb +#include <environment.h> +#endif + DECLARE_GLOBAL_DATA_PTR; #define MAX_DELAY_STOP_STR 32 @@ -246,6 +250,17 @@ const char *bootdelay_process(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 + #ifdef CONFIG_OF_CONTROL bootdelay = fdtdec_get_config_int(gd->fdt_blob, "bootdelay", bootdelay); @@ -272,6 +287,13 @@ const char *bootdelay_process(void) #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 + process_fdt_options(gd->fdt_blob); stored_bootdelay = bootdelay; diff --git a/common/main.c b/common/main.c index 2979fbe..62ab1ac 100644 --- a/common/main.c +++ b/common/main.c @@ -12,6 +12,10 @@ #include <cli.h> #include <version.h> +#ifdef is_boot_from_usb +#include <environment.h> +#endif + DECLARE_GLOBAL_DATA_PTR; /* diff --git a/include/configs/mx6sabre_common.h b/include/configs/mx6sabre_common.h index 1b4ec5b..e4165c2 100644 --- a/include/configs/mx6sabre_common.h +++ b/include/configs/mx6sabre_common.h @@ -100,6 +100,24 @@ #define CONFIG_LOADADDR 0x12000000 #define CONFIG_SYS_TEXT_BASE 0x17800000 +#ifdef CONFIG_SYS_BOOT_NAND +#define CONFIG_MFG_NAND_PARTITION "mtdparts=gpmi-nand:16m(boot),16m(kernel),16m(dtb),-(rootfs) " +#else +#define CONFIG_MFG_NAND_PARTITION "" +#endif + +#define CONFIG_MFG_ENV_SETTINGS \ + "mfgtool_args=setenv bootargs console=" CONFIG_CONSOLE_DEV ",115200 " \ + "rdinit=/linuxrc " \ + "g_mass_storage.stall=0 g_mass_storage.removable=1 " \ + "g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF "\ + "g_mass_storage.iSerialNumber=\"\" "\ + "enable_wait_mode=off "\ + CONFIG_MFG_NAND_PARTITION \ + "\0" \ + "initrd_addr=0x12C00000\0" \ + "initrd_high=0xffffffff\0" \ + "bootcmd_mfg=run mfgtool_args;bootm ${loadaddr} ${initrd_addr} ${fdt_addr};\0" \ #ifdef CONFIG_SUPPORT_EMMC_BOOT #define EMMC_ENV \ @@ -122,6 +140,7 @@ #endif #define CONFIG_EXTRA_ENV_SETTINGS \ + CONFIG_MFG_ENV_SETTINGS \ "script=boot.scr\0" \ "image=zImage\0" \ "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \ |