diff options
author | Ye Li <ye.li@nxp.com> | 2016-02-24 17:38:54 +0800 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2017-04-05 14:04:36 +0800 |
commit | b18995387375111011612aa1e47d203733d16d14 (patch) | |
tree | d7fb0cdab2870ae689da9dd074cc2c69e5cb0f6b | |
parent | 7e43357e93c2aff021f9d41b4bd4f666ec0402a7 (diff) | |
download | u-boot-imx-b18995387375111011612aa1e47d203733d16d14.zip u-boot-imx-b18995387375111011612aa1e47d203733d16d14.tar.gz u-boot-imx-b18995387375111011612aa1e47d203733d16d14.tar.bz2 |
MLK-12444-1 mfgtool: Add mfgtool support
If boot from usb, reset environment to default value.
Auto apply mfgtools setting and boot mfgtools kernel.
Porting this from fsl uboot to uboot 2016.
The 7dsabresd has already added the environment and usb boot
related functions. No need to add them more. Only need to add
NAND parts environment for mfgtools.
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit a352ed3c5184b95c4c9f7468f5fbb5f43de5e412)
-rw-r--r-- | arch/arm/include/asm/arch-mx6/imx-regs.h | 7 | ||||
-rw-r--r-- | common/autoboot.c | 23 | ||||
-rw-r--r-- | include/configs/mx6qsabreauto.h | 10 | ||||
-rw-r--r-- | include/configs/mx6sabre_common.h | 22 | ||||
-rw-r--r-- | include/configs/mx6slevk.h | 13 | ||||
-rw-r--r-- | include/configs/mx6sxsabreauto.h | 21 | ||||
-rw-r--r-- | include/configs/mx6sxsabresd.h | 13 | ||||
-rw-r--r-- | include/configs/mx6ul_14x14_evk.h | 22 | ||||
-rw-r--r-- | include/configs/mx7dsabresd.h | 7 |
9 files changed, 137 insertions, 1 deletions
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h index 177ce66..3bdca27 100644 --- a/arch/arm/include/asm/arch-mx6/imx-regs.h +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h @@ -1091,5 +1091,12 @@ struct dbg_monitor_regs { u32 version[4]; /* Version */ }; +/* + * 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))) +#define disconnect_from_pc(void) writel(0x0, OTG_BASE_ADDR + 0x140) + #endif /* __ASSEMBLER__*/ #endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */ diff --git a/common/autoboot.c b/common/autoboot.c index c52bad8..b9a0fa9 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -15,6 +15,10 @@ #include <post.h> #include <u-boot/sha256.h> +#ifdef is_boot_from_usb +#include <environment.h> +#endif + DECLARE_GLOBAL_DATA_PTR; #define MAX_DELAY_STOP_STR 32 @@ -307,6 +311,18 @@ 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()) { + disconnect_from_pc(); + 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); @@ -333,6 +349,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/include/configs/mx6qsabreauto.h b/include/configs/mx6qsabreauto.h index ef7675c..171fdb2 100644 --- a/include/configs/mx6qsabreauto.h +++ b/include/configs/mx6qsabreauto.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Freescale Semiconductor, Inc. + * Copyright (C) 2012-2016 Freescale Semiconductor, Inc. * * Configuration settings for the Freescale i.MX6Q SabreAuto board. * @@ -29,6 +29,14 @@ #include "mx6sabre_common.h" +#undef MFG_NAND_PARTITION +#ifdef CONFIG_SYS_BOOT_NAND +#define MFG_NAND_PARTITION "mtdparts=8000000.nor:1m(boot),-(rootfs)\\\\;gpmi-nand:64m(boot),16m(kernel),16m(dtb),1m(misc),-(rootfs) " +#else +#define MFG_NAND_PARTITION "" +#endif + +#define CONFIG_MTD_NOR_FLASH #define CONFIG_SYS_FLASH_BASE WEIM_ARB_BASE_ADDR #define CONFIG_SYS_FLASH_SECT_SIZE (128 * 1024) #define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max number of memory banks */ diff --git a/include/configs/mx6sabre_common.h b/include/configs/mx6sabre_common.h index 9b0eded..1e00eef 100644 --- a/include/configs/mx6sabre_common.h +++ b/include/configs/mx6sabre_common.h @@ -42,6 +42,27 @@ /* Command definition */ #define CONFIG_CMD_BMODE +#ifdef CONFIG_SYS_BOOT_NAND +#define MFG_NAND_PARTITION "mtdparts=gpmi-nand:64m(boot),16m(kernel),16m(dtb),1m(misc),-(rootfs) " +#else +#define MFG_NAND_PARTITION "" +#endif + +#define CONFIG_MFG_ENV_SETTINGS \ + "mfgtool_args=setenv bootargs console=" CONSOLE_DEV ",115200 " \ + "rdinit=/linuxrc " \ + "g_mass_storage.stall=0 g_mass_storage.removable=1 " \ + "g_mass_storage.file=/fat g_mass_storage.ro=1 " \ + "g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF "\ + "g_mass_storage.iSerialNumber=\"\" "\ + "enable_wait_mode=off "\ + MFG_NAND_PARTITION \ + "\0" \ + "initrd_addr=0x12C00000\0" \ + "initrd_high=0xffffffff\0" \ + "bootcmd_mfg=run mfgtool_args;bootz ${loadaddr} ${initrd_addr} ${fdt_addr};\0" \ + + #ifdef CONFIG_SUPPORT_EMMC_BOOT #define EMMC_ENV \ "emmcdev=2\0" \ @@ -65,6 +86,7 @@ #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG #define CONFIG_EXTRA_ENV_SETTINGS \ + CONFIG_MFG_ENV_SETTINGS \ "epdc_waveform=epdc_splash.bin\0" \ "script=boot.scr\0" \ "image=zImage\0" \ diff --git a/include/configs/mx6slevk.h b/include/configs/mx6slevk.h index 7131389..f99ad44 100644 --- a/include/configs/mx6slevk.h +++ b/include/configs/mx6slevk.h @@ -49,7 +49,20 @@ #define CONFIG_PHYLIB #define CONFIG_PHY_SMSC +#define CONFIG_MFG_ENV_SETTINGS \ + "mfgtool_args=setenv bootargs console=${console},${baudrate} " \ + "rdinit=/linuxrc " \ + "g_mass_storage.stall=0 g_mass_storage.removable=1 " \ + "g_mass_storage.file=/fat g_mass_storage.ro=1 " \ + "g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF "\ + "g_mass_storage.iSerialNumber=\"\" "\ + "\0" \ + "initrd_addr=0x83800000\0" \ + "initrd_high=0xffffffff\0" \ + "bootcmd_mfg=run mfgtool_args;bootz ${loadaddr} ${initrd_addr} ${fdt_addr};\0" \ + #define CONFIG_EXTRA_ENV_SETTINGS \ + CONFIG_MFG_ENV_SETTINGS \ "epdc_waveform=epdc_splash.bin\0" \ "script=boot.scr\0" \ "image=zImage\0" \ diff --git a/include/configs/mx6sxsabreauto.h b/include/configs/mx6sxsabreauto.h index 0f1ce4d..27569ab 100644 --- a/include/configs/mx6sxsabreauto.h +++ b/include/configs/mx6sxsabreauto.h @@ -19,7 +19,28 @@ #define CONFIG_MXC_UART #define CONFIG_MXC_UART_BASE UART1_BASE +#ifdef CONFIG_SYS_BOOT_NAND +#define MFG_NAND_PARTITION "mtdparts=gpmi-nand:64m(boot),16m(kernel),16m(dtb),1m(misc),-(rootfs) " +#else +#define MFG_NAND_PARTITION "" +#endif + +#define CONFIG_MFG_ENV_SETTINGS \ + "mfgtool_args=setenv bootargs console=${console},${baudrate} " \ + "rdinit=/linuxrc " \ + "g_mass_storage.stall=0 g_mass_storage.removable=1 " \ + "g_mass_storage.file=/fat g_mass_storage.ro=1 " \ + "g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF "\ + "g_mass_storage.iSerialNumber=\"\" "\ + MFG_NAND_PARTITION \ + "\0" \ + "initrd_addr=0x83800000\0" \ + "initrd_high=0xffffffff\0" \ + "bootcmd_mfg=run mfgtool_args;bootz ${loadaddr} ${initrd_addr} ${fdt_addr};\0" \ + + #define CONFIG_EXTRA_ENV_SETTINGS \ + CONFIG_MFG_ENV_SETTINGS \ "script=boot.scr\0" \ "image=zImage\0" \ "console=ttymxc0\0" \ diff --git a/include/configs/mx6sxsabresd.h b/include/configs/mx6sxsabresd.h index 639d39f..f1b4974 100644 --- a/include/configs/mx6sxsabresd.h +++ b/include/configs/mx6sxsabresd.h @@ -43,7 +43,20 @@ #define UPDATE_M4_ENV "" #endif +#define CONFIG_MFG_ENV_SETTINGS \ + "mfgtool_args=setenv bootargs console=${console},${baudrate} " \ + "rdinit=/linuxrc " \ + "g_mass_storage.stall=0 g_mass_storage.removable=1 " \ + "g_mass_storage.file=/fat g_mass_storage.ro=1 " \ + "g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF "\ + "g_mass_storage.iSerialNumber=\"\" "\ + "\0" \ + "initrd_addr=0x83800000\0" \ + "initrd_high=0xffffffff\0" \ + "bootcmd_mfg=run mfgtool_args;bootz ${loadaddr} ${initrd_addr} ${fdt_addr};\0" \ + #define CONFIG_EXTRA_ENV_SETTINGS \ + CONFIG_MFG_ENV_SETTINGS \ UPDATE_M4_ENV \ "script=boot.scr\0" \ "image=zImage\0" \ diff --git a/include/configs/mx6ul_14x14_evk.h b/include/configs/mx6ul_14x14_evk.h index 2f98b02..9eae349 100644 --- a/include/configs/mx6ul_14x14_evk.h +++ b/include/configs/mx6ul_14x14_evk.h @@ -67,7 +67,29 @@ #define CONFIG_SYS_MMC_IMG_LOAD_PART 1 +#ifdef CONFIG_SYS_BOOT_NAND +#define MFG_NAND_PARTITION "mtdparts=gpmi-nand:64m(boot),16m(kernel),16m(dtb),1m(misc),-(rootfs) " +#else +#define MFG_NAND_PARTITION "" +#endif + +#define CONFIG_MFG_ENV_SETTINGS \ + "mfgtool_args=setenv bootargs console=${console},${baudrate} " \ + BOOTARGS_CMA_SIZE \ + "rdinit=/linuxrc " \ + "g_mass_storage.stall=0 g_mass_storage.removable=1 " \ + "g_mass_storage.file=/fat g_mass_storage.ro=1 " \ + "g_mass_storage.idVendor=0x066F g_mass_storage.idProduct=0x37FF "\ + "g_mass_storage.iSerialNumber=\"\" "\ + MFG_NAND_PARTITION \ + "clk_ignore_unused "\ + "\0" \ + "initrd_addr=0x83800000\0" \ + "initrd_high=0xffffffff\0" \ + "bootcmd_mfg=run mfgtool_args;bootz ${loadaddr} ${initrd_addr} ${fdt_addr};\0" \ + #define CONFIG_EXTRA_ENV_SETTINGS \ + CONFIG_MFG_ENV_SETTINGS \ "script=boot.scr\0" \ "image=zImage\0" \ "console=ttymxc0\0" \ diff --git a/include/configs/mx7dsabresd.h b/include/configs/mx7dsabresd.h index 81d769f..cd2f1dc 100644 --- a/include/configs/mx7dsabresd.h +++ b/include/configs/mx7dsabresd.h @@ -75,12 +75,19 @@ #define UPDATE_M4_ENV "" #endif +#ifdef CONFIG_SYS_BOOT_NAND +#define MFG_NAND_PARTITION "mtdparts=gpmi-nand:64m(boot),16m(kernel),16m(dtb),1m(misc),-(rootfs) " +#else +#define MFG_NAND_PARTITION "" +#endif + #define CONFIG_MFG_ENV_SETTINGS \ "mfgtool_args=setenv bootargs console=${console},${baudrate} " \ "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=\"\" "\ + MFG_NAND_PARTITION \ "clk_ignore_unused "\ "\0" \ "initrd_addr=0x83800000\0" \ |