env: Use include/env for text-environment includes

The 'environment' word is too long. We mostly use 'env' in U-Boot, so use
that as the name of the include directory too.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> # Intel Edison
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff --git a/include/env/distro/sf.h b/include/env/distro/sf.h
new file mode 100644
index 0000000..ee48a8a
--- /dev/null
+++ b/include/env/distro/sf.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2020 Amarula Solutions(India)
+ *
+ * SF distro configurations.
+ */
+
+#ifndef __DISTRO_SF_CONFIG_H
+#define __DISTRO_SF_CONFIG_H
+
+#if IS_ENABLED(CONFIG_CMD_SF)
+#define BOOTENV_SHARED_SF(devtypel)				\
+	#devtypel "_boot="					\
+	"if " #devtypel " probe ${busnum}; then "		\
+		"devtype=" #devtypel "; "			\
+		"run scan_sf_for_scripts; "			\
+	"fi\0"
+#define BOOTENV_DEV_SF(devtypeu, devtypel, instance)		\
+	"bootcmd_" #devtypel #instance "="			\
+		"busnum=" #instance "; "			\
+		"run " #devtypel "_boot\0"
+#define BOOTENV_DEV_NAME_SF(devtypeu, devtypel, instance)	\
+	#devtypel #instance " "
+#else
+#define BOOTENV_SHARED_SF(devtypel)
+#define BOOTENV_DEV_SF \
+	BOOT_TARGET_DEVICES_references_SF_without_CONFIG_CMD_SF
+#define BOOTENV_DEV_NAME_SF \
+	BOOT_TARGET_DEVICES_references_SF_without_CONFIG_CMD_SF
+
+#endif /* CONFIG_CMD_SF */
+
+#define BOOTENV_SF \
+	BOOTENV_SHARED_SF(sf) \
+	"scan_sf_for_scripts="					\
+		"${devtype} read ${scriptaddr} "		\
+			"${script_offset_f} ${script_size_f}; "	\
+		"source ${scriptaddr}; "			\
+		"echo SCRIPT FAILED: continuing...\0"
+
+#endif /* __DISTRO_SF_CONFIG_H */
diff --git a/include/env/pg-wcom/common.env b/include/env/pg-wcom/common.env
new file mode 100644
index 0000000..4b660ce
--- /dev/null
+++ b/include/env/pg-wcom/common.env
@@ -0,0 +1,68 @@
+
+#ifndef WCOM_UBI_PARTITION_APP
+/* one flash chip only called boot */
+# define WCOM_UBI_LINUX_MTD	ubi.mtd=ubi0
+ubiattach=ubi part ubi0
+#else /* WCOM_UBI_PARTITION_APP */
+/* two flash chips called boot and app */
+# define WCOM_UBI_LINUX_MTD	ubi.mtd=ubi0 ubi.mtd=ubi1
+ubiattach=if test ${boot_bank} -eq 0;
+          then;
+		ubi part ubi0;
+	  else;
+		ubi part ubi1;
+	  fi
+#endif /* WCOMC_UBI_PARTITION_APP */
+
+actual_bank=0
+
+add_default=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off:
+		console=ttyS0,${baudrate} mem=${kernelmem} init=${init}
+		phram.phram=phvar,${varaddr},CONFIG_KM_PHRAM
+		WCOM_UBI_LINUX_MTD
+
+addpanic=setenv bootargs ${bootargs} panic=1 panic_on_oops=1
+altbootcmd=run bootcmd
+backup_bank=0
+boot=bootm ${load_addr_r} - ${fdt_addr_r}
+
+bootcmd=km_checkbidhwk &&
+	setenv bootcmd 'if km_checktestboot;
+			then;
+				setenv boot_bank ${test_bank};
+			else;
+				setenv boot_bank ${actual_bank};
+			fi;
+			run ${subbootcmds}; reset' &&
+	setenv altbootcmd 'setenv boot_bank ${backup_bank};
+			   run ${subbootcmds};
+			   reset' &&
+	saveenv &&
+	saveenv &&
+	boot
+
+cramfsaddr=CONFIG_KM_CRAMFS_ADDR
+cramfsloadfdt=cramfsload ${fdt_addr_r} fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb
+cramfsloadkernel=cramfsload ${load_addr_r} ${uimage}
+
+develop=tftp ${load_addr_r} scripts/develop-${arch}.txt &&
+	env import -t ${load_addr_r} ${filesize} &&
+	run setup_debug_env
+
+env_version=1
+fdt_addr_r=CONFIG_KM_FDT_ADDR
+flashargs=setenv bootargs root=mtdblock:rootfs${boot_bank} rootfstype=squashfs ro
+init=/sbin/init-overlay.sh
+load=tftpboot ${load_addr_r} ${hostname}/u-boot.bin
+load_addr_r=CONFIG_KM_KERNEL_ADDR
+pnvramsize=CONFIG_KM_PNVRAM
+
+ramfs=tftp ${load_addr_r} scripts/ramfs-${arch}.txt &&
+      env import -t ${load_addr_r} ${filesize} &&
+      run setup_debug_env
+
+release=run newenv; reset
+subbootcmds=ubiattach ubicopy checkfdt cramfsloadfdt set_fdthigh
+                      cramfsloadkernel flashargs add_default addpanic boot
+testbootcmd=setenv boot_bank ${test_bank}; run ${subbootcmds}; reset
+ubicopy=ubi read ${cramfsaddr} bootfs${boot_bank}
diff --git a/include/env/pg-wcom/ls102xa.env b/include/env/pg-wcom/ls102xa.env
new file mode 100644
index 0000000..abbec42
--- /dev/null
+++ b/include/env/pg-wcom/ls102xa.env
@@ -0,0 +1,29 @@
+#define WCOM_UBI_PARTITION_APP
+
+#include <env/pg-wcom/common.env>
+
+EEprom_ivm=pca9547:70:9
+boot=bootm $load_addr_r - $fdt_addr_r
+checkfdt=true
+cramfsloadfdt=cramfsload $fdt_addr_r fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb
+ethrotate=no
+hwconfig=devdis:esdhc,usb3,usb2,sata,sec,dcu,duart2,qspi,can1,can2_4,ftm2_8,i2c2_3,sai1_4,lpuart2_6,asrc,spdif,lpuart1,ftm1
+netdev=eth2
+
+newenv=protect off CONFIG_ENV_ADDR_REDUND +0x40000 &&
+       erase CONFIG_ENV_ADDR_REDUND +0x40000 &&
+       protect on CONFIG_ENV_ADDR_REDUND +0x40000
+
+set_fdthigh=true
+
+update=protect off CONFIG_SYS_MONITOR_BASE +${filesize} &&
+       erase CONFIG_SYS_MONITOR_BASE +${filesize} &&
+       cp.b ${load_addr_r} CONFIG_SYS_MONITOR_BASE ${filesize} &&
+       protect on CONFIG_SYS_MONITOR_BASE +${filesize}
+
+update-nor=protect off CONFIG_SYS_FLASH_BASE +${filesize} &&
+	   erase CONFIG_SYS_FLASH_BASE +${filesize} &&
+	   cp.b ${load_addr_r} CONFIG_SYS_FLASH_BASE ${filesize} &&
+	   protect on CONFIG_SYS_MONITOR_BASE +0x100000
+
+uimage=uImage
diff --git a/include/env/pg-wcom/powerpc.env b/include/env/pg-wcom/powerpc.env
new file mode 100644
index 0000000..744c073
--- /dev/null
+++ b/include/env/pg-wcom/powerpc.env
@@ -0,0 +1,16 @@
+#define BOOTFLASH_START 0xF0000000
+
+arch=ppc_82xx
+bootm_mapsize=CONFIG_SYS_BOOTM_LEN
+checkfdt=true
+set_fdthigh=true
+
+update=protect off BOOTFLASH_START +${filesize} &&
+       erase BOOTFLASH_START +${filesize} &&
+       cp.b ${load_addr_r} BOOTFLASH_START ${filesize} &&
+       protect on BOOTFLASH_START +${filesize}
+
+newenv=prot off CONFIG_ENV_ADDR +0x40000 &&
+       era CONFIG_ENV_ADDR +0x40000
+
+unlock=yes
diff --git a/include/env/ti/dfu.h b/include/env/ti/dfu.h
new file mode 100644
index 0000000..3c90570
--- /dev/null
+++ b/include/env/ti/dfu.h
@@ -0,0 +1,81 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Environment variable definitions for DFU on TI boards.
+ */
+
+#ifndef __TI_DFU_H
+#define __TI_DFU_H
+
+#define DFU_ALT_INFO_MMC \
+	"dfu_alt_info_mmc=" \
+	"boot part 0 1;" \
+	"rootfs part 0 2;" \
+	"MLO fat 0 1;" \
+	"MLO.raw raw 0x100 0x200;" \
+	"u-boot.img.raw raw 0x300 0x1000;" \
+	"u-env.raw raw 0x1300 0x200;" \
+	"spl-os-args.raw raw 0x1500 0x200;" \
+	"spl-os-image.raw raw 0x1700 0x6900;" \
+	"spl-os-args fat 0 1;" \
+	"spl-os-image fat 0 1;" \
+	"u-boot.img fat 0 1;" \
+	"uEnv.txt fat 0 1\0"
+
+#define DFU_ALT_INFO_EMMC \
+	"dfu_alt_info_emmc=" \
+	"rawemmc raw 0 3751936;" \
+	"boot part 1 1;" \
+	"rootfs part 1 2;" \
+	"MLO fat 1 1;" \
+	"MLO.raw raw 0x100 0x200;" \
+	"u-boot.img.raw raw 0x300 0x1000;" \
+	"u-env.raw raw 0x1300 0x200;" \
+	"spl-os-args.raw raw 0x1500 0x200;" \
+	"spl-os-image.raw raw 0x1700 0x6900;" \
+	"spl-os-args fat 1 1;" \
+	"spl-os-image fat 1 1;" \
+	"u-boot.img fat 1 1;" \
+	"uEnv.txt fat 1 1\0"
+
+#ifdef CONFIG_MTD_RAW_NAND
+#define DFU_ALT_INFO_NAND \
+	"dfu_alt_info_nand=" \
+	"SPL part 0 1;" \
+	"SPL.backup1 part 0 2;" \
+	"SPL.backup2 part 0 3;" \
+	"SPL.backup3 part 0 4;" \
+	"u-boot part 0 5;" \
+	"u-boot-spl-os part 0 6;" \
+	"kernel part 0 8;" \
+	"rootfs part 0 9\0"
+#else
+#define DFU_ALT_INFO_NAND ""
+#endif
+
+#define DFU_ALT_INFO_RAM \
+	"dfu_alt_info_ram=" \
+	"kernel ram 0x80200000 0x4000000;" \
+	"fdt ram 0x80f80000 0x80000;" \
+	"ramdisk ram 0x81000000 0x4000000\0"
+
+#define DFU_ALT_INFO_QSPI_XIP \
+	"dfu_alt_info_qspi=" \
+	"u-boot.bin raw 0x0 0x080000;" \
+	"u-boot.backup raw 0x080000 0x080000;" \
+	"u-boot-spl-os raw 0x100000 0x010000;" \
+	"u-boot-env raw 0x110000 0x010000;" \
+	"u-boot-env.backup raw 0x120000 0x010000;" \
+	"kernel raw 0x130000 0x800000\0"
+
+#define DFU_ALT_INFO_QSPI \
+	"dfu_alt_info_qspi=" \
+	"MLO raw 0x0 0x040000;" \
+	"u-boot.img raw 0x040000 0x0100000;" \
+	"u-boot-spl-os raw 0x140000 0x080000;" \
+	"u-boot-env raw 0x1C0000 0x010000;" \
+	"u-boot-env.backup raw 0x1D0000 0x010000;" \
+	"kernel raw 0x1E0000 0x800000\0"
+
+#endif /* __TI_DFU_H */
diff --git a/include/env/ti/k3_dfu.env b/include/env/ti/k3_dfu.env
new file mode 100644
index 0000000..2015296
--- /dev/null
+++ b/include/env/ti/k3_dfu.env
@@ -0,0 +1,30 @@
+dfu_alt_info_mmc=
+	boot part 1 1;
+	rootfs part 1 2;
+	tiboot3.bin fat 1 1;
+	tispl.bin fat 1 1;
+	u-boot.img fat 1 1;
+	uEnv.txt fat 1 1;
+	sysfw.itb fat 1 1
+
+dfu_alt_info_emmc=
+	rawemmc raw 0 0x800000 mmcpart 1;
+	rootfs part 0 1 mmcpart 0;
+	tiboot3.bin.raw raw 0x0 0x400 mmcpart 1;
+	tispl.bin.raw raw 0x400 0x1000 mmcpart 1;
+	u-boot.img.raw raw 0x1400 0x2000 mmcpart 1;
+	u-env.raw raw 0x3400 0x100 mmcpart 1;
+	sysfw.itb.raw raw 0x3600 0x800 mmcpart 1
+
+dfu_alt_info_ospi=
+	tiboot3.bin raw 0x0 0x080000;
+	tispl.bin raw 0x080000 0x200000;
+	u-boot.img raw 0x280000 0x400000;
+	u-boot-env raw 0x680000 0x020000;
+	sysfw.itb raw 0x6c0000 0x100000;
+	rootfs raw 0x800000 0x3800000
+
+dfu_alt_info_ram=
+	tispl.bin ram 0x80080000 0x200000;
+	u-boot.img ram 0x81000000 0x400000
+
diff --git a/include/env/ti/k3_dfu.h b/include/env/ti/k3_dfu.h
new file mode 100644
index 0000000..a16a3ad
--- /dev/null
+++ b/include/env/ti/k3_dfu.h
@@ -0,0 +1,46 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Environment variable definitions for DFU on TI K3 SoCs.
+ *
+ */
+
+#ifndef __TI_DFU_H
+#define __TI_DFU_H
+
+#define DFU_ALT_INFO_MMC \
+	"dfu_alt_info_mmc=" \
+	"boot part 1 1;" \
+	"rootfs part 1 2;" \
+	"tiboot3.bin fat 1 1;" \
+	"tispl.bin fat 1 1;" \
+	"u-boot.img fat 1 1;" \
+	"uEnv.txt fat 1 1;" \
+	"sysfw.itb fat 1 1\0"
+
+#define DFU_ALT_INFO_EMMC \
+	"dfu_alt_info_emmc=" \
+	"rawemmc raw 0 0x800000 mmcpart 1;" \
+	"rootfs part 0 1 mmcpart 0;" \
+	"tiboot3.bin.raw raw 0x0 0x400 mmcpart 1;" \
+	"tispl.bin.raw raw 0x400 0x1000 mmcpart 1;" \
+	"u-boot.img.raw raw 0x1400 0x2000 mmcpart 1;" \
+	"u-env.raw raw 0x3400 0x100 mmcpart 1;" \
+	"sysfw.itb.raw raw 0x3600 0x800 mmcpart 1\0"
+
+#define DFU_ALT_INFO_OSPI \
+	"dfu_alt_info_ospi=" \
+	"tiboot3.bin raw 0x0 0x080000;" \
+	"tispl.bin raw 0x080000 0x200000;" \
+	"u-boot.img raw 0x280000 0x400000;" \
+	"u-boot-env raw 0x680000 0x020000;" \
+	"sysfw.itb raw 0x6c0000 0x100000;" \
+	"rootfs raw 0x800000 0x3800000\0"
+
+#define DFU_ALT_INFO_RAM \
+	"dfu_alt_info_ram=" \
+	"tispl.bin ram 0x80080000 0x200000;" \
+	"u-boot.img ram 0x81000000 0x400000\0" \
+
+#endif /* __TI_DFU_H */
diff --git a/include/env/ti/k3_rproc.env b/include/env/ti/k3_rproc.env
new file mode 100644
index 0000000..87d9d76
--- /dev/null
+++ b/include/env/ti/k3_rproc.env
@@ -0,0 +1,26 @@
+dorprocboot=0
+boot_rprocs=
+	if test ${dorprocboot} -eq 1 && test ${boot} = mmc; then
+			rproc init;
+			run boot_rprocs_mmc;
+		fi;
+rproc_load_and_boot_one=
+	if load mmc ${bootpart} $loadaddr ${rproc_fw}; then
+		if rproc load ${rproc_id} ${loadaddr} ${filesize}; then
+			rproc start ${rproc_id};
+		fi;
+	fi
+boot_rprocs_mmc=
+	env set rproc_id;
+	env set rproc_fw;
+	for i in ${rproc_fw_binaries} ; do
+		if test -z "${rproc_id}" ; then
+			env set rproc_id $i;
+		else
+			env set rproc_fw $i;
+			run rproc_load_and_boot_one;
+			env set rproc_id;
+			env set rproc_fw;
+		fi;
+	done
+
diff --git a/include/env/ti/k3_rproc.h b/include/env/ti/k3_rproc.h
new file mode 100644
index 0000000..3418cb4
--- /dev/null
+++ b/include/env/ti/k3_rproc.h
@@ -0,0 +1,52 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * rproc environment variable definitions for various TI K3 SoCs.
+ */
+
+#ifndef __TI_RPROC_H
+#define __TI_RPROC_H
+
+/*
+ * should contain a list of <rproc_id fw_name> tuplies,
+ * override in board config files with the actual list
+ */
+#define DEFAULT_RPROCS ""
+
+#ifdef CONFIG_CMD_REMOTEPROC
+#define EXTRA_ENV_RPROC_SETTINGS					\
+	"dorprocboot=0\0"						\
+	"boot_rprocs="							\
+		"if test ${dorprocboot} -eq 1 && test ${boot} = mmc; then "\
+			"rproc init;"					\
+			"run boot_rprocs_mmc;"				\
+		"fi;\0"							\
+	"rproc_load_and_boot_one="					\
+		"if load mmc ${bootpart} $loadaddr ${rproc_fw}; then "	\
+			"if rproc load ${rproc_id} ${loadaddr} ${filesize}; then "\
+				"rproc start ${rproc_id};"		\
+			"fi;"						\
+		"fi\0"							\
+	"boot_rprocs_mmc="						\
+		"env set rproc_id;"					\
+		"env set rproc_fw;"					\
+		"for i in ${rproc_fw_binaries} ; do "			\
+			"if test -z \"${rproc_id}\" ; then "		\
+				"env set rproc_id $i;"			\
+			"else "						\
+				"env set rproc_fw $i;"			\
+				"run rproc_load_and_boot_one;"		\
+				"env set rproc_id;"			\
+				"env set rproc_fw;"			\
+			"fi;"						\
+		"done\0"						\
+	"rproc_fw_binaries="						\
+		DEFAULT_RPROCS						\
+		"\0"
+#else
+#define EXTRA_ENV_RPROC_SETTINGS					\
+	"boot_rprocs= \0"
+#endif /* CONFIG_CMD_REMOTEPROC */
+
+#endif /* __TI_RPROC_H */
diff --git a/include/env/ti/mmc.env b/include/env/ti/mmc.env
new file mode 100644
index 0000000..6fb47fb
--- /dev/null
+++ b/include/env/ti/mmc.env
@@ -0,0 +1,76 @@
+mmcdev=0
+mmcrootfstype=ext4 rootwait
+finduuid=part uuid ${boot} ${bootpart} uuid
+args_mmc=run finduuid;setenv bootargs console=${console}
+	${optargs}
+	root=PARTUUID=${uuid} rw
+	rootfstype=${mmcrootfstype}
+loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr
+bootscript=echo Running bootscript from mmc${mmcdev} ...;
+	source ${loadaddr}
+bootenvfile=uEnv.txt
+importbootenv=echo Importing environment from mmc${mmcdev} ...;
+	env import -t ${loadaddr} ${filesize}
+loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
+loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
+loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/dtb/${fdtfile}
+get_fdt_mmc=load mmc ${bootpart} ${fdtaddr} ${bootdir}/dtb/${name_fdt}
+envboot=mmc dev ${mmcdev};
+	if mmc rescan; then
+		echo SD/MMC found on device ${mmcdev};
+		if run loadbootscript; then
+			run bootscript;
+		else
+			if run loadbootenv; then
+				echo Loaded env from ${bootenvfile};
+				run importbootenv;
+			fi;
+			if test -n $uenvcmd; then
+				echo Running uenvcmd ...;
+				run uenvcmd;
+			fi;
+		fi;
+	fi;
+mmcloados=
+	if test ${boot_fdt} = yes || test ${boot_fdt} = try; then
+		if run get_fdt_mmc; then
+			bootz ${loadaddr} - ${fdtaddr};
+		else
+			if test ${boot_fdt} = try; then
+				bootz;
+			else
+				echo WARN: Cannot load the DT;
+				fi;
+		fi;
+	else
+		bootz;
+	fi;
+mmcboot=mmc dev ${mmcdev};
+	devnum=${mmcdev};
+	devtype=mmc;
+	if mmc rescan; then
+		echo SD/MMC found on device ${mmcdev};
+		if run loadimage; then
+			run args_mmc;
+			if test ${boot_fit} -eq 1; then
+				run run_fit;
+			else
+				run mmcloados;
+			fi;
+		fi;
+fi;
+
+init_mmc=run args_all args_mmc
+get_overlay_mmc=
+	fdt address ${fdtaddr};
+	fdt resize 0x100000;
+	for overlay in $name_overlays;
+	do;
+	load mmc ${bootpart} ${dtboaddr} ${bootdir}/dtb/${overlay} &&
+	fdt apply ${dtboaddr};
+	done;
+get_kern_mmc=load mmc ${bootpart} ${loadaddr}
+	${bootdir}/${name_kern}
+get_fit_mmc=load mmc ${bootpart} ${addr_fit}
+	${bootdir}/${name_fit}
+partitions=name=rootfs,start=0,size=-,uuid=${uuid_gpt_rootfs}
diff --git a/include/env/ti/mmc.h b/include/env/ti/mmc.h
new file mode 100644
index 0000000..769ea9d
--- /dev/null
+++ b/include/env/ti/mmc.h
@@ -0,0 +1,73 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Environment variable definitions for MMC/SD on TI boards.
+ */
+
+#ifndef __TI_MMC_H
+#define __TI_MMC_H
+
+#define DEFAULT_MMC_TI_ARGS \
+	"mmcdev=0\0" \
+	"mmcrootfstype=ext4 rootwait\0" \
+	"finduuid=part uuid ${boot} ${bootpart} uuid\0" \
+	"args_mmc=run finduuid;setenv bootargs console=${console} " \
+		"${optargs} " \
+		"root=PARTUUID=${uuid} rw " \
+		"rootfstype=${mmcrootfstype}\0" \
+	"loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr\0" \
+	"bootscript=echo Running bootscript from mmc${mmcdev} ...; " \
+		"source ${loadaddr}\0" \
+	"bootenvfile=uEnv.txt\0" \
+	"importbootenv=echo Importing environment from mmc${mmcdev} ...; " \
+		"env import -t ${loadaddr} ${filesize}\0" \
+	"loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}\0" \
+	"loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
+	"loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
+	"envboot=mmc dev ${mmcdev}; " \
+		"if mmc rescan; then " \
+			"echo SD/MMC found on device ${mmcdev};" \
+			"if run loadbootscript; then " \
+				"run bootscript;" \
+			"else " \
+				"if run loadbootenv; then " \
+					"echo Loaded env from ${bootenvfile};" \
+					"run importbootenv;" \
+				"fi;" \
+				"if test -n $uenvcmd; then " \
+					"echo Running uenvcmd ...;" \
+					"run uenvcmd;" \
+				"fi;" \
+			"fi;" \
+		"fi;\0" \
+	"mmcloados=" \
+		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+			"if run loadfdt; then " \
+				"bootz ${loadaddr} - ${fdtaddr}; " \
+			"else " \
+				"if test ${boot_fdt} = try; then " \
+					"bootz; " \
+				"else " \
+					"echo WARN: Cannot load the DT; " \
+				"fi; " \
+			"fi; " \
+		"else " \
+			"bootz; " \
+		"fi;\0" \
+	"mmcboot=mmc dev ${mmcdev}; " \
+		"devnum=${mmcdev}; " \
+		"devtype=mmc; " \
+		"if mmc rescan; then " \
+			"echo SD/MMC found on device ${mmcdev};" \
+			"if run loadimage; then " \
+				"run args_mmc; " \
+				"if test ${boot_fit} -eq 1; then " \
+					"run run_fit; " \
+				"else " \
+					"run mmcloados;" \
+				"fi;" \
+			"fi;" \
+		"fi;\0"
+
+#endif /* __TI_MMC_H */
diff --git a/include/env/ti/nand.env b/include/env/ti/nand.env
new file mode 100644
index 0000000..4e185c1
--- /dev/null
+++ b/include/env/ti/nand.env
@@ -0,0 +1,14 @@
+mtdids=nor0=47040000.spi.0,nor0=47034000.hyperbus
+mtdparts=mtdparts=47040000.spi.0:512k(ospi.tiboot3),2m(ospi.tispl),4m(ospi.u-boot),256k(ospi.env),256k(ospi.env.backup),57088k@8m(ospi.rootfs),256k(ospi.phypattern);47034000.hyperbus:512k(hbmc.tiboot3),2m(hbmc.tispl),4m(hbmc.u-boot),256k(hbmc.env),-@8m(hbmc.rootfs)
+nandargs=setenv bootargs console=${console}
+	${optargs}
+	root=${nandroot}
+	rootfstype=${nandrootfstype}
+nandroot=ubi0:rootfs rw ubi.mtd=NAND.file-system,2048
+nandrootfstype=ubifs rootwait
+nandboot=echo Booting from nand ...;
+	run nandargs;
+	nand read ${fdtaddr} NAND.u-boot-spl-os;
+	nand read ${loadaddr} NAND.kernel;
+	bootz ${loadaddr} - ${fdtaddr}
+
diff --git a/include/env/ti/nand.h b/include/env/ti/nand.h
new file mode 100644
index 0000000..7d00afa
--- /dev/null
+++ b/include/env/ti/nand.h
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Environment variable definitions for NAND on TI boards.
+ */
+
+#ifdef CONFIG_MTD_RAW_NAND
+#define NANDARGS \
+	"mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \
+	"mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \
+	"nandargs=setenv bootargs console=${console} " \
+		"${optargs} " \
+		"root=${nandroot} " \
+		"rootfstype=${nandrootfstype}\0" \
+	"nandroot=ubi0:rootfs rw ubi.mtd=NAND.file-system,2048\0" \
+	"nandrootfstype=ubifs rootwait\0" \
+	"nandboot=echo Booting from nand ...; " \
+		"run nandargs; " \
+		"nand read ${fdtaddr} NAND.u-boot-spl-os; " \
+		"nand read ${loadaddr} NAND.kernel; " \
+		"bootz ${loadaddr} - ${fdtaddr}\0"
+#else
+#define NANDARGS ""
+#endif
diff --git a/include/env/ti/ti_armv7_common.env b/include/env/ti/ti_armv7_common.env
new file mode 100644
index 0000000..e87a41a
--- /dev/null
+++ b/include/env/ti/ti_armv7_common.env
@@ -0,0 +1,34 @@
+loadaddr=0x82000000
+kernel_addr_r=0x82000000
+fdtaddr=0x88000000
+dtboaddr=0x89000000
+fdt_addr_r=0x88000000
+fdtoverlay_addr_r=0x89000000
+rdaddr=0x88080000
+ramdisk_addr_r=0x88080000
+scriptaddr=0x80000000
+pxefile_addr_r=0x80100000
+bootm_size=0x10000000
+boot_fdt=try
+
+boot_fit=0
+addr_fit=0x90000000
+name_fit=fitImage
+update_to_fit=setenv loadaddr ${addr_fit}; setenv bootfile ${name_fit}
+get_overlaystring=
+	for overlay in $name_overlays;
+	do;
+	setenv overlaystring ${overlaystring}'#'${overlay};
+	done;
+get_fit_config=setexpr name_fit_config gsub / _ conf-${fdtfile}
+run_fit=run get_fit_config; bootm ${addr_fit}#${name_fit_config}${overlaystring}
+bootcmd_ti_mmc=
+	run findfdt; run init_${boot};
+#if CONFIG_CMD_REMOTEPROC
+	run main_cpsw0_qsgmii_phyinit; run boot_rprocs;
+#endif
+	if test ${boot_fit} -eq 1;
+		then run get_fit_${boot}; run get_overlaystring; run run_fit;
+	else;
+		run get_kern_${boot}; run get_fdt_${boot}; run get_overlay_${boot}; run run_kern;
+	fi;
diff --git a/include/env/ti/ti_armv7_keystone2.env b/include/env/ti/ti_armv7_keystone2.env
new file mode 100644
index 0000000..e0395d3
--- /dev/null
+++ b/include/env/ti/ti_armv7_keystone2.env
@@ -0,0 +1,61 @@
+name_fw_rd=k2-fw-initrd.cpio.gz
+set_rd_spec=setenv rd_spec ${rdaddr}:${filesize}
+init_fw_rd_net=dhcp ${rdaddr} ${tftp_root}/${name_fw_rd}; run set_rd_spec
+init_fw_rd_nfs=nfs ${rdaddr} ${nfs_root}/boot/${name_fw_rd}; run set_rd_spec
+init_fw_rd_ramfs=setenv rd_spec -
+init_fw_rd_ubi=ubifsload ${rdaddr} ${bootdir}/${name_fw_rd}; run set_rd_spec
+
+dfu_bufsiz=0x10000
+dfu_alt_info_mmc=
+	MLO fat 0 1;
+	u-boot.img fat 0 1;
+	uEnv.txt fat 0 1
+
+bootdir=/boot
+tftp_root=/
+nfs_root=/export
+mem_lpae=1
+uinitrd_fixup=1
+addr_ubi=0x82000000
+addr_secdb_key=0xc000000
+name_kern=zImage
+addr_mon=0x87000000
+addr_non_sec_mon=0x0c097fc0
+addr_load_sec_bm=0x0c09c000
+run_mon=mon_install ${addr_mon}
+run_mon_hs=mon_install ${addr_non_sec_mon} ${addr_load_sec_bm}
+run_kern=bootz ${loadaddr} ${rd_spec} ${fdtaddr}
+init_net=run args_all args_net
+init_nfs=setenv autoload no; dhcp; run args_all args_net
+init_ubi=run args_all args_ubi; ubi part ubifs; ubifsmount ubi:rootfs;
+get_fdt_net=dhcp ${fdtaddr} ${tftp_root}/${name_fdt}
+get_fdt_nfs=nfs ${fdtaddr} ${nfs_root}/boot/${name_fdt}
+get_fdt_ubi=ubifsload ${fdtaddr} ${bootdir}/${name_fdt}
+get_kern_net=dhcp ${loadaddr} ${tftp_root}/${name_kern}
+get_kern_nfs=nfs ${loadaddr} ${nfs_root}/boot/${name_kern}
+get_kern_ubi=ubifsload ${loadaddr} ${bootdir}/${name_kern}
+get_mon_net=dhcp ${addr_mon} ${tftp_root}/${name_mon}
+get_mon_nfs=nfs ${addr_mon} ${nfs_root}/boot/${name_mon}
+get_mon_ubi=ubifsload ${addr_mon} ${bootdir}/${name_mon}
+get_fit_net=dhcp ${addr_fit} ${tftp_root}/${name_fit}
+get_fit_nfs=nfs ${addr_fit} ${nfs_root}/boot/${name_fit}
+get_fit_ubi=ubifsload ${addr_fit} ${bootdir}/${name_fit}
+get_fit_mmc=load mmc ${bootpart} ${addr_fit} ${bootdir}/${name_fit}
+get_uboot_net=dhcp ${loadaddr} ${tftp_root}/${name_uboot}
+get_uboot_nfs=nfs ${loadaddr} ${nfs_root}/boot/${name_uboot}
+burn_uboot_spi=sf probe; sf erase 0 0x100000; sf write ${loadaddr} 0 ${filesize}
+burn_uboot_nand=nand erase 0 0x100000; nand write ${loadaddr} 0 ${filesize}
+args_all=setenv bootargs console=ttyS0,115200n8 rootwait
+args_net=setenv bootargs ${bootargs} rootfstype=nfs root=/dev/nfs rw nfsroot=${serverip}:${nfs_root},${nfs_options} ip=dhcp
+nfs_options=v3,tcp,rsize=4096,wsize=4096
+get_fdt_ramfs=dhcp ${fdtaddr} ${tftp_root}/${name_fdt}
+get_kern_ramfs=dhcp ${loadaddr} ${tftp_root}/${name_kern}
+get_mon_ramfs=dhcp ${addr_mon} ${tftp_root}/${name_mon}
+get_fit_ramfs=dhcp ${addr_fit} ${tftp_root}/${name_fit}
+get_fs_ramfs=dhcp ${rdaddr} ${tftp_root}/${name_fs}
+get_ubi_net=dhcp ${addr_ubi} ${tftp_root}/${name_ubi}
+get_ubi_nfs=nfs ${addr_ubi} ${nfs_root}/boot/${name_ubi}
+burn_ubi=nand erase.part ubifs; nand write ${addr_ubi} ubifs ${filesize}
+init_ramfs=run args_all args_ramfs get_fs_ramfs
+args_ramfs=setenv bootargs ${bootargs} rdinit=/sbin/init rw root=/dev/ram0 initrd=0x808080000,80M
+no_post=1
diff --git a/include/env/ti/ufs.env b/include/env/ti/ufs.env
new file mode 100644
index 0000000..509a87b
--- /dev/null
+++ b/include/env/ti/ufs.env
@@ -0,0 +1,22 @@
+scsirootfstype=ext4 rootwait
+ufs_finduuid=part uuid scsi ${bootpart} uuid
+args_ufs=setenv devtype scsi;setenv bootpart 1:1;
+	run ufs_finduuid;
+	setenv bootargs console = ${console}
+	${optargs}
+	root=PARTUUID=${uuid} rw
+	rootfstype=${scsirootfstype};
+	setenv devtype scsi;
+	setenv bootpart 1:1
+init_ufs=ufs init; scsi scan; run args_ufs
+get_kern_ufs=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${name_kern}
+get_fdt_ufs=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}
+get_overlay_ufs=
+	fdt address ${fdtaddr};
+	fdt resize 0x100000;
+	for overlay in $name_overlays;
+	do;
+	load scsi ${bootpart} ${dtboaddr} ${bootdir}/${overlay} &&
+	fdt apply ${dtboaddr};
+	done;
+
diff --git a/include/env/ti/ufs.h b/include/env/ti/ufs.h
new file mode 100644
index 0000000..6619ec9
--- /dev/null
+++ b/include/env/ti/ufs.h
@@ -0,0 +1,33 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Environment variable definitions for UFS on TI boards.
+ */
+
+#ifndef __TI_UFS_H
+#define __TI_UFS_H
+
+#define DEFAULT_UFS_TI_ARGS \
+	"scsirootfstype=ext4 rootwait\0" \
+	"ufs_finduuid=part uuid scsi ${bootpart} uuid\0" \
+	"args_ufs=setenv devtype scsi;setenv bootpart 1:1;" \
+	"run ufs_finduuid;setenv bootargs console = ${console} " \
+		"${optargs}" \
+		"root=PARTUUID=${uuid} rw " \
+		"rootfstype=${scsirootfstype};" \
+		"setenv devtype scsi;" \
+		"setenv bootpart 1:1\0" \
+	"init_ufs=ufs init; scsi scan; run args_ufs\0" \
+	"get_kern_ufs=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${name_kern}\0" \
+	"get_fdt_ufs=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
+	"get_overlay_ufs=" \
+		"fdt address ${fdtaddr};" \
+		"fdt resize 0x100000;" \
+		"for overlay in $name_overlays;" \
+		"do;" \
+		"load scsi ${bootpart} ${dtboaddr} ${bootdir}/${overlay} && " \
+		"fdt apply ${dtboaddr};" \
+		"done;\0"
+
+#endif