From 4d9a8f7ce4d549cecddbcfebf63b89dc66beb3a2 Mon Sep 17 00:00:00 2001 From: Manel Caro Date: Fri, 26 Jan 2018 13:45:32 +0100 Subject: Added env variables --- include/configs/igep0046.h | 304 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 301 insertions(+), 3 deletions(-) diff --git a/include/configs/igep0046.h b/include/configs/igep0046.h index f54bebc..d6b61b9 100644 --- a/include/configs/igep0046.h +++ b/include/configs/igep0046.h @@ -22,8 +22,9 @@ /* UART Configs */ #define CONFIG_MXC_UART #define CONFIG_MXC_UART_BASE UART2_BASE -#define CONSOLE_DEV "ttymxc2" -#define CONFIG_BAUDRATE 115200 +#define CONSOLE_DEV "ttymxc2" + +#define CONFIG_BAUDRATE 115200 #define CONFIG_SYS_BAUDRATE_TABLE {9600, 19200, 38400, 57600, 115200} /* SOC specific Configs @@ -55,7 +56,7 @@ /* Miscellaneous configurable options */ #define CONFIG_AUTOBOOT_KEYED -#define CONFIG_AUTOBOOT_PROMPT "Press ESC to abort autoboot in 3 seconds\n" +#define CONFIG_AUTOBOOT_PROMPT "Press ESC to abort autoboot in %d seconds\n" #define CONFIG_AUTOBOOT_STOP_STR "\x1b" #define CONFIG_SYS_LONGHELP #define CONFIG_SYS_PROMPT_HUSH_PS2 "> " @@ -149,6 +150,303 @@ #define CONFIG_ENV_IS_IN_MMC #define CONFIG_SYS_MMC_ENV_DEV 0 +#ifdef CONFIG_SUPPORT_EMMC_BOOT +#define EMMC_ENV \ + "emmcdev=1\0" \ + "update_emmc_firmware=" \ + "if test ${ip_dyn} = yes; then " \ + "setenv get_cmd dhcp; " \ + "else " \ + "setenv get_cmd tftp; " \ + "fi; " \ + "if ${get_cmd} ${update_sd_firmware_filename}; then " \ + "if mmc dev ${emmcdev} 1; then " \ + "setexpr fw_sz ${filesize} / 0x200; " \ + "setexpr fw_sz ${fw_sz} + 1; " \ + "mmc write ${loadaddr} 0x2 ${fw_sz}; " \ + "fi; " \ + "fi\0" +#else +#define EMMC_ENV "" +#endif + +#ifndef VIDEO_ARGS +#define VIDEO_ARGS "" +#endif + +#ifndef VIDEO_ARGS_SCRIPT +#define VIDEO_ARGS_SCRIPT "" +#endif + +#if defined(CONFIG_MX6DL) +#define CONFIG_EXTRA_ENV_SETTINGS \ + "bootenv=uEnv.txt\0" \ + "image=zImage\0" \ + "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \ + "fdt_addr=0x18000000\0" \ + "boot_fdt=try\0" \ + "ip_dyn=no\0" \ + "console=" CONSOLE_DEV "\0" \ + "fdt_high=0xffffffff\0" \ + "initrd_high=0xffffffff\0" \ + "mmcdev=0\0" \ + "mmcpart=1\0" \ + "mmcroot="CONFIG_MMCROOT " rootwait rw\0" \ + "emmcroot="CONFIG_EMMCROOT " rootwait rw\0" \ + "emmcdevconf=setenv mmcdev ${emmcdev}\0" \ + "emmcrootconf=setenv mmcroot ${emmcroot}\0" \ + "update_sd_firmware=" \ + "if test ${ip_dyn} = yes; then " \ + "setenv get_cmd dhcp; " \ + "else " \ + "setenv get_cmd tftp; " \ + "fi; " \ + "if mmc dev ${mmcdev}; then " \ + "if ${get_cmd} ${update_sd_firmware_filename}; then " \ + "setexpr fw_sz ${filesize} / 0x200; " \ + "setexpr fw_sz ${fw_sz} + 1; " \ + "mmc write ${loadaddr} 0x2 ${fw_sz}; " \ + "fi; " \ + "fi\0" \ + EMMC_ENV \ + "video_args_hdmi=setenv video_args $video_args " \ + "video=mxcfb${fb}:dev=hdmi,1920x1080M@60,if=RGB24\0" \ + "video_args_lvds=setenv video_args $video_args " \ + "video=mxcfb${fb}:dev=ldb,1280x720M@60,if=RGB24\0" \ + "fb=0\0" \ + "video_interfaces=hdmi lvds\0" \ + "video_args_script=" \ + "for v in ${video_interfaces}; do " \ + "run video_args_${v}; " \ + "setexpr fb $fb + 1; " \ + "done\0" \ + "mmcargs=setenv bootargs console=${console},${baudrate} " \ + "root=${mmcroot} " \ + VIDEO_ARGS "\0" \ + "loadbootenv=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${bootenv}\0" \ + "importbootenv=echo Importing environment from mmc ...; " \ + "env import -t ${loadaddr} ${filesize}\0" \ + "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ + "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ + "mmcboot=echo Booting from mmc ...; " \ + VIDEO_ARGS_SCRIPT \ + "run mmcargs; " \ + "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ + "if run loadfdt; then " \ + "bootz ${loadaddr} - ${fdt_addr}; " \ + "else " \ + "if test ${boot_fdt} = try; then " \ + "bootz; " \ + "else " \ + "echo WARN: Cannot load the DT; " \ + "fi; " \ + "fi; " \ + "else " \ + "bootz; " \ + "fi;\0" \ + "netargs=setenv bootargs console=${console},${baudrate} " \ + "root=/dev/nfs " \ + "ip=dhcp nfsroot=${serverip}:${rootnfs},v3,tcp\0" \ + "netboot=echo Booting from net ...; " \ + "run netargs; " \ + "if test ${ip_dyn} = yes; then " \ + "setenv get_cmd dhcp; " \ + "else " \ + "setenv get_cmd tftp; " \ + "fi; " \ + "${get_cmd} ${image}; " \ + "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ + "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ + "bootz ${loadaddr} - ${fdt_addr}; " \ + "else " \ + "if test ${boot_fdt} = try; then " \ + "bootz; " \ + "else " \ + "echo WARN: Cannot load the DT; " \ + "fi; " \ + "fi; " \ + "else " \ + "bootz; " \ + "fi;\0" + +#define CONFIG_BOOTCOMMAND \ + "echo Try first mmc (SD)...; " \ + "mmc dev ${mmcdev};" \ + "if mmc rescan; then " \ + "if run loadbootenv; then " \ + "echo Loaded environment from ${bootenv};" \ + "run importbootenv;" \ + "fi;" \ + "if run loadimage; then " \ + "run mmcboot; " \ + "fi; " \ + "fi; " \ + "echo Try second mmc (eMMC)...; " \ + "run emmcdevconf;" \ + "run emmcrootconf;" \ + "mmc dev ${mmcdev};" \ + "if mmc rescan; then " \ + "if run loadbootenv; then " \ + "echo Loaded environment from ${bootenv};" \ + "run importbootenv;" \ + "fi;" \ + "if run loadimage; then " \ + "run mmcboot; " \ + "fi; " \ + "fi; " \ + "run netboot;" +#endif + +#if defined(CONFIG_MX6Q) +#define CONFIG_EXTRA_ENV_SETTINGS \ + "bootenv=uEnv.txt\0" \ + "image=zImage\0" \ + "fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \ + "fdt_addr=0x18000000\0" \ + "boot_fdt=try\0" \ + "ip_dyn=no\0" \ + "console=" CONFIG_CONSOLE_DEV "\0" \ + "fdt_high=0xffffffff\0" \ + "initrd_high=0xffffffff\0" \ + "mmcdev=0\0" \ + "mmcpart=1\0" \ + "mmcroot="CONFIG_MMCROOT " rootwait rw\0" \ + "emmcroot="CONFIG_EMMCROOT " rootwait rw\0" \ + "sataroot="CONFIG_SATAROOT " rootwait rw\0" \ + "emmcdevconf=setenv mmcdev ${emmcdev}\0" \ + "emmcrootconf=setenv mmcroot ${emmcroot}\0" \ + "update_sd_firmware=" \ + "if test ${ip_dyn} = yes; then " \ + "setenv get_cmd dhcp; " \ + "else " \ + "setenv get_cmd tftp; " \ + "fi; " \ + "if mmc dev ${mmcdev}; then " \ + "if ${get_cmd} ${update_sd_firmware_filename}; then " \ + "setexpr fw_sz ${filesize} / 0x200; " \ + "setexpr fw_sz ${fw_sz} + 1; " \ + "mmc write ${loadaddr} 0x2 ${fw_sz}; " \ + "fi; " \ + "fi\0" \ + EMMC_ENV \ + "video_args_hdmi=setenv video_args $video_args " \ + "video=mxcfb${fb}:dev=hdmi,1920x1080M@60,if=RGB24\0" \ + "video_args_lvds=setenv video_args $video_args " \ + "video=mxcfb${fb}:dev=ldb,1280x720M@60,if=RGB24\0" \ + "fb=0\0" \ + "video_interfaces=hdmi lvds\0" \ + "video_args_script=" \ + "for v in ${video_interfaces}; do " \ + "run video_args_${v}; " \ + "setexpr fb $fb + 1; " \ + "done\0" \ + "mmcargs=setenv bootargs console=${console},${baudrate} " \ + "root=${mmcroot} " \ + VIDEO_ARGS "\0" \ + "loadbootenv=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${bootenv}\0" \ + "importbootenv=echo Importing environment from mmc ...; " \ + "env import -t ${loadaddr} ${filesize}\0" \ + "loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}\0" \ + "loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \ + "mmcboot=echo Booting from mmc ...; " \ + VIDEO_ARGS_SCRIPT \ + "run mmcargs; " \ + "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ + "if run loadfdt; then " \ + "bootz ${loadaddr} - ${fdt_addr}; " \ + "else " \ + "if test ${boot_fdt} = try; then " \ + "bootz; " \ + "else " \ + "echo WARN: Cannot load the DT; " \ + "fi; " \ + "fi; " \ + "else " \ + "bootz; " \ + "fi;\0" \ + "sataargs=setenv bootargs console=${console},${baudrate} " \ + "root=${sataroot} " \ + VIDEO_ARGS "\0" \ + "loadimagesata=fatload sata 0:1 ${loadaddr} ${image}\0" \ + "loadfdtsata=fatload sata 0:1 ${fdt_addr} ${fdt_file}\0" \ + "sataboot=echo Booting from sata ...; " \ + VIDEO_ARGS_SCRIPT \ + "run sataargs; " \ + "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ + "if run loadfdtsata; then " \ + "bootz ${loadaddr} - ${fdt_addr}; " \ + "else " \ + "if run loadfdtsata; then " \ + "bootz ${loadaddr} - ${fdt_addr}; " \ + "else " \ + "if test ${boot_fdt} = try; then " \ + "bootz; " \ + "else " \ + "echo WARN: Cannot load the DT; " \ + "fi; " \ + "fi; " \ + "fi; " \ + "else " \ + "bootz; " \ + "fi;\0" \ + "netargs=setenv bootargs console=${console},${baudrate} " \ + "root=/dev/nfs " \ + "ip=dhcp nfsroot=${serverip}:${rootnfs},v3,tcp\0" \ + "netboot=echo Booting from net ...; " \ + "run netargs; " \ + "if test ${ip_dyn} = yes; then " \ + "setenv get_cmd dhcp; " \ + "else " \ + "setenv get_cmd tftp; " \ + "fi; " \ + "${get_cmd} ${image}; " \ + "if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \ + "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ + "bootz ${loadaddr} - ${fdt_addr}; " \ + "else " \ + "if test ${boot_fdt} = try; then " \ + "bootz; " \ + "else " \ + "echo WARN: Cannot load the DT; " \ + "fi; " \ + "fi; " \ + "else " \ + "bootz; " \ + "fi;\0" + +#define CONFIG_BOOTCOMMAND \ + "echo Try first mmc (SD)...; " \ + "mmc dev ${mmcdev};" \ + "if mmc rescan; then " \ + "if run loadbootenv; then " \ + "echo Loaded environment from ${bootenv};" \ + "run importbootenv;" \ + "fi;" \ + "if run loadimage; then " \ + "run mmcboot; " \ + "fi; " \ + "fi; " \ + "echo Try SATA...; " \ + "sata init; " \ + "if run loadimagesata; then " \ + "run sataboot; " \ + "fi; " \ + "echo Try second mmc (eMMC)...; " \ + "run emmcdevconf;" \ + "run emmcrootconf;" \ + "mmc dev ${mmcdev};" \ + "if mmc rescan; then " \ + "if run loadbootenv; then " \ + "echo Loaded environment from ${bootenv};" \ + "run importbootenv;" \ + "fi;" \ + "if run loadimage; then " \ + "run mmcboot; " \ + "fi; " \ + "fi; " \ + "run netboot;" +#endif + #endif /* __IGEP0046_CONFIG_H */ -- cgit v1.1