u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] AM57 boot fixes
@ 2025-09-01  6:16 Anurag Dutta
  2025-09-01  6:16 ` [PATCH v2 1/4] include: env: ti: Use .env for environment variables Anurag Dutta
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Anurag Dutta @ 2025-09-01  6:16 UTC (permalink / raw)
  To: trini, n-francis; +Cc: u-kumar1, u-boot, a-dutta

Hi all
This patch series migrates from .h to .env format for am57xx/dra7xx.
Also, we do relevant changes so that the fdtfile can be set from C code.

logs : https://gist.github.com/anuragdutta731/82560cc9bc958ca70a25a95a7031eeea

Changelog: v1:
1. Converted to plain text environment for am57 and dra7
2. Added dra7 support as well

Link to v1:
https://lore.kernel.org/all/20250425053431.1622267-1-a-dutta@ti.com/

Anurag Dutta (4):
  include: env: ti: Use .env for environment variables
  board: ti: am57xx: Change to using .env
  board: ti: am57xx: Set fdtfile from C code instead of findfdt script
  board: ti: dra7xx: Set fdtfile from C code instead of findfdt script

 board/ti/am57xx/Kconfig           |  12 ++
 board/ti/am57xx/am57xx.env        | 162 +++++++++++++++++++++
 board/ti/am57xx/board.c           |  14 ++
 board/ti/dra7xx/evm.c             |  11 ++
 include/configs/am57xx_evm.h      |  19 +--
 include/configs/dra7xx_evm.h      |  24 ----
 include/configs/ti_omap5_common.h | 228 ------------------------------
 include/env/ti/dfu.env            |  53 +++++++
 8 files changed, 253 insertions(+), 270 deletions(-)
 create mode 100644 board/ti/am57xx/am57xx.env
 create mode 100644 include/env/ti/dfu.env

-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/4] include: env: ti: Use .env for environment variables
  2025-09-01  6:16 [PATCH v2 0/4] AM57 boot fixes Anurag Dutta
@ 2025-09-01  6:16 ` Anurag Dutta
  2025-09-01  6:16 ` [PATCH v2 2/4] board: ti: am57xx: Change to using .env Anurag Dutta
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Anurag Dutta @ 2025-09-01  6:16 UTC (permalink / raw)
  To: trini, n-francis; +Cc: u-kumar1, u-boot, a-dutta

Add omap common environment variables to .env. We retain the old-style C
environment .h files to maintain compatibility with other omap devices that
have not moved to using .env yet.

Signed-off-by: Anurag Dutta <a-dutta@ti.com>
---
 include/configs/ti_omap5_common.h | 228 ------------------------------
 include/env/ti/dfu.env            |  53 +++++++
 2 files changed, 53 insertions(+), 228 deletions(-)
 create mode 100644 include/env/ti/dfu.env

diff --git a/include/configs/ti_omap5_common.h b/include/configs/ti_omap5_common.h
index 39102f15eb9..9e02b0d0040 100644
--- a/include/configs/ti_omap5_common.h
+++ b/include/configs/ti_omap5_common.h
@@ -39,216 +39,6 @@
 #define DFUARGS
 #endif
 
-#include <env/ti/mmc.h>
-#include <env/ti/nand.h>
-
-#ifndef CONSOLEDEV
-#define CONSOLEDEV "ttyS2"
-#endif
-
-#ifndef PARTS_DEFAULT
-/*
- * Default GPT tables for eMMC (Linux and Android). Notes:
- *   1. Keep partitions aligned to erase group size (512 KiB) when possible
- *   2. Keep partitions in sync with DFU_ALT_INFO_EMMC (see dfu.h)
- *   3. Keep 'bootloader' partition (U-Boot proper) start address in sync with
- *      CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR (see common/spl/Kconfig)
- */
-#define PARTS_DEFAULT \
-	/* Linux partitions */ \
-	"uuid_disk=${uuid_gpt_disk};" \
-	"name=bootloader,start=384K,size=1792K,uuid=${uuid_gpt_bootloader};" \
-	"name=rootfs,start=2688K,size=-,uuid=${uuid_gpt_rootfs}\0" \
-	/* Android partitions */ \
-	"partitions_android=" \
-	"uuid_disk=${uuid_gpt_disk};" \
-	"name=xloader,start=128K,size=256K,uuid=${uuid_gpt_xloader};" \
-	"name=bootloader,size=2048K,uuid=${uuid_gpt_bootloader};" \
-	"name=uboot-env,start=2432K,size=256K,uuid=${uuid_gpt_reserved};" \
-	"name=misc,size=128K,uuid=${uuid_gpt_misc};" \
-	"name=boot_a,size=20M,uuid=${uuid_gpt_boot_a};" \
-	"name=boot_b,size=20M,uuid=${uuid_gpt_boot_b};" \
-	"name=dtbo_a,size=8M,uuid=${uuid_gpt_dtbo_a};" \
-	"name=dtbo_b,size=8M,uuid=${uuid_gpt_dtbo_b};" \
-	"name=vbmeta_a,size=64K,uuid=${uuid_gpt_vbmeta_a};" \
-	"name=vbmeta_b,size=64K,uuid=${uuid_gpt_vbmeta_b};" \
-	"name=recovery,size=64M,uuid=${uuid_gpt_recovery};" \
-	"name=super,size=2560M,uuid=${uuid_gpt_super};" \
-	"name=metadata,size=16M,uuid=${uuid_gpt_metadata};" \
-	"name=userdata,size=-,uuid=${uuid_gpt_userdata}"
-#endif /* PARTS_DEFAULT */
-
-#if defined(CONFIG_CMD_AVB)
-#define AVB_VERIFY_CHECK "if run avb_verify; then " \
-				"echo AVB verification OK.;" \
-				"set bootargs $bootargs $avb_bootargs;" \
-			"else " \
-				"echo AVB verification failed.;" \
-			"exit; fi;"
-#define AVB_VERIFY_CMD "avb_verify=avb init 1; avb verify $slot_suffix;\0"
-#else
-#define AVB_VERIFY_CHECK ""
-#define AVB_VERIFY_CMD ""
-#endif
-
-#define CONTROL_PARTITION "misc"
-
-#if defined(CONFIG_CMD_BCB) && defined(CONFIG_ANDROID_AB)
-#define AB_SELECT_SLOT \
-	"if part number mmc 1 " CONTROL_PARTITION " control_part_number; " \
-	"then " \
-		"echo " CONTROL_PARTITION \
-			" partition number:${control_part_number};" \
-		"bcb ab_select slot_name mmc ${mmcdev}:${control_part_number};" \
-	"else " \
-		"echo " CONTROL_PARTITION " partition not found;" \
-		"exit;" \
-	"fi;" \
-	"setenv slot_suffix _${slot_name};"
-#define AB_SELECT_ARGS \
-	"setenv bootargs_ab androidboot.slot_suffix=${slot_suffix}; " \
-	"echo A/B cmdline addition: ${bootargs_ab};" \
-	"setenv bootargs ${bootargs} ${bootargs_ab};"
-#else
-#define AB_SELECT_SLOT ""
-#define AB_SELECT_ARGS ""
-#endif
-
-/*
- * Prepares complete device tree blob for current board (for Android boot).
- *
- * Boot image or recovery image should be loaded into $loadaddr prior to running
- * these commands. The logic of these commnads is next:
- *
- *   1. Read correct DTB for current SoC/board from boot image in $loadaddr
- *      to $fdtaddr
- *   2. Merge all needed DTBO for current board from 'dtbo' partition into read
- *      DTB
- *   3. User should provide $fdtaddr as 3rd argument to 'bootm'
- */
-#define PREPARE_FDT \
-	"echo Preparing FDT...; " \
-	"if test $board_name = am57xx_evm_reva3; then " \
-		"echo \"  Reading DTBO partition...\"; " \
-		"part start mmc ${mmcdev} dtbo${slot_suffix} p_dtbo_start; " \
-		"part size mmc ${mmcdev} dtbo${slot_suffix} p_dtbo_size; " \
-		"mmc read ${dtboaddr} ${p_dtbo_start} ${p_dtbo_size}; " \
-		"echo \"  Reading DTB for AM57x EVM RevA3...\"; " \
-		"abootimg get dtb --index=0 dtb_start dtb_size; " \
-		"cp.b $dtb_start $fdtaddr $dtb_size; " \
-		"fdt addr $fdtaddr 0x80000; " \
-		"echo \"  Applying DTBOs for AM57x EVM RevA3...\"; " \
-		"adtimg addr $dtboaddr; " \
-		"adtimg get dt --index=0 dtbo0_addr dtbo0_size; " \
-		"fdt apply $dtbo0_addr; " \
-		"adtimg get dt --index=1 dtbo1_addr dtbo1_size; " \
-		"fdt apply $dtbo1_addr; " \
-	"elif test $board_name = beagle_x15_revc; then " \
-		"echo \"  Reading DTB for Beagle X15 RevC...\"; " \
-		"abootimg get dtb --index=0 dtb_start dtb_size; " \
-		"cp.b $dtb_start $fdtaddr $dtb_size; " \
-		"fdt addr $fdtaddr 0x80000; " \
-	"else " \
-		"echo Error: Android boot is not supported for $board_name; " \
-		"exit; " \
-	"fi; " \
-
-#define DEFAULT_COMMON_BOOT_TI_ARGS \
-	"console=" CONSOLEDEV ",115200n8\0" \
-	"fdtfile=undefined\0" \
-	"finduuid=part uuid mmc 0:2 uuid\0" \
-	"usbtty=cdc_acm\0" \
-	"vram=16M\0" \
-	AVB_VERIFY_CMD \
-	"partitions=" PARTS_DEFAULT "\0" \
-	"optargs=\0" \
-	"dofastboot=0\0" \
-	"emmc_android_boot=" \
-		"setenv mmcdev 1; " \
-		"mmc dev $mmcdev; " \
-		"mmc rescan; " \
-		AB_SELECT_SLOT \
-		"if bcb load " __stringify(CONFIG_FASTBOOT_FLASH_MMC_DEV) " " \
-		CONTROL_PARTITION "; then " \
-			"setenv ardaddr -; " \
-			"if bcb test command = bootonce-bootloader; then " \
-				"echo Android: Bootloader boot...; " \
-				"bcb clear command; bcb store; " \
-				"fastboot 1; " \
-				"exit; " \
-			"elif bcb test command = boot-recovery; then " \
-				"echo Android: Recovery boot...; " \
-				"setenv ardaddr $loadaddr;" \
-				"setenv apart recovery; " \
-			"else " \
-				"echo Android: Normal boot...; " \
-				"setenv ardaddr $loadaddr; " \
-				"setenv apart boot${slot_suffix}; " \
-			"fi; " \
-		"else " \
-			"echo Warning: BCB is corrupted or does not exist; " \
-			"echo Android: Normal boot...; " \
-		"fi; " \
-		"setenv eval_bootargs setenv bootargs $bootargs; " \
-		"run eval_bootargs; " \
-		"setenv machid fe6; " \
-		AVB_VERIFY_CHECK \
-		AB_SELECT_ARGS \
-		"if part start mmc $mmcdev $apart boot_start; then " \
-			"part size mmc $mmcdev $apart boot_size; " \
-			"mmc read $loadaddr $boot_start $boot_size; " \
-			PREPARE_FDT \
-			"bootm $loadaddr $ardaddr $fdtaddr; " \
-		"else " \
-			"echo $apart partition not found; " \
-			"exit; " \
-		"fi;\0"
-
-#define DEFAULT_FDT_TI_ARGS \
-	"findfdt="\
-		"if test $board_name = omap5_uevm; then " \
-			"setenv fdtfile omap5-uevm.dtb; fi; " \
-		"if test $board_name = dra7xx; then " \
-			"setenv fdtfile dra7-evm.dtb; fi;" \
-		"if test $board_name = dra72x-revc; then " \
-			"setenv fdtfile dra72-evm-revc.dtb; fi;" \
-		"if test $board_name = dra72x; then " \
-			"setenv fdtfile dra72-evm.dtb; fi;" \
-		"if test $board_name = dra71x; then " \
-			"setenv fdtfile dra71-evm.dtb; fi;" \
-		"if test $board_name = dra76x_acd; then " \
-			"setenv fdtfile dra76-evm.dtb; fi;" \
-		"if test $board_name = beagle_x15; then " \
-			"setenv fdtfile am57xx-beagle-x15.dtb; fi;" \
-		"if test $board_name = beagle_x15_revb1; then " \
-			"setenv fdtfile am57xx-beagle-x15-revb1.dtb; fi;" \
-		"if test $board_name = beagle_x15_revc; then " \
-			"setenv fdtfile am57xx-beagle-x15-revc.dtb; fi;" \
-		"if test $board_name = am5729_beagleboneai; then " \
-			"setenv fdtfile am5729-beagleboneai.dtb; fi;" \
-		"if test $board_name = am572x_idk; then " \
-			"setenv fdtfile am572x-idk.dtb; fi;" \
-		"if test $board_name = am574x_idk; then " \
-			"setenv fdtfile am574x-idk.dtb; fi;" \
-		"if test $board_name = am57xx_evm; then " \
-			"setenv fdtfile am57xx-beagle-x15.dtb; fi;" \
-		"if test $board_name = am57xx_evm_reva3; then " \
-			"setenv fdtfile am57xx-beagle-x15.dtb; fi;" \
-		"if test $board_name = am571x_idk; then " \
-			"setenv fdtfile am571x-idk.dtb; fi;" \
-		"if test $fdtfile = undefined; then " \
-			"echo WARNING: Could not determine device tree to use; fi; \0"
-
-#define GET_OVERLAY_MMC_TI_ARGS \
-	"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;\0" \
-
 #define BOOT_TARGET_DEVICES(func) \
 	func(TI_MMC, ti_mmc, na) \
 	func(MMC, mmc, 0) \
@@ -265,24 +55,6 @@
 #include <config_distro_bootcmd.h>
 
 #define CFG_EXTRA_ENV_SETTINGS \
-	DEFAULT_LINUX_BOOT_ENV \
-	DEFAULT_MMC_TI_ARGS \
-	"bootpart=0:2\0" \
-	"bootdir=/boot\0" \
-	"get_name_kern=" \
-	"if test $boot_fit -eq 1; then " \
-		"setenv bootfile fitImage; " \
-	"else " \
-		"setenv bootfile zImage; " \
-	"fi\0" \
-	DEFAULT_FIT_TI_ARGS \
-	"get_fit_config=setenv name_fit_config ${fdtfile}\0" \
-	DEFAULT_COMMON_BOOT_TI_ARGS \
-	DEFAULT_FDT_TI_ARGS \
-	GET_OVERLAY_MMC_TI_ARGS \
-	DFUARGS \
-	NETARGS \
-	NANDARGS \
 	BOOTENV
 
 /*
diff --git a/include/env/ti/dfu.env b/include/env/ti/dfu.env
new file mode 100644
index 00000000000..b925730c6f5
--- /dev/null
+++ b/include/env/ti/dfu.env
@@ -0,0 +1,53 @@
+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
+
+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
+
+#if CONFIG_MTD_RAW_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
+#endif
+
+dfu_alt_info_ram=
+	kernel ram 0x80200000 0x4000000;
+	fdt ram 0x80f80000 0x80000;
+	ramdisk ram 0x81000000 0x4000000
+
+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
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/4] board: ti: am57xx: Change to using .env
  2025-09-01  6:16 [PATCH v2 0/4] AM57 boot fixes Anurag Dutta
  2025-09-01  6:16 ` [PATCH v2 1/4] include: env: ti: Use .env for environment variables Anurag Dutta
