[PATCH 06/11] board: ti: j721s2: Add support for detecting multiple device trees

Sinthu Raja sinthu.raja at mistralsolutions.com
Thu Oct 27 12:48:41 CEST 2022


From: Sinthu Raja <sinthu.raja at ti.com>

Update the board_fit_config_name_match() to choose the right dtb
based on the board name read from EEPROM.

Also restrict multpile EEPROM reads by verifying if EEPROM is already
read

Signed-off-by: Sinthu Raja <sinthu.raja at ti.com>
---
 board/ti/j721s2/evm.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/board/ti/j721s2/evm.c b/board/ti/j721s2/evm.c
index 8ada924e3f..25667900ce 100644
--- a/board/ti/j721s2/evm.c
+++ b/board/ti/j721s2/evm.c
@@ -79,8 +79,17 @@ int dram_init_banksize(void)
 #ifdef CONFIG_SPL_LOAD_FIT
 int board_fit_config_name_match(const char *name)
 {
-	if (!strcmp(name, "k3-j721s2-common-proc-board"))
-		return 0;
+	bool eeprom_read = board_ti_was_eeprom_read();
+
+	if (!eeprom_read || board_is_j721s2_som()) {
+		if (!strcmp(name, "k3-j721s2-common-proc-board") ||
+		    !strcmp(name, "k3-j721s2-r5-common-proc-board"))
+			return 0;
+	} else if (!eeprom_read || board_is_am68_sk_som()) {
+		if (!strcmp(name, "k3-am68-sk-base-board") ||
+		    !strcmp(name, "k3-am68-sk-r5-base-board"))
+			return 0;
+	}
 
 	return -1;
 }
@@ -107,6 +116,9 @@ int do_board_detect(void)
 {
 	int ret;
 
+	if (board_ti_was_eeprom_read())
+		return 0;
+
 	ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
 					 CONFIG_EEPROM_CHIP_ADDRESS);
 	if (ret) {
-- 
2.36.1



More information about the U-Boot mailing list