keystone2: env: add env script for booting with an initramfs with firmware
This patch updates the env script to include a initramfs with firmware
loaded and provided to kernel through second argument of bootz command
during boot. Defined DEFAULT_FW_INITRAMFS_BOOT_ENV to have all of the
required env variables and use it in evm specific config file.
The K2 linux drivers for PCIe and NetCP (1G, 10G) requires serdes
firmwares. These requires firmware to be available early through the boot
process in some cases to satisfy firmware requests from driver. Hence use
a small initramfs to provide the same and update boot env to accommodate
this in the boot flow. This method is used when rootfs is nfs and ubifs.
This fs contains just lib/firmware folder with all required firmware.
When rootfs is on initramfs, then the filesystem has the firmware under
lib/firmware and this early initramfs is not required and is not used.
Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
diff --git a/include/configs/k2e_evm.h b/include/configs/k2e_evm.h
index e053a54..daf37f6 100644
--- a/include/configs/k2e_evm.h
+++ b/include/configs/k2e_evm.h
@@ -16,6 +16,7 @@
/* U-Boot general configuration */
#define CONFIG_EXTRA_ENV_KS2_BOARD_SETTINGS \
+ DEFAULT_FW_INITRAMFS_BOOT_ENV \
"addr_mon=0x0c140000\0" \
"args_ubi=setenv bootargs ${bootargs} rootfstype=ubifs " \
"root=ubi0:rootfs rootflags=sync rw ubi.mtd=ubifs,2048\0" \
diff --git a/include/configs/k2g_evm.h b/include/configs/k2g_evm.h
index 2c70df1..2e47763 100644
--- a/include/configs/k2g_evm.h
+++ b/include/configs/k2g_evm.h
@@ -21,6 +21,7 @@
"console=ttyS0,115200n8\0" \
"bootpart=0:2\0" \
"bootdir=/boot\0" \
+ "rd_spec=-\0" \
"addr_mon=0x0c040000\0" \
"args_ubi=setenv bootargs ${bootargs} rootfstype=ubifs " \
"root=ubi0:rootfs rootflags=sync rw ubi.mtd=ubifs,2048\0" \
@@ -34,6 +35,7 @@
"get_kern_mmc=load mmc ${bootpart} ${loadaddr} " \
"${bootdir}/${name_kern}\0" \
"get_mon_mmc=load mmc ${bootpart} ${addr_mon} ${bootdir}/${name_mon}\0"\
+ "name_fs=arago-base-tisdk-image-k2g-evm.cpio\0"
#define CONFIG_BOOTCOMMAND \
"run envboot; " \
diff --git a/include/configs/k2hk_evm.h b/include/configs/k2hk_evm.h
index 3cd2a85..a031ae4 100644
--- a/include/configs/k2hk_evm.h
+++ b/include/configs/k2hk_evm.h
@@ -16,6 +16,7 @@
/* U-Boot general configuration */
#define CONFIG_EXTRA_ENV_KS2_BOARD_SETTINGS \
+ DEFAULT_FW_INITRAMFS_BOOT_ENV \
"addr_mon=0x0c5f0000\0" \
"args_ubi=setenv bootargs ${bootargs} rootfstype=ubifs " \
"root=ubi0:rootfs rootflags=sync rw ubi.mtd=ubifs,2048\0" \
diff --git a/include/configs/k2l_evm.h b/include/configs/k2l_evm.h
index 9bacfa4..829daa2 100644
--- a/include/configs/k2l_evm.h
+++ b/include/configs/k2l_evm.h
@@ -16,6 +16,7 @@
/* U-Boot general configuration */
#define CONFIG_EXTRA_ENV_KS2_BOARD_SETTINGS \
+ DEFAULT_FW_INITRAMFS_BOOT_ENV \
"addr_mon=0x0c140000\0" \
"args_ubi=setenv bootargs ${bootargs} rootfstype=ubifs " \
"root=ubi0:rootfs rootflags=sync rw ubi.mtd=ubifs,4096\0" \
diff --git a/include/configs/ti_armv7_keystone2.h b/include/configs/ti_armv7_keystone2.h
index 2ad2f1c..7131601 100644
--- a/include/configs/ti_armv7_keystone2.h
+++ b/include/configs/ti_armv7_keystone2.h
@@ -224,6 +224,15 @@
/* EDMA3 */
#define CONFIG_TI_EDMA3
+#define DEFAULT_FW_INITRAMFS_BOOT_ENV \
+ "name_fw_rd=k2-fw-initrd.cpio.gz\0" \
+ "set_rd_spec=setenv rd_spec ${rdaddr}:${filesize}\0" \
+ "init_fw_rd_net=dhcp ${rdaddr} ${tftp_root}/${name_fw_rd}; " \
+ "run set_rd_spec\0" \
+ "init_fw_rd_ramfs=setenv rd_spec -\0" \
+ "init_fw_rd_ubi=ubifsload ${rdaddr} ${bootdir}/${name_fw_rd}; " \
+ "run set_rd_spec\0" \
+
#define DEFAULT_PMMC_BOOT_ENV \
"set_name_pmmc=setenv name_pmmc ti-sci-firmware-${soc_variant}.bin\0" \
"dev_pmmc=0\0" \
@@ -249,7 +258,7 @@
"addr_secdb_key=0xc000000\0" \
"name_kern=zImage\0" \
"run_mon=mon_install ${addr_mon}\0" \
- "run_kern=bootz ${loadaddr} - ${fdtaddr}\0" \
+ "run_kern=bootz ${loadaddr} ${rd_spec} ${fdtaddr}\0" \
"init_net=run args_all args_net\0" \
"init_ubi=run args_all args_ubi; " \
"ubi part ubifs; ubifsmount ubi:rootfs;\0" \
@@ -286,8 +295,8 @@
#ifndef CONFIG_BOOTCOMMAND
#define CONFIG_BOOTCOMMAND \
- "run init_${boot} get_fdt_${boot} get_mon_${boot} " \
- "get_kern_${boot} run_mon run_kern"
+ "run init_${boot} init_fw_rd_${boot} get_fdt_${boot} " \
+ "get_mon_${boot} get_kern_${boot} run_mon run_kern"
#endif
#define CONFIG_BOOTARGS \