@ 2025-09-01  6:16 ` Anurag Dutta
  2025-09-01  6:16 ` [PATCH v2 3/4] board: ti: am57xx: Set fdtfile from C code instead of findfdt script Anurag Dutta
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Anurag Dutta @ 2025-09-01  6:16 UTC (permalink / raw)
  To: trini, n-francis; +Cc: u-kumar1, u-boot, a-dutta

Move to using .env file for setting up environment variables
for am57xx and dra7xx.

Signed-off-by: Anurag Dutta <a-dutta@ti.com>
---
 board/ti/am57xx/Kconfig      |  12 +++
 board/ti/am57xx/am57xx.env   | 162 +++++++++++++++++++++++++++++++++++
 include/configs/am57xx_evm.h |  19 +---
 include/configs/dra7xx_evm.h |  24 ------
 4 files changed, 175 insertions(+), 42 deletions(-)
 create mode 100644 board/ti/am57xx/am57xx.env

diff --git a/board/ti/am57xx/Kconfig b/board/ti/am57xx/Kconfig
index 0c566820158..b6943938391 100644
--- a/board/ti/am57xx/Kconfig
+++ b/board/ti/am57xx/Kconfig
@@ -9,6 +9,18 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
 	default "am57xx_evm"
 
+config ENV_SOURCE_FILE
+	default "am57xx"
+
+source "board/ti/common/Kconfig"
+
+endif
+
+if TARGET_DRA7XX_EVM
+
+config ENV_SOURCE_FILE
+	default "am57xx"
+
 source "board/ti/common/Kconfig"
 
 endif
