board: am65x: Use generic AM6x board detection function
authorGuillaume La Roque (TI.com) <glaroque@baylibre.com>
Mon, 3 Nov 2025 18:40:05 +0000 (19:40 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 7 Nov 2025 22:06:40 +0000 (16:06 -0600)
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.

Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Signed-off-by: Guillaume La Roque (TI.com) <glaroque@baylibre.com>
board/ti/am65x/evm.c

index 5c45a33..6860674 100644 (file)
@@ -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())