[U-Boot] [PATCHv2 10/15] board: ge: bx50v3: Support FIT and select configuration based on VPD

Sebastian Reichel sebastian.reichel at collabora.co.uk
Wed Jan 10 19:31:33 UTC 2018


From: Ian Ray <ian.ray at ge.com>

Modify configuration to support FIT. Set variable `confidx' from VPD,
in order to load the correct device tree. Modify/simplify U-Boot
environment to support loading FIT image.

Signed-off-by: Ian Ray <ian.ray at ge.com>
Signed-off-by: Martyn Welch <martyn.welch at collabora.co.uk>
Signed-off-by: Sebastian Reichel <sebastian.reichel at collabora.co.uk>
---
 board/ge/bx50v3/bx50v3.c    | 12 +++++++
 configs/ge_b450v3_defconfig |  1 +
 configs/ge_b650v3_defconfig |  1 +
 configs/ge_b850v3_defconfig |  1 +
 include/configs/ge_bx50v3.h | 88 +++------------------------------------------
 5 files changed, 20 insertions(+), 83 deletions(-)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 48c26e0f9fa5..e35afa0317a8 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -590,6 +590,18 @@ static void process_vpd(struct vpd_cache *vpd)
 	int fec_index = -1;
 	int i210_index = -1;
 
+	switch (vpd->product_id) {
+	case VPD_PRODUCT_B450:
+		env_set("confidx", "1");
+		break;
+	case VPD_PRODUCT_B650:
+		env_set("confidx", "2");
+		break;
+	case VPD_PRODUCT_B850:
+		env_set("confidx", "3");
+		break;
+	}
+
 	switch (vpd->product_id) {
 	case VPD_PRODUCT_B450:
 		/* fall thru */
diff --git a/configs/ge_b450v3_defconfig b/configs/ge_b450v3_defconfig
index f95c3cdc7957..76cc4070e04d 100644
--- a/configs/ge_b450v3_defconfig
+++ b/configs/ge_b450v3_defconfig
@@ -32,3 +32,4 @@ CONFIG_CMD_NET=y
 CONFIG_CMD_PCI=y
 CONFIG_E1000=y
 CONFIG_CMD_E1000=y
+CONFIG_FIT=y
diff --git a/configs/ge_b650v3_defconfig b/configs/ge_b650v3_defconfig
index 3af063023430..e82abe21eb14 100644
--- a/configs/ge_b650v3_defconfig
+++ b/configs/ge_b650v3_defconfig
@@ -32,3 +32,4 @@ CONFIG_CMD_NET=y
 CONFIG_CMD_PCI=y
 CONFIG_E1000=y
 CONFIG_CMD_E1000=y
+CONFIG_FIT=y
diff --git a/configs/ge_b850v3_defconfig b/configs/ge_b850v3_defconfig
index 5f008eac750c..4f9d77cc4fe4 100644
--- a/configs/ge_b850v3_defconfig
+++ b/configs/ge_b850v3_defconfig
@@ -32,3 +32,4 @@ CONFIG_CMD_NET=y
 CONFIG_CMD_PCI=y
 CONFIG_E1000=y
 CONFIG_CMD_E1000=y
+CONFIG_FIT=y
diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
index cc067ccee657..1c1b82a77734 100644
--- a/include/configs/ge_bx50v3.h
+++ b/include/configs/ge_bx50v3.h
@@ -110,95 +110,24 @@
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"script=boot.scr\0" \
-	"image=/boot/uImage\0" \
-	"uboot=u-boot.imx\0" \
-	"fdt_file=" CONFIG_DEFAULT_FDT_FILE "\0" \
-	"fdt_addr=0x18000000\0" \
-	"boot_fdt=yes\0" \
-	"ip_dyn=yes\0" \
+	"image=/boot/fitImage\0" \
 	"console=" CONSOLE_DEV "\0" \
 	"fdt_high=0xffffffff\0"	  \
-	"initrd_high=0xffffffff\0" \
 	"sddev=0\0" \
 	"emmcdev=1\0" \
 	"partnum=1\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" \
-	"update_sf_uboot=" \
-		"if tftp $loadaddr $uboot; then " \
-			"sf probe; " \
-			"sf erase 0 0xC0000; " \
-			"sf write $loadaddr 0x400 $filesize; " \
-			"echo 'U-Boot upgraded. Please reset'; " \
-		"fi\0" \
 	"setargs=setenv bootargs console=${console},${baudrate} " \
 		"root=/dev/${rootdev} rw rootwait cma=128M " \
 		BX50V3_BOOTARGS_EXTRA "\0" \
-	"loadbootscript=" \
-		"ext2load ${dev} ${devnum}:${partnum} ${loadaddr} ${script};\0" \
-	"bootscript=echo Running bootscript from ${dev}:${devnum}:${partnum};" \
-		" source\0" \
 	"loadimage=" \
 		"ext2load ${dev} ${devnum}:${partnum} ${loadaddr} ${image}\0" \
-	"loadfdt=ext2load ${dev} ${devnum}:${partnum} ${fdt_addr} ${fdt_file}\0" \
 	"tryboot=" \
-		"if run loadbootscript; then " \
-			"run bootscript; " \
-		"else " \
-			"if run loadimage; then " \
-				"run doboot; " \
-			"fi; " \
+		"if run loadimage; then " \
+			"run doboot; " \
 		"fi;\0" \
 	"doboot=echo Booting from ${dev}:${devnum}:${partnum} ...; " \
 		"run setargs; " \
-		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
-			"if run loadfdt; then " \
-				"bootm ${loadaddr} - ${fdt_addr}; " \
-			"else " \
-				"if test ${boot_fdt} = try; then " \
-					"bootm; " \
-				"else " \
-					"echo WARN: Cannot load the DT; " \
-				"fi; " \
-			"fi; " \
-		"else " \
-			"bootm; " \
-		"fi;\0" \
-	"netargs=setenv bootargs console=${console},${baudrate} " \
-		"root=/dev/nfs " \
-		"ip=dhcp nfsroot=${serverip}:${nfsroot},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 " \
-				"bootm ${loadaddr} - ${fdt_addr}; " \
-			"else " \
-				"if test ${boot_fdt} = try; then " \
-					"bootm; " \
-				"else " \
-					"echo WARN: Cannot load the DT; " \
-				"fi; " \
-			"fi; " \
-		"else " \
-			"bootm; " \
-		"fi;\0" \
+		"bootm ${loadaddr}#conf@${confidx};\0 " \
 
 #define CONFIG_MMCBOOTCOMMAND \
 	"setenv dev mmc; " \
@@ -216,14 +145,7 @@
 	"fi; " \
 
 #define CONFIG_USBBOOTCOMMAND \
-	"usb start; " \
-	"setenv dev usb; " \
-	"setenv devnum 0; " \
-	"setenv rootdev sda${partnum}; " \
-	"run tryboot; " \
-	\
-	CONFIG_MMCBOOTCOMMAND \
-	"bmode usb; " \
+	"echo Unsupported; " \
 
 #ifdef CONFIG_CMD_USB
 #define CONFIG_BOOTCOMMAND CONFIG_USBBOOTCOMMAND
-- 
2.15.1



More information about the U-Boot mailing list