diff --git a/board/ti/am57xx/am57xx.env b/board/ti/am57xx/am57xx.env
new file mode 100644
index 00000000000..7d029a3e859
--- /dev/null
+++ b/board/ti/am57xx/am57xx.env
@@ -0,0 +1,162 @@
+#include <env/ti/ti_common.env>
+#include <env/ti/mmc.env>
+#include <env/ti/dfu.env>
+
+bootpart=0:2
+bootdir=/boot
+get_name_kern=
+	if test $boot_fit -eq 1; then
+		setenv bootfile fitImage;
+	else
+		setenv bootfile zImage;
+	fi
+get_fit_config=setenv name_fit_config ${fdtfile}
+console=ttyS2,115200n8
+fdtfile=undefined
+finduuid=part uuid mmc 0:2 uuid
+usbtty=cdc_acm
+vram=16M
+
+#if CONFIG_CMD_AVB
+avb_verify=avb init 1; avb verify $slot_suffix;
+#endif
+
+partitions=uuid_disk=${uuid_gpt_disk};
+	name=bootloader,start=384K,size=1792K,uuid=${uuid_gpt_bootloader};
+	name=rootfs,start=2688K,size=-,uuid=${uuid_gpt_rootfs}
+	partitions_android=
+	uuid_disk=${uuid_gpt_disk};
+	name=xloader,start=128K,size=256K,uuid=${uuid_gpt_xloader};
+	name=bootloader,size=2048K,uuid=${uuid_gpt_bootloader};
+	name=uboot-env,start=2432K,size=256K,uuid=${uuid_gpt_reserved};
+	name=misc,size=128K,uuid=${uuid_gpt_misc};
+	name=boot_a,size=20M,uuid=${uuid_gpt_boot_a};
+	name=boot_b,size=20M,uuid=${uuid_gpt_boot_b};
+	name=dtbo_a,size=8M,uuid=${uuid_gpt_dtbo_a};
+	name=dtbo_b,size=8M,uuid=${uuid_gpt_dtbo_b};
+	name=vbmeta_a,size=64K,uuid=${uuid_gpt_vbmeta_a};
+	name=vbmeta_b,size=64K,uuid=${uuid_gpt_vbmeta_b};
+	name=recovery,size=64M,uuid=${uuid_gpt_recovery};
+	name=super,size=2560M,uuid=${uuid_gpt_super};
+	name=metadata,size=16M,uuid=${uuid_gpt_metadata};
+	name=userdata,size=-,uuid=${uuid_gpt_userdata}
+optargs=
+dofastboot=0
+emmc_android_boot=
+	setenv mmcdev 1;
+	mmc dev $mmcdev;
+	mmc rescan;
+#if CONFIG_CMD_BCB
+#if CONFIG_ANDROID_AB
+	if part number mmc 1 misc control_part_number; then
+		echo "misc partition number:${control_part_number};"
+		bcb ab_select slot_name mmc ${mmcdev}:${control_part_number};
+	else
+		echo "misc partition not found;"
+		exit;
+	fi;
+	setenv slot_suffix _${slot_name};
+#endif
+#endif
+if bcb load CONFIG_FASTBOOT_FLASH_MMC_DEV misc; then
+	setenv ardaddr -;
+	if bcb test command = bootonce-bootloader; then
+		echo "Android: Bootloader boot...";
+		bcb clear command; bcb store;
+		fastboot 1;
+		exit;
+	elif bcb test command = boot-recovery; then
+		echo "Android: Recovery boot...";
+		setenv ardaddr $loadaddr;
+		setenv apart recovery;
+	else
+		echo "Android: Normal boot...";
+		setenv ardaddr $loadaddr;
+		setenv apart boot${slot_suffix};
+	fi;
+else
+	echo "Warning: BCB is corrupted or does not exist";
+	echo "Android: Normal boot...";
+fi;
+setenv eval_bootargs setenv bootargs $bootargs;
+run eval_bootargs;
+setenv machid fe6;
+#if CONFIG_CMD_AVB
+if run avb_verify; then
+	echo "AVB verification OK.";
+	set bootargs $bootargs $avb_bootargs;
+else
+	echo "AVB verification failed.";
+	exit;
+fi;
+#endif
+#if CONFIG_CMD_BCB
+#if CONFIG_ANDROID_AB
+setenv bootargs_ab androidboot.slot_suffix=${slot_suffix};
+echo "A/B cmdline addition: ${bootargs_ab}";
+setenv bootargs ${bootargs} ${bootargs_ab};
+#endif
+#endif
+if part start mmc $mmcdev $apart boot_start; then
+	part size mmc $mmcdev $apart boot_size;
+	mmc read $loadaddr $boot_start $boot_size;
+	echo "Preparing FDT...";
+	if test $board_name = am57xx_evm_reva3; then
+		echo "  Reading DTBO partition...";
+		part start mmc ${mmcdev} dtbo${slot_suffix} p_dtbo_start;
+		part size mmc ${mmcdev} dtbo${slot_suffix} p_dtbo_size;
+		mmc read ${dtboaddr} ${p_dtbo_start} ${p_dtbo_size};
+		echo "  Reading DTB for AM57x EVM RevA3...";
+		abootimg get dtb --index=0 dtb_start dtb_size;
+		cp.b $dtb_start $fdtaddr $dtb_size;
+		fdt addr $fdtaddr 0x80000;
+		echo "  Applying DTBOs for AM57x EVM RevA3...";
+		adtimg addr $dtboaddr;
+		adtimg get dt --index=0 dtbo0_addr dtbo0_size;
+		fdt apply $dtbo0_addr;
+		adtimg get dt --index=1 dtbo1_addr dtbo1_size;
+		fdt apply $dtbo1_addr;
+	elif test $board_name = beagle_x15_revc; then
+		echo "  Reading DTB for Beagle X15 RevC...";
+		abootimg get dtb --index=0 dtb_start dtb_size;
+		cp.b $dtb_start $fdtaddr $dtb_size;
+		fdt addr $fdtaddr 0x80000;
+	else
+		echo "Error: Android boot is not supported for $board_name";
+		exit;
+	fi;
+	bootm $loadaddr $ardaddr $fdtaddr;
+else
+	echo "$apart partition not found";
+	exit;
+fi;
+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;
+#if CONFIG_CMD_NET
+static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off
+nfsopts=nolock
+rootpath=/export/rootfs
+netloadimage=tftp ${loadaddr} ${bootfile}
+netloadfdt=tftp ${fdtaddr} ${fdtfile}
+netargs=setenv bootargs console=${console} ${optargs}
+	root=/dev/nfs
+	nfsroot=${serverip}:${rootpath},${nfsopts} rw
+	ip=dhcp
+netboot=echo Booting from network ...;
+	setenv autoload no;
+	dhcp;
+	run netloadimage;
+	run netloadfdt;
+	run netargs;
+	bootz ${loadaddr} - ${fdtaddr}
+#endif
+#if CONFIG_MTD_RAW_NAND
+#include <env/ti/nand.env>
+#endif
+dfu_bufsiz=0x10000
diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h
index 266b77fbf68..8c29c940478 100644
--- a/include/configs/am57xx_evm.h
+++ b/include/configs/am57xx_evm.h
@@ -11,30 +11,13 @@
 #ifndef __CONFIG_AM57XX_EVM_H
 #define __CONFIG_AM57XX_EVM_H
 
