diff mbox series

[08/17] board: ti: j721e: Add support for detecting multiple device trees

Message ID 20210626145602.15702-9-sinthu.raja@ti.com
State Changes Requested
Delegated to: Lokesh Vutla
Headers show
Series arm: k3-j721e: Add support for J721E EAIK | expand

Commit Message

Sinthu Raja June 26, 2021, 2:55 p.m. UTC
From: Amarnath MB <amarnath.mb@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: Amarnath MB <amarnath.mb@ti.com>
Signed-off-by: Sinthu Raja <sinthu.raja@ti.com>
---
 board/ti/j721e/evm.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
index 0de22da5b7..39db148321 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/evm.c
@@ -85,8 +85,17 @@  int dram_init_banksize(void)
 #ifdef CONFIG_SPL_LOAD_FIT
 int board_fit_config_name_match(const char *name)
 {
-	if (!strcmp(name, "k3-j721e-common-proc-board"))
-		return 0;
+	bool eeprom_read = board_ti_was_eeprom_read();
+
+	if (!eeprom_read || board_is_j721e_som()) {
+		if (!strcmp(name, "k3-j721e-common-proc-board") ||
+		    !strcmp(name, "k3-j721e-r5-common-proc-board"))
+			return 0;
+	} else if (board_is_j721e_eaik()) {
+		if (!strcmp(name, "k3-j721e-eaik") ||
+		    !strcmp(name, "k3-j721e-r5-eaik"))
+			return 0;
+	}
 
 	return -1;
 }
@@ -150,6 +159,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) {