[PATCH v2 4/4] board: am65x: Use generic AM6x board detection function

Guillaume La Roque (TI.com)
2025-10-24T14:17:57Z

Replace the board-specific implementation of do_board_detect()
with a call to the generic do_board_detect_am6() function to
avoid code duplication across AM6x family boards.

The generic function provides the same functionality with
additional fallback logic to try alternate EEPROM addresses.

Signed-off-by: Guillaume La Roque (TI.com) <glaroque@baylibre.com>
---
board/ti/am65x/evm.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/board/ti/am65x/evm.c b/board/ti/am65x/evm.c
index 5c45a33eac9..68606746d5f 100644
--- a/board/ti/am65x/evm.c
+++ b/board/ti/am65x/evm.c
@@ -72,24 +72,11 @@ int board_fit_config_name_match(const char *name)
#endif

#ifdef CONFIG_TI_I2C_BOARD_DETECT
-int do_board_detect(void)
-{
- int ret;
-
- ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
- CONFIG_EEPROM_CHIP_ADDRESS);
- if (ret)
- pr_err("Reading on-board EEPROM at 0x%02x failed %d\n",
- CONFIG_EEPROM_CHIP_ADDRESS, ret);
-
- return ret;
-}
-
int checkboard(void)
{
struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;

- if (do_board_detect())
+ if (do_board_detect_am6())
/* EEPROM not populated */
printf("Board: %s rev %s\n", "AM6-COMPROCEVM", "E3");
else
@@ -102,7 +89,7 @@ static void setup_board_eeprom_env(void)
{
char *name = "am65x";

- if (do_board_detect())
+ if (do_board_detect_am6())
goto invalid_eeprom;

if (board_is_am65x_base_board())

--
2.34.1