-#include <env/ti/dfu.h>
 #include <linux/sizes.h>
 
 #define CFG_SYS_NS16550_COM1		UART1_BASE	/* Base EVM has UART0 */
 #define CFG_SYS_NS16550_COM2		UART2_BASE	/* UART2 */
 #define CFG_SYS_NS16550_COM3		UART3_BASE	/* UART3 */
 
-#ifndef CONFIG_XPL_BUILD
-#define DFUARGS \
-	"dfu_bufsiz=0x10000\0" \
-	DFU_ALT_INFO_MMC \
-	DFU_ALT_INFO_EMMC \
-	DFU_ALT_INFO_RAM \
-	DFU_ALT_INFO_QSPI
-#else
-#ifdef CONFIG_SPL_DFU
-#define DFUARGS \
-	"dfu_bufsiz=0x10000\0" \
-	DFU_ALT_INFO_RAM
-#endif
-#endif
-
-#include <configs/ti_omap5_common.h>
-
 /* CPSW Ethernet */
 
+#include <configs/ti_omap5_common.h>
 #endif /* __CONFIG_AM57XX_EVM_H */
diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h
index 3c960ca2ce2..9df7ef055bf 100644
--- a/include/configs/dra7xx_evm.h
+++ b/include/configs/dra7xx_evm.h
@@ -11,40 +11,16 @@
 #ifndef __CONFIG_DRA7XX_EVM_H
 #define __CONFIG_DRA7XX_EVM_H
 
