AM57 boot fixes
v2 cover AM57 boot fixes
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/[email protected]/
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
Signature · 1 line
2.34.1
PATCH v2 1/4 include: env: ti: Use .env for environment variables
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.
--- 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
include/configs/ti_omap5_common.h +0 -228
@@ -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/*
include/env/ti/dfu.env new file +53 -0
53 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v2 2/4 board: ti: am57xx: Change to using .env
In reply to Anurag DuttaMove to using .env file for setting up environment variables for am57xx and dra7xx.
--- 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
board/ti/am57xx/Kconfig +12 -0
@@ -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
board/ti/am57xx/am57xx.env new file +162 -0
162 lines not on this page · raw message
include/configs/am57xx_evm.h +1 -18
@@ -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 */
include/configs/dra7xx_evm.h +0 -24
@@ -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 */
Signature · 1 line
2.34.1
PATCH v2 3/4 board: ti: am57xx: Set fdtfile from C code instead of findfdt script
In reply to Anurag DuttaWe now can provide a map and have the standard fdtfile variable set from code itself. This allows for bootstd to "just work".
--- board/ti/am57xx/board.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
board/ti/am57xx/board.c +14 -0
@@ -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 */
Signature · 1 line
2.34.1
PATCH v2 4/4 board: ti: dra7xx: Set fdtfile from C code instead of findfdt script
In reply to Anurag DuttaWe now can provide a map and have the standard fdtfile variable set from code itself. This allows for bootstd to "just work".
--- board/ti/dra7xx/evm.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
board/ti/dra7xx/evm.c +11 -0
@@ -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
Signature · 1 line
2.34.1
Quoted 4 lines · Anurag 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.
Quoted 8 lines
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
Is this a fixes that needs to come in for v2025.10 or a cleanup for v2026.01? Thanks.
Signature · 1 line
Tom
Quoted 22 lines · Tom Rini
Quoted 4 lines · Anurag 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.Quoted 8 lines
logs : https://gist.github.com/anuragdutta731/82560cc9bc958ca70a25a95a7031eeea
Changelog: v1:
1. Converted to plain text environment for am57 and dra7
2. Added dra7 support as wellIs 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
Quoted 10 lines · Anurag Dutta
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[...]
Applied to u-boot/master, thanks!
[1/4] include: env: ti: Use .env for environment variables
commit: 5138d3a561dc9441f956378aa649f7804874e8b8
[2/4] board: ti: am57xx: Change to using .env
commit: bc020bf53adca747a533a364969bc6396ef58b13
[3/4] board: ti: am57xx: Set fdtfile from C code instead of findfdt script
commit: 649f4a7d3ca753991c27c9c159a0aacc9954d96f
[4/4] board: ti: dra7xx: Set fdtfile from C code instead of findfdt script
commit: 878888fd07bab1ed97f7f0fef7f6e93269074da4Signature · 1 line
Tom