-#include <env/ti/dfu.h>
-
 #define CFG_MAX_MEM_MAPPED		0x80000000
 
 #ifndef CONFIG_QSPI_BOOT
 /* MMC ENV related defines */
 #endif
 
-#if (CONFIG_CONS_INDEX == 1)
-#define CONSOLEDEV			"ttyS0"
-#elif (CONFIG_CONS_INDEX == 3)
-#define CONSOLEDEV			"ttyS2"
-#endif
 #define CFG_SYS_NS16550_COM1		UART1_BASE	/* Base EVM has UART0 */
 #define CFG_SYS_NS16550_COM2		UART2_BASE	/* UART2 */
 #define CFG_SYS_NS16550_COM3		UART3_BASE	/* UART3 */
 
-#ifndef CONFIG_XPL_BUILD
-#define DFUARGS \
-	"dfu_bufsiz=0x10000\0" \
-	DFU_ALT_INFO_MMC \
-	DFU_ALT_INFO_EMMC \
-	DFU_ALT_INFO_RAM \
-	DFU_ALT_INFO_QSPI
-#endif
-
-#ifdef CONFIG_XPL_BUILD
-#ifdef CONFIG_SPL_DFU
-#define DFUARGS \
-	"dfu_bufsiz=0x10000\0" \
-	DFU_ALT_INFO_RAM
-#endif
-#endif
-
 #include <configs/ti_omap5_common.h>
 
 /* NAND support */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/4] board: ti: am57xx: Set fdtfile from C code instead of findfdt script
  2025-09-01  6:16 [PATCH v2 0/4] AM57 boot fixes Anurag Dutta
  2025-09-01  6:16 ` [PATCH v2 1/4] include: env: ti: Use .env for environment variables Anurag Dutta
  2025-09-01  6:16 ` [PATCH v2 2/4] board: ti: am57xx: Change to using .env Anurag Dutta
@ 2025-09-01  6:16 ` Anurag Dutta
  2025-09-01  6:16 ` [PATCH v2 4/4] board: ti: dra7xx: " Anurag Dutta
  2025-09-01 15:48 ` [PATCH v2 0/4] AM57 boot fixes Tom Rini
  4 siblings, 0 replies; 7+ messages in thread
From: Anurag Dutta @ 2025-09-01  6:16 UTC (permalink / raw)
  To: trini, n-francis; +Cc: u-kumar1, u-boot, a-dutta

We now can provide a map and have the standard fdtfile variable set from
code itself. This allows for bootstd to "just work".

Signed-off-by: Anurag Dutta <a-dutta@ti.com>
---
 board/ti/am57xx/board.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index fc0d87daae4..4091601d4f2 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -42,6 +42,7 @@
 
 #include "../common/board_detect.h"
 #include "../common/cape_detect.h"
+#include "../common/fdt_ops.h"
 #include "mux_data.h"
 
 #ifdef CONFIG_SUPPORT_EMMC_BOOT
@@ -577,6 +578,18 @@ void do_board_detect(void)
 			 "Board: %s REV %s\n", bname, board_ti_get_rev());
 }
 
+static struct ti_fdt_map ti_omap_am57_evm_fdt_map[] = {
+	{"beagle_x15", "ti/omap/am57xx-beagle-x15.dtb"},
+	{"beagle_x15_revb1", "ti/omap/am57xx-beagle-x15-revb1.dtb"},
+	{"beagle_x15_revc", "ti/omap/am57xx-beagle-x15-revc.dtb"},
+	{"am5729_beagleboneai", "ti/omap/am5729-beagleboneai.dtb"},
+	{"am572x_idk", "ti/omap/am572x-idk.dtb"},
+	{"am574x_idk", "ti/omap/am574x-idk.dtb"},
+	{"am57xx_evm", "ti/omap/am57xx-beagle-x15.dtb"},
+	{"am57xx_evm_reva3", "ti/omap/am57xx-beagle-x15.dtb"},
+	{"am571x_idk", "ti/omap/am571x-idk.dtb"},
+};
+
 static void setup_board_eeprom_env(void)
 {
 	char *name = "beagle_x15";
@@ -614,6 +627,7 @@ static void setup_board_eeprom_env(void)
 
 invalid_eeprom:
 	set_board_info_env(name);
+	ti_set_fdt_env(name, ti_omap_am57_evm_fdt_map);
 }
 
 #endif	/* CONFIG_XPL_BUILD */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 4/4] board: ti: dra7xx: Set fdtfile from C code instead of findfdt script
  2025-09-01  6:16 [PATCH v2 0/4] AM57 boot fixes Anurag Dutta
                   ` (2 preceding siblings ...)
  2025-09-01  6:16 ` [PATCH v2 3/4] board: ti: am57xx: Set fdtfile from C code instead of findfdt script Anurag Dutta
@ 2025-09-01  6:16 ` Anurag Dutta
  2025-09-01 15:48 ` [PATCH v2 0/4] AM57 boot fixes Tom Rini
  4 siblings, 0 replies; 7+ messages in thread
From: Anurag Dutta @ 2025-09-01  6:16 UTC (permalink / raw)
  To: trini, n-francis; +Cc: u-kumar1, u-boot, a-dutta

We now can provide a map and have the standard fdtfile variable set from
code itself. This allows for bootstd to "just work".

Signed-off-by: Anurag Dutta <a-dutta@ti.com>
---
 board/ti/dra7xx/evm.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index 98d63e14e29..0966db2bb62 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -38,6 +38,7 @@
 
 #include "mux_data.h"
 #include "../common/board_detect.h"
+#include "../common/fdt_ops.h"
 
 #define board_is_dra76x_evm()		board_ti_is("DRA76/7x")
 #define board_is_dra74x_evm()		board_ti_is("5777xCPU")
@@ -665,6 +666,15 @@ static int device_okay(const char *path)
 }
 #endif
 
+static struct ti_fdt_map ti_omap_dra7_evm_fdt_map[] = {
+	{"omap5_uevm", "ti/omap/omap5-uevm.dtb"},
+	{"dra7xx", "ti/omap/dra7-evm.dtb"},
+	{"dra72x-revc", "ti/omap/dra72-evm-revc.dtb"},
+	{"dra72x", "ti/omap/dra72-evm.dtb"},
+	{"dra71x", "ti/omap/dra71-evm.dtb"},
+	{"dra76x_acd", "ti/omap/dra76-evm.dtb"},
+};
+
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
@@ -686,6 +696,7 @@ int board_late_init(void)
 	}
 
 	set_board_info_env(name);
+	ti_set_fdt_env(name, ti_omap_dra7_evm_fdt_map);
 
 	/*
 	 * Default FIT boot on HS devices. Non FIT images are not allowed
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/4] AM57 boot fixes
  2025-09-01  6:16 [PATCH v2 0/4] AM57 boot fixes Anurag Dutta
                   ` (3 preceding siblings ...)
  2025-09-01  6:16 ` [PATCH v2 4/4] board: ti: dra7xx: " Anurag Dutta
@ 2025-09-01 15:48 ` Tom Rini
  2025-09-02 10:35   ` Dutta, Anurag
  4 siblings, 1 reply; 7+ messages in thread
From: Tom Rini @ 2025-09-01 15:48 UTC (permalink / raw)
  To: Anurag Dutta; +Cc: n-francis, u-kumar1, u-boot

[-- Attachment #1: Type: text/plain, Size: 617 bytes --]

On Mon, Sep 01, 2025 at 11:46:55AM +0530, Anurag Dutta wrote:

> Hi all
> This patch series migrates from .h to .env format for am57xx/dra7xx.
> Also, we do relevant changes so that the fdtfile can be set from C code.
> 
> logs : https://gist.github.com/anuragdutta731/82560cc9bc958ca70a25a95a7031eeea
> 
> Changelog: v1:
> 1. Converted to plain text environment for am57 and dra7
> 2. Added dra7 support as well
> 
> Link to v1:
> https://lore.kernel.org/all/20250425053431.1622267-1-a-dutta@ti.com/

Is this a fixes that needs to come in for v2025.10 or a cleanup for
v2026.01? Thanks.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/4] AM57 boot fixes
  2025-09-01 15:48 ` [PATCH v2 0/4] AM57 boot fixes Tom Rini
@ 2025-09-02 10:35   ` Dutta, Anurag
  0 siblings, 0 replies; 7+ messages in thread
From: Dutta, Anurag @ 2025-09-02 10:35 UTC (permalink / raw)
  To: Tom Rini; +Cc: n-francis, u-kumar1, u-boot


On 01-09-2025 21:18, Tom Rini wrote:
> On Mon, Sep 01, 2025 at 11:46:55AM +0530, Anurag Dutta wrote:
>
>> Hi all
>> This patch series migrates from .h to .env format for am57xx/dra7xx.
>> Also, we do relevant changes so that the fdtfile can be set from C code.
>>
>> logs : https://gist.github.com/anuragdutta731/82560cc9bc958ca70a25a95a7031eeea
>>
>> Changelog: v1:
>> 1. Converted to plain text environment for am57 and dra7
>> 2. Added dra7 support as well
>>
>> Link to v1:
>> https://lore.kernel.org/all/20250425053431.1622267-1-a-dutta@ti.com/
> Is this a fixes that needs to come in for v2025.10 or a cleanup for
> v2026.01? Thanks.
>
> The patch series contains both fixes as well as code cleanup.
> So, it needs to come in v2025.10
>
> Regards
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-09-02 10:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-01  6:16 [PATCH v2 0/4] AM57 boot fixes Anurag Dutta
2025-09-01  6:16 ` [PATCH v2 1/4] include: env: ti: Use .env for environment variables Anurag Dutta
2025-09-01  6:16 ` [PATCH v2 2/4] board: ti: am57xx: Change to using .env Anurag Dutta
2025-09-01  6:16 ` [PATCH v2 3/4] board: ti: am57xx: Set fdtfile from C code instead of findfdt script Anurag Dutta
2025-09-01  6:16 ` [PATCH v2 4/4] board: ti: dra7xx: " Anurag Dutta
2025-09-01 15:48 ` [PATCH v2 0/4] AM57 boot fixes Tom Rini
2025-09-02 10:35   ` Dutta, Anurag

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).