* [PATCH v2 0/4] board: ti: am62x: Add EEPROM support and refactor board detection
@ 2025-10-24 14:17 Guillaume La Roque (TI.com)
2025-10-24 14:17 ` [PATCH v2 1/4] board: ti: common: Add generic AM6x board detection functions Guillaume La Roque (TI.com)
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Guillaume La Roque (TI.com) @ 2025-10-24 14:17 UTC (permalink / raw)
To: u-boot, Anshul Dalal, Bryan Brattlof
Cc: Tom Rini, Garrett Giordano, Wadim Egorov, Neha Malcom Francis,
Mattijs Korpershoek, Ilias Apalodimas, Santhosh Kumar K,
Jonathan Humphreys, Sam Protsenko, Devarsh Thakkar,
Prasanth Babu Mantena, Judith Mendez, Marek Vasut, Dhruva Gole,
Andrew Davis, Vignesh Raghavendra, Neil Armstrong, Aashvij Shenai,
Peng Fan, Guillaume La Roque (TI.com)
This series adds EEPROM board detection support for AM62x and refactors
the board detection code across AM6x family boards to eliminate code
duplication.
The series introduces two new generic functions for AM6x boards:
- do_board_detect_am6(): Reads the on-board EEPROM with fallback logic
to alternate I2C addresses
- setup_serial_am6(): Sets up the serial number environment variable
from EEPROM data
Signed-off-by: Guillaume La Roque (TI.com) <glaroque@baylibre.com>
---
Changes in v2:
- Create Generic function
- migrate am64 and am65 on it
- Link to v1: https://lore.kernel.org/r/20251017-am62xeeprom-v1-1-31f83124189f@baylibre.com
---
Guillaume La Roque (TI.com) (4):
board: ti: common: Add generic AM6x board detection functions
board: am62x: Add support for reading eeprom data
board: am64x: Use generic AM6x board detection functions
board: am65x: Use generic AM6x board detection function
arch/arm/mach-k3/am62x/Kconfig | 3 +++
board/ti/am62x/evm.c | 54 +++++++++++++++++++++++++++++++++++++++++-
board/ti/am64x/evm.c | 45 +++--------------------------------
board/ti/am65x/evm.c | 17 ++-----------
board/ti/common/board_detect.c | 43 +++++++++++++++++++++++++++++++++
board/ti/common/board_detect.h | 22 +++++++++++++++++
configs/am62x_evm_r5_defconfig | 1 +
7 files changed, 127 insertions(+), 58 deletions(-)
---
base-commit: 6a56d10fdcf1309d2070b62dc15e80a047da971b
change-id: 20251016-am62xeeprom-41a1920b8bd2
Best regards,
--
Guillaume La Roque (TI.com) <glaroque@baylibre.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v2 1/4] board: ti: common: Add generic AM6x board detection functions
2025-10-24 14:17 [PATCH v2 0/4] board: ti: am62x: Add EEPROM support and refactor board detection Guillaume La Roque (TI.com)
@ 2025-10-24 14:17 ` Guillaume La Roque (TI.com)
2025-10-27 16:10 ` Mattijs Korpershoek
2025-10-24 14:17 ` [PATCH v2 2/4] board: am62x: Add support for reading eeprom data Guillaume La Roque (TI.com)
` (2 subsequent siblings)
3 siblings, 1 reply; 11+ messages in thread
From: Guillaume La Roque (TI.com) @ 2025-10-24 14:17 UTC (permalink / raw)
To: u-boot, Anshul Dalal, Bryan Brattlof
Cc: Tom Rini, Garrett Giordano, Wadim Egorov, Neha Malcom Francis,
Mattijs Korpershoek, Ilias Apalodimas, Santhosh Kumar K,
Jonathan Humphreys, Sam Protsenko, Devarsh Thakkar,
Prasanth Babu Mantena, Judith Mendez, Marek Vasut, Dhruva Gole,
Andrew Davis, Vignesh Raghavendra, Neil Armstrong, Aashvij Shenai,
Peng Fan, Guillaume La Roque (TI.com)
Add two new generic functions for AM6x family boards to simplify
board-specific implementations:
- do_board_detect_am6(): Generic board detection function that reads
the on-board EEPROM. It first attempts to read at the configured
address, and if that fails, tries the alternate address
(CONFIG_EEPROM_CHIP_ADDRESS + 1). This provides a common
implementation that can be used across different AM6x boards.
- setup_serial_am6(): Sets up the serial number environment variable
from the EEPROM data. The serial number is converted from
hexadecimal string format to a 16-character hexadecimal
representation and stored in the "serial#" environment variable.
Both functions are protected by CONFIG_IS_ENABLED(TI_I2C_BOARD_DETECT)
and are designed to be used by AM62x, AM64x, AM65x, and other AM6x
family boards.
Signed-off-by: Guillaume La Roque (TI.com) <glaroque@baylibre.com>
---
board/ti/common/board_detect.c | 43 ++++++++++++++++++++++++++++++++++++++++++
board/ti/common/board_detect.h | 22 +++++++++++++++++++++
2 files changed, 65 insertions(+)
diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c
index a43cc075b92..d49e26fa453 100644
--- a/board/ti/common/board_detect.c
+++ b/board/ti/common/board_detect.c
@@ -824,3 +824,46 @@ bool __maybe_unused board_ti_was_eeprom_read(void)
else
return false;
}
+
+#if CONFIG_IS_ENABLED(TI_I2C_BOARD_DETECT)
+int do_board_detect_am6(void)
+{
+ int ret;
+
+ ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
+ CONFIG_EEPROM_CHIP_ADDRESS);
+ if (ret) {
+ printf("EEPROM not available at 0x%02x, trying to read at 0x%02x\n",
+ CONFIG_EEPROM_CHIP_ADDRESS,
+ CONFIG_EEPROM_CHIP_ADDRESS + 1);
+ ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
+ CONFIG_EEPROM_CHIP_ADDRESS +
+ 1);
+ if (ret)
+ pr_err("Reading on-board EEPROM at 0x%02x failed %d\n",
+ CONFIG_EEPROM_CHIP_ADDRESS + 1, ret);
+ }
+
+ return ret;
+}
+
+void setup_serial_am6(void)
+{
+ struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
+ unsigned long board_serial;
+ char *endp;
+ char serial_string[17] = { 0 };
+
+ if (env_get("serial#"))
+ return;
+
+ board_serial = simple_strtoul(ep->serial, &endp, 16);
+ if (*endp != '\0') {
+ pr_err("Error: Can't set serial# to %s\n", ep->serial);
+ return;
+ }
+
+ snprintf(serial_string, sizeof(serial_string), "%016lx", board_serial);
+ env_set("serial#", serial_string);
+}
+#endif
diff --git a/board/ti/common/board_detect.h b/board/ti/common/board_detect.h
index b057f3b2269..26ada2a449c 100644
--- a/board/ti/common/board_detect.h
+++ b/board/ti/common/board_detect.h
@@ -313,6 +313,28 @@ int __maybe_unused ti_i2c_eeprom_am6_get(int bus_addr, int dev_addr,
*/
int __maybe_unused ti_i2c_eeprom_am6_get_base(int bus_addr, int dev_addr);
+/**
+ * do_board_detect_am6() - Detect AM6x board and read EEPROM data
+ *
+ * This is a generic board detection function for AM6x family boards.
+ * It attempts to read the on-board EEPROM at the configured address,
+ * and if that fails, tries the alternate address (CONFIG_EEPROM_CHIP_ADDRESS + 1).
+ *
+ * Return: 0 on success or corresponding error on failure.
+ */
+int do_board_detect_am6(void);
+
+/**
+ * setup_serial_am6() - Setup serial number environment variable for AM6x boards
+ *
+ * This function reads the serial number from the AM6x EEPROM data and
+ * sets the "serial#" environment variable. The serial number is converted
+ * from hexadecimal string format to a 16-character hexadecimal representation.
+ *
+ * EEPROM should be already read before calling this function.
+ */
+void setup_serial_am6(void);
+
#ifdef CONFIG_TI_I2C_BOARD_DETECT
/**
* board_ti_is() - Board detection logic for TI EVMs
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 2/4] board: am62x: Add support for reading eeprom data
2025-10-24 14:17 [PATCH v2 0/4] board: ti: am62x: Add EEPROM support and refactor board detection Guillaume La Roque (TI.com)
2025-10-24 14:17 ` [PATCH v2 1/4] board: ti: common: Add generic AM6x board detection functions Guillaume La Roque (TI.com)
@ 2025-10-24 14:17 ` Guillaume La Roque (TI.com)
2025-10-27 16:13 ` Mattijs Korpershoek
2025-10-27 18:08 ` Andrew Davis
2025-10-24 14:17 ` [PATCH v2 3/4] board: am64x: Use generic AM6x board detection functions Guillaume La Roque (TI.com)
2025-10-24 14:17 ` [PATCH v2 4/4] board: am65x: Use generic AM6x board detection function Guillaume La Roque (TI.com)
3 siblings, 2 replies; 11+ messages in thread
From: Guillaume La Roque (TI.com) @ 2025-10-24 14:17 UTC (permalink / raw)
To: u-boot, Anshul Dalal, Bryan Brattlof
Cc: Tom Rini, Garrett Giordano, Wadim Egorov, Neha Malcom Francis,
Mattijs Korpershoek, Ilias Apalodimas, Santhosh Kumar K,
Jonathan Humphreys, Sam Protsenko, Devarsh Thakkar,
Prasanth Babu Mantena, Judith Mendez, Marek Vasut, Dhruva Gole,
Andrew Davis, Vignesh Raghavendra, Neil Armstrong, Aashvij Shenai,
Peng Fan, Guillaume La Roque (TI.com)
I2C EEPROM data contains the board name and its revision.
Add support for:
- Reading EEPROM data and store a copy at end of SRAM
- Updating env variable with relevant board info
- Printing board info during boot
Use the generic do_board_detect_am6() and setup_serial_am6()
functions to avoid code duplication across AM6x family boards.
Signed-off-by: Guillaume La Roque (TI.com) <glaroque@baylibre.com>
---
arch/arm/mach-k3/am62x/Kconfig | 3 +++
board/ti/am62x/evm.c | 54 +++++++++++++++++++++++++++++++++++++++++-
configs/am62x_evm_r5_defconfig | 1 +
3 files changed, 57 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-k3/am62x/Kconfig b/arch/arm/mach-k3/am62x/Kconfig
index 81199ada3a1..f7ad52db7d8 100644
--- a/arch/arm/mach-k3/am62x/Kconfig
+++ b/arch/arm/mach-k3/am62x/Kconfig
@@ -14,6 +14,8 @@ config TARGET_AM625_A53_EVM
select ARM64
select BINMAN
select OF_SYSTEM_SETUP
+ imply TI_COMMON_CMD_OPTIONS
+ imply TI_I2C_BOARD_DETECT
config TARGET_AM625_R5_EVM
bool "TI K3 based AM625 EVM running on R5"
@@ -25,6 +27,7 @@ config TARGET_AM625_R5_EVM
select K3_DDRSS
select BINMAN
imply SYS_K3_SPL_ATF
+ imply TI_I2C_BOARD_DETECT
config TARGET_PHYCORE_AM62X_A53
bool "PHYTEC phyCORE-AM62x running on A53"
diff --git a/board/ti/am62x/evm.c b/board/ti/am62x/evm.c
index c2c7a0216b9..591324ecc15 100644
--- a/board/ti/am62x/evm.c
+++ b/board/ti/am62x/evm.c
@@ -22,8 +22,16 @@
#include <dm/uclass.h>
#include <asm/arch/k3-ddr.h>
+#include "../common/board_detect.h"
#include "../common/fdt_ops.h"
+#define board_is_am62x_skevm() (board_ti_k3_is("AM62-SKEVM") || \
+ board_ti_k3_is("AM62B-SKEVM"))
+#define board_is_am62b_p1_skevm() board_ti_k3_is("AM62B-SKEVM-P1")
+#define board_is_am62x_lp_skevm() board_ti_k3_is("AM62-LP-SKEVM")
+#define board_is_am62x_sip_skevm() board_ti_k3_is("AM62SIP-SKEVM")
+#define board_is_am62x_play() board_ti_k3_is("BEAGLEPLAY-A0-")
+
DECLARE_GLOBAL_DATA_PTR;
#if CONFIG_IS_ENABLED(SPLASH_SCREEN)
@@ -74,9 +82,53 @@ struct efi_capsule_update_info update_info = {
.images = fw_images,
};
-#ifdef CONFIG_BOARD_LATE_INIT
+#if CONFIG_IS_ENABLED(TI_I2C_BOARD_DETECT)
+int checkboard(void)
+{
+ struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
+
+ if (!do_board_detect_am6())
+ printf("Board: %s rev %s\n", ep->name, ep->version);
+
+ return 0;
+}
+
+#if CONFIG_IS_ENABLED(BOARD_LATE_INIT)
+static void setup_board_eeprom_env(void)
+{
+ char *name = "am62x_skevm";
+
+ if (do_board_detect_am6())
+ goto invalid_eeprom;
+
+ if (board_is_am62x_skevm())
+ name = "am62x_skevm";
+ else if (board_is_am62b_p1_skevm())
+ name = "am62b_p1_skevm";
+ else if (board_is_am62x_lp_skevm())
+ name = "am62x_lp_skevm";
+ else if (board_is_am62x_sip_skevm())
+ name = "am62x_sip_skevm";
+ else if (board_is_am62x_play())
+ name = "am62x_beagleplay";
+ else
+ printf("Unidentified board claims %s in eeprom header\n",
+ board_ti_get_name());
+
+invalid_eeprom:
+ set_board_info_env_am6(name);
+}
+#endif
+#endif
+
+#if CONFIG_IS_ENABLED(BOARD_LATE_INIT)
int board_late_init(void)
{
+ if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) {
+ setup_board_eeprom_env();
+ setup_serial_am6();
+ }
+
ti_set_fdt_env(NULL, NULL);
return 0;
}
diff --git a/configs/am62x_evm_r5_defconfig b/configs/am62x_evm_r5_defconfig
index 18ffc991b25..d42bdf1f074 100644
--- a/configs/am62x_evm_r5_defconfig
+++ b/configs/am62x_evm_r5_defconfig
@@ -85,6 +85,7 @@ CONFIG_SPL_CLK_K3_PLL=y
CONFIG_SPL_CLK_K3=y
CONFIG_TI_SCI_PROTOCOL=y
CONFIG_DA8XX_GPIO=y
+CONFIG_DM_I2C=y
CONFIG_DM_MAILBOX=y
CONFIG_K3_SEC_PROXY=y
CONFIG_SPL_MISC=y
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 3/4] board: am64x: Use generic AM6x board detection functions
2025-10-24 14:17 [PATCH v2 0/4] board: ti: am62x: Add EEPROM support and refactor board detection Guillaume La Roque (TI.com)
2025-10-24 14:17 ` [PATCH v2 1/4] board: ti: common: Add generic AM6x board detection functions Guillaume La Roque (TI.com)
2025-10-24 14:17 ` [PATCH v2 2/4] board: am62x: Add support for reading eeprom data Guillaume La Roque (TI.com)
@ 2025-10-24 14:17 ` Guillaume La Roque (TI.com)
2025-10-27 16:15 ` Mattijs Korpershoek
2025-10-24 14:17 ` [PATCH v2 4/4] board: am65x: Use generic AM6x board detection function Guillaume La Roque (TI.com)
3 siblings, 1 reply; 11+ messages in thread
From: Guillaume La Roque (TI.com) @ 2025-10-24 14:17 UTC (permalink / raw)
To: u-boot, Anshul Dalal, Bryan Brattlof
Cc: Tom Rini, Garrett Giordano, Wadim Egorov, Neha Malcom Francis,
Mattijs Korpershoek, Ilias Apalodimas, Santhosh Kumar K,
Jonathan Humphreys, Sam Protsenko, Devarsh Thakkar,
Prasanth Babu Mantena, Judith Mendez, Marek Vasut, Dhruva Gole,
Andrew Davis, Vignesh Raghavendra, Neil Armstrong, Aashvij Shenai,
Peng Fan, Guillaume La Roque (TI.com)
Replace the board-specific implementation of do_board_detect() and
setup_serial() with calls to the generic do_board_detect_am6() and
setup_serial_am6() functions.
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/am64x/evm.c | 45 +++------------------------------------------
1 file changed, 3 insertions(+), 42 deletions(-)
diff --git a/board/ti/am64x/evm.c b/board/ti/am64x/evm.c
index f9bb593e4c6..3688cf2ca25 100644
--- a/board/ti/am64x/evm.c
+++ b/board/ti/am64x/evm.c
@@ -114,30 +114,11 @@ void spl_perform_board_fixups(struct spl_image_info *spl_image)
#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) {
- printf("EEPROM not available at 0x%02x, trying to read at 0x%02x\n",
- CONFIG_EEPROM_CHIP_ADDRESS, CONFIG_EEPROM_CHIP_ADDRESS + 1);
- ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
- CONFIG_EEPROM_CHIP_ADDRESS + 1);
- if (ret)
- pr_err("Reading on-board EEPROM at 0x%02x failed %d\n",
- CONFIG_EEPROM_CHIP_ADDRESS + 1, ret);
- }
-
- return ret;
-}
-
int checkboard(void)
{
struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
- if (!do_board_detect())
+ if (!do_board_detect_am6())
printf("Board: %s rev %s\n", ep->name, ep->version);
return 0;
@@ -154,7 +135,7 @@ static void setup_board_eeprom_env(void)
{
char *name = "am64x_gpevm";
- if (do_board_detect())
+ if (do_board_detect_am6())
goto invalid_eeprom;
if (board_is_am64x_gpevm())
@@ -169,26 +150,6 @@ invalid_eeprom:
set_board_info_env_am6(name);
ti_set_fdt_env(name, ti_am64_evm_fdt_map);
}
-
-static void setup_serial(void)
-{
- struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
- unsigned long board_serial;
- char *endp;
- char serial_string[17] = { 0 };
-
- if (env_get("serial#"))
- return;
-
- board_serial = hextoul(ep->serial, &endp);
- if (*endp != '\0') {
- pr_err("Error: Can't set serial# to %s\n", ep->serial);
- return;
- }
-
- snprintf(serial_string, sizeof(serial_string), "%016lx", board_serial);
- env_set("serial#", serial_string);
-}
#endif
#endif
@@ -199,7 +160,7 @@ int board_late_init(void)
struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
setup_board_eeprom_env();
- setup_serial();
+ setup_serial_am6();
/*
* The first MAC address for ethernet a.k.a. ethernet0 comes from
* efuse populated via the am654 gigabit eth switch subsystem driver.
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH v2 4/4] board: am65x: Use generic AM6x board detection function
2025-10-24 14:17 [PATCH v2 0/4] board: ti: am62x: Add EEPROM support and refactor board detection Guillaume La Roque (TI.com)
` (2 preceding siblings ...)
2025-10-24 14:17 ` [PATCH v2 3/4] board: am64x: Use generic AM6x board detection functions Guillaume La Roque (TI.com)
@ 2025-10-24 14:17 ` Guillaume La Roque (TI.com)
2025-10-27 16:18 ` Mattijs Korpershoek
3 siblings, 1 reply; 11+ messages in thread
From: Guillaume La Roque (TI.com) @ 2025-10-24 14:17 UTC (permalink / raw)
To: u-boot, Anshul Dalal, Bryan Brattlof
Cc: Tom Rini, Garrett Giordano, Wadim Egorov, Neha Malcom Francis,
Mattijs Korpershoek, Ilias Apalodimas, Santhosh Kumar K,
Jonathan Humphreys, Sam Protsenko, Devarsh Thakkar,
Prasanth Babu Mantena, Judith Mendez, Marek Vasut, Dhruva Gole,
Andrew Davis, Vignesh Raghavendra, Neil Armstrong, Aashvij Shenai,
Peng Fan, Guillaume La Roque (TI.com)
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
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH v2 1/4] board: ti: common: Add generic AM6x board detection functions
2025-10-24 14:17 ` [PATCH v2 1/4] board: ti: common: Add generic AM6x board detection functions Guillaume La Roque (TI.com)
@ 2025-10-27 16:10 ` Mattijs Korpershoek
0 siblings, 0 replies; 11+ messages in thread
From: Mattijs Korpershoek @ 2025-10-27 16:10 UTC (permalink / raw)
To: Guillaume La Roque (TI.com), u-boot, Anshul Dalal, Bryan Brattlof
Cc: Tom Rini, Garrett Giordano, Wadim Egorov, Neha Malcom Francis,
Mattijs Korpershoek, Ilias Apalodimas, Santhosh Kumar K,
Jonathan Humphreys, Sam Protsenko, Devarsh Thakkar,
Prasanth Babu Mantena, Judith Mendez, Marek Vasut, Dhruva Gole,
Andrew Davis, Vignesh Raghavendra, Neil Armstrong, Aashvij Shenai,
Peng Fan, Guillaume La Roque (TI.com)
Hi Guillaume,
Thank you for the patch.
On Fri, Oct 24, 2025 at 16:17, "Guillaume La Roque (TI.com)" <glaroque@baylibre.com> wrote:
> Add two new generic functions for AM6x family boards to simplify
> board-specific implementations:
>
> - do_board_detect_am6(): Generic board detection function that reads
> the on-board EEPROM. It first attempts to read at the configured
> address, and if that fails, tries the alternate address
> (CONFIG_EEPROM_CHIP_ADDRESS + 1). This provides a common
> implementation that can be used across different AM6x boards.
>
> - setup_serial_am6(): Sets up the serial number environment variable
> from the EEPROM data. The serial number is converted from
> hexadecimal string format to a 16-character hexadecimal
> representation and stored in the "serial#" environment variable.
>
> Both functions are protected by CONFIG_IS_ENABLED(TI_I2C_BOARD_DETECT)
> and are designed to be used by AM62x, AM64x, AM65x, and other AM6x
> family boards.
>
> Signed-off-by: Guillaume La Roque (TI.com) <glaroque@baylibre.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
> ---
> board/ti/common/board_detect.c | 43 ++++++++++++++++++++++++++++++++++++++++++
> board/ti/common/board_detect.h | 22 +++++++++++++++++++++
> 2 files changed, 65 insertions(+)
>
> diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c
> index a43cc075b92..d49e26fa453 100644
> --- a/board/ti/common/board_detect.c
> +++ b/board/ti/common/board_detect.c
> @@ -824,3 +824,46 @@ bool __maybe_unused board_ti_was_eeprom_read(void)
> else
> return false;
> }
> +
> +#if CONFIG_IS_ENABLED(TI_I2C_BOARD_DETECT)
> +int do_board_detect_am6(void)
> +{
> + int ret;
> +
> + ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
> + CONFIG_EEPROM_CHIP_ADDRESS);
> + if (ret) {
> + printf("EEPROM not available at 0x%02x, trying to read at 0x%02x\n",
> + CONFIG_EEPROM_CHIP_ADDRESS,
> + CONFIG_EEPROM_CHIP_ADDRESS + 1);
> + ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
> + CONFIG_EEPROM_CHIP_ADDRESS +
> + 1);
> + if (ret)
> + pr_err("Reading on-board EEPROM at 0x%02x failed %d\n",
> + CONFIG_EEPROM_CHIP_ADDRESS + 1, ret);
> + }
> +
> + return ret;
> +}
> +
> +void setup_serial_am6(void)
> +{
> + struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
> + unsigned long board_serial;
> + char *endp;
> + char serial_string[17] = { 0 };
> +
> + if (env_get("serial#"))
> + return;
> +
> + board_serial = simple_strtoul(ep->serial, &endp, 16);
> + if (*endp != '\0') {
> + pr_err("Error: Can't set serial# to %s\n", ep->serial);
> + return;
> + }
> +
> + snprintf(serial_string, sizeof(serial_string), "%016lx", board_serial);
> + env_set("serial#", serial_string);
> +}
> +#endif
> diff --git a/board/ti/common/board_detect.h b/board/ti/common/board_detect.h
> index b057f3b2269..26ada2a449c 100644
> --- a/board/ti/common/board_detect.h
> +++ b/board/ti/common/board_detect.h
> @@ -313,6 +313,28 @@ int __maybe_unused ti_i2c_eeprom_am6_get(int bus_addr, int dev_addr,
> */
> int __maybe_unused ti_i2c_eeprom_am6_get_base(int bus_addr, int dev_addr);
>
> +/**
> + * do_board_detect_am6() - Detect AM6x board and read EEPROM data
> + *
> + * This is a generic board detection function for AM6x family boards.
> + * It attempts to read the on-board EEPROM at the configured address,
> + * and if that fails, tries the alternate address (CONFIG_EEPROM_CHIP_ADDRESS + 1).
> + *
> + * Return: 0 on success or corresponding error on failure.
> + */
> +int do_board_detect_am6(void);
> +
> +/**
> + * setup_serial_am6() - Setup serial number environment variable for AM6x boards
> + *
> + * This function reads the serial number from the AM6x EEPROM data and
> + * sets the "serial#" environment variable. The serial number is converted
> + * from hexadecimal string format to a 16-character hexadecimal representation.
> + *
> + * EEPROM should be already read before calling this function.
> + */
> +void setup_serial_am6(void);
> +
> #ifdef CONFIG_TI_I2C_BOARD_DETECT
> /**
> * board_ti_is() - Board detection logic for TI EVMs
>
> --
> 2.34.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/4] board: am62x: Add support for reading eeprom data
2025-10-24 14:17 ` [PATCH v2 2/4] board: am62x: Add support for reading eeprom data Guillaume La Roque (TI.com)
@ 2025-10-27 16:13 ` Mattijs Korpershoek
2025-10-27 18:08 ` Andrew Davis
1 sibling, 0 replies; 11+ messages in thread
From: Mattijs Korpershoek @ 2025-10-27 16:13 UTC (permalink / raw)
To: Guillaume La Roque (TI.com), u-boot, Anshul Dalal, Bryan Brattlof
Cc: Tom Rini, Garrett Giordano, Wadim Egorov, Neha Malcom Francis,
Mattijs Korpershoek, Ilias Apalodimas, Santhosh Kumar K,
Jonathan Humphreys, Sam Protsenko, Devarsh Thakkar,
Prasanth Babu Mantena, Judith Mendez, Marek Vasut, Dhruva Gole,
Andrew Davis, Vignesh Raghavendra, Neil Armstrong, Aashvij Shenai,
Peng Fan, Guillaume La Roque (TI.com)
Hi Guillaume,
Thank you for the patch.
On Fri, Oct 24, 2025 at 16:17, "Guillaume La Roque (TI.com)" <glaroque@baylibre.com> wrote:
> I2C EEPROM data contains the board name and its revision.
> Add support for:
> - Reading EEPROM data and store a copy at end of SRAM
> - Updating env variable with relevant board info
> - Printing board info during boot
>
> Use the generic do_board_detect_am6() and setup_serial_am6()
> functions to avoid code duplication across AM6x family boards.
>
> Signed-off-by: Guillaume La Roque (TI.com) <glaroque@baylibre.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
> ---
> arch/arm/mach-k3/am62x/Kconfig | 3 +++
> board/ti/am62x/evm.c | 54 +++++++++++++++++++++++++++++++++++++++++-
> configs/am62x_evm_r5_defconfig | 1 +
> 3 files changed, 57 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-k3/am62x/Kconfig b/arch/arm/mach-k3/am62x/Kconfig
> index 81199ada3a1..f7ad52db7d8 100644
> --- a/arch/arm/mach-k3/am62x/Kconfig
> +++ b/arch/arm/mach-k3/am62x/Kconfig
> @@ -14,6 +14,8 @@ config TARGET_AM625_A53_EVM
> select ARM64
> select BINMAN
> select OF_SYSTEM_SETUP
> + imply TI_COMMON_CMD_OPTIONS
> + imply TI_I2C_BOARD_DETECT
>
> config TARGET_AM625_R5_EVM
> bool "TI K3 based AM625 EVM running on R5"
> @@ -25,6 +27,7 @@ config TARGET_AM625_R5_EVM
> select K3_DDRSS
> select BINMAN
> imply SYS_K3_SPL_ATF
> + imply TI_I2C_BOARD_DETECT
>
> config TARGET_PHYCORE_AM62X_A53
> bool "PHYTEC phyCORE-AM62x running on A53"
> diff --git a/board/ti/am62x/evm.c b/board/ti/am62x/evm.c
> index c2c7a0216b9..591324ecc15 100644
> --- a/board/ti/am62x/evm.c
> +++ b/board/ti/am62x/evm.c
> @@ -22,8 +22,16 @@
> #include <dm/uclass.h>
> #include <asm/arch/k3-ddr.h>
>
> +#include "../common/board_detect.h"
> #include "../common/fdt_ops.h"
>
> +#define board_is_am62x_skevm() (board_ti_k3_is("AM62-SKEVM") || \
> + board_ti_k3_is("AM62B-SKEVM"))
> +#define board_is_am62b_p1_skevm() board_ti_k3_is("AM62B-SKEVM-P1")
> +#define board_is_am62x_lp_skevm() board_ti_k3_is("AM62-LP-SKEVM")
> +#define board_is_am62x_sip_skevm() board_ti_k3_is("AM62SIP-SKEVM")
> +#define board_is_am62x_play() board_ti_k3_is("BEAGLEPLAY-A0-")
> +
> DECLARE_GLOBAL_DATA_PTR;
>
> #if CONFIG_IS_ENABLED(SPLASH_SCREEN)
> @@ -74,9 +82,53 @@ struct efi_capsule_update_info update_info = {
> .images = fw_images,
> };
>
> -#ifdef CONFIG_BOARD_LATE_INIT
> +#if CONFIG_IS_ENABLED(TI_I2C_BOARD_DETECT)
> +int checkboard(void)
> +{
> + struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
> +
> + if (!do_board_detect_am6())
> + printf("Board: %s rev %s\n", ep->name, ep->version);
> +
> + return 0;
> +}
> +
> +#if CONFIG_IS_ENABLED(BOARD_LATE_INIT)
> +static void setup_board_eeprom_env(void)
> +{
> + char *name = "am62x_skevm";
> +
> + if (do_board_detect_am6())
> + goto invalid_eeprom;
> +
> + if (board_is_am62x_skevm())
> + name = "am62x_skevm";
> + else if (board_is_am62b_p1_skevm())
> + name = "am62b_p1_skevm";
> + else if (board_is_am62x_lp_skevm())
> + name = "am62x_lp_skevm";
> + else if (board_is_am62x_sip_skevm())
> + name = "am62x_sip_skevm";
> + else if (board_is_am62x_play())
> + name = "am62x_beagleplay";
> + else
> + printf("Unidentified board claims %s in eeprom header\n",
> + board_ti_get_name());
> +
> +invalid_eeprom:
> + set_board_info_env_am6(name);
> +}
> +#endif
> +#endif
> +
> +#if CONFIG_IS_ENABLED(BOARD_LATE_INIT)
> int board_late_init(void)
> {
> + if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) {
> + setup_board_eeprom_env();
> + setup_serial_am6();
> + }
> +
> ti_set_fdt_env(NULL, NULL);
> return 0;
> }
> diff --git a/configs/am62x_evm_r5_defconfig b/configs/am62x_evm_r5_defconfig
> index 18ffc991b25..d42bdf1f074 100644
> --- a/configs/am62x_evm_r5_defconfig
> +++ b/configs/am62x_evm_r5_defconfig
> @@ -85,6 +85,7 @@ CONFIG_SPL_CLK_K3_PLL=y
> CONFIG_SPL_CLK_K3=y
> CONFIG_TI_SCI_PROTOCOL=y
> CONFIG_DA8XX_GPIO=y
> +CONFIG_DM_I2C=y
> CONFIG_DM_MAILBOX=y
> CONFIG_K3_SEC_PROXY=y
> CONFIG_SPL_MISC=y
>
> --
> 2.34.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 3/4] board: am64x: Use generic AM6x board detection functions
2025-10-24 14:17 ` [PATCH v2 3/4] board: am64x: Use generic AM6x board detection functions Guillaume La Roque (TI.com)
@ 2025-10-27 16:15 ` Mattijs Korpershoek
0 siblings, 0 replies; 11+ messages in thread
From: Mattijs Korpershoek @ 2025-10-27 16:15 UTC (permalink / raw)
To: Guillaume La Roque (TI.com), u-boot, Anshul Dalal, Bryan Brattlof
Cc: Tom Rini, Garrett Giordano, Wadim Egorov, Neha Malcom Francis,
Mattijs Korpershoek, Ilias Apalodimas, Santhosh Kumar K,
Jonathan Humphreys, Sam Protsenko, Devarsh Thakkar,
Prasanth Babu Mantena, Judith Mendez, Marek Vasut, Dhruva Gole,
Andrew Davis, Vignesh Raghavendra, Neil Armstrong, Aashvij Shenai,
Peng Fan, Guillaume La Roque (TI.com)
Hi Guillaume,
Thank you for the patch.
On Fri, Oct 24, 2025 at 16:17, "Guillaume La Roque (TI.com)" <glaroque@baylibre.com> wrote:
> Replace the board-specific implementation of do_board_detect() and
> setup_serial() with calls to the generic do_board_detect_am6() and
> setup_serial_am6() functions.
>
> The generic function provides the same functionality with
> additional fallback logic to try alternate EEPROM addresses.
The am64x board-specific one also has the fallback logic.
Since that's a minor commit message nitpick:
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
>
> Signed-off-by: Guillaume La Roque (TI.com) <glaroque@baylibre.com>
> ---
> board/ti/am64x/evm.c | 45 +++------------------------------------------
> 1 file changed, 3 insertions(+), 42 deletions(-)
>
> diff --git a/board/ti/am64x/evm.c b/board/ti/am64x/evm.c
> index f9bb593e4c6..3688cf2ca25 100644
> --- a/board/ti/am64x/evm.c
> +++ b/board/ti/am64x/evm.c
> @@ -114,30 +114,11 @@ void spl_perform_board_fixups(struct spl_image_info *spl_image)
> #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) {
> - printf("EEPROM not available at 0x%02x, trying to read at 0x%02x\n",
> - CONFIG_EEPROM_CHIP_ADDRESS, CONFIG_EEPROM_CHIP_ADDRESS + 1);
> - ret = ti_i2c_eeprom_am6_get_base(CONFIG_EEPROM_BUS_ADDRESS,
> - CONFIG_EEPROM_CHIP_ADDRESS + 1);
> - if (ret)
> - pr_err("Reading on-board EEPROM at 0x%02x failed %d\n",
> - CONFIG_EEPROM_CHIP_ADDRESS + 1, ret);
> - }
> -
> - return ret;
> -}
> -
> int checkboard(void)
> {
> struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
>
> - if (!do_board_detect())
> + if (!do_board_detect_am6())
> printf("Board: %s rev %s\n", ep->name, ep->version);
>
> return 0;
> @@ -154,7 +135,7 @@ static void setup_board_eeprom_env(void)
> {
> char *name = "am64x_gpevm";
>
> - if (do_board_detect())
> + if (do_board_detect_am6())
> goto invalid_eeprom;
>
> if (board_is_am64x_gpevm())
> @@ -169,26 +150,6 @@ invalid_eeprom:
> set_board_info_env_am6(name);
> ti_set_fdt_env(name, ti_am64_evm_fdt_map);
> }
> -
> -static void setup_serial(void)
> -{
> - struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
> - unsigned long board_serial;
> - char *endp;
> - char serial_string[17] = { 0 };
> -
> - if (env_get("serial#"))
> - return;
> -
> - board_serial = hextoul(ep->serial, &endp);
> - if (*endp != '\0') {
> - pr_err("Error: Can't set serial# to %s\n", ep->serial);
> - return;
> - }
> -
> - snprintf(serial_string, sizeof(serial_string), "%016lx", board_serial);
> - env_set("serial#", serial_string);
> -}
> #endif
> #endif
>
> @@ -199,7 +160,7 @@ int board_late_init(void)
> struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
>
> setup_board_eeprom_env();
> - setup_serial();
> + setup_serial_am6();
> /*
> * The first MAC address for ethernet a.k.a. ethernet0 comes from
> * efuse populated via the am654 gigabit eth switch subsystem driver.
>
> --
> 2.34.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 4/4] board: am65x: Use generic AM6x board detection function
2025-10-24 14:17 ` [PATCH v2 4/4] board: am65x: Use generic AM6x board detection function Guillaume La Roque (TI.com)
@ 2025-10-27 16:18 ` Mattijs Korpershoek
0 siblings, 0 replies; 11+ messages in thread
From: Mattijs Korpershoek @ 2025-10-27 16:18 UTC (permalink / raw)
To: Guillaume La Roque (TI.com), u-boot, Anshul Dalal, Bryan Brattlof
Cc: Tom Rini, Garrett Giordano, Wadim Egorov, Neha Malcom Francis,
Mattijs Korpershoek, Ilias Apalodimas, Santhosh Kumar K,
Jonathan Humphreys, Sam Protsenko, Devarsh Thakkar,
Prasanth Babu Mantena, Judith Mendez, Marek Vasut, Dhruva Gole,
Andrew Davis, Vignesh Raghavendra, Neil Armstrong, Aashvij Shenai,
Peng Fan, Guillaume La Roque (TI.com)
Hi Guillaume,
Thank you for the patch.
On Fri, Oct 24, 2025 at 16:17, "Guillaume La Roque (TI.com)" <glaroque@baylibre.com> wrote:
> 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>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
> ---
> 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/4] board: am62x: Add support for reading eeprom data
2025-10-24 14:17 ` [PATCH v2 2/4] board: am62x: Add support for reading eeprom data Guillaume La Roque (TI.com)
2025-10-27 16:13 ` Mattijs Korpershoek
@ 2025-10-27 18:08 ` Andrew Davis
2025-10-31 8:22 ` Guillaume La Roque
1 sibling, 1 reply; 11+ messages in thread
From: Andrew Davis @ 2025-10-27 18:08 UTC (permalink / raw)
To: Guillaume La Roque (TI.com), u-boot, Anshul Dalal, Bryan Brattlof
Cc: Tom Rini, Garrett Giordano, Wadim Egorov, Neha Malcom Francis,
Mattijs Korpershoek, Ilias Apalodimas, Santhosh Kumar K,
Jonathan Humphreys, Sam Protsenko, Devarsh Thakkar,
Prasanth Babu Mantena, Judith Mendez, Marek Vasut, Dhruva Gole,
Vignesh Raghavendra, Neil Armstrong, Aashvij Shenai, Peng Fan
On 10/24/25 9:17 AM, Guillaume La Roque (TI.com) wrote:
> I2C EEPROM data contains the board name and its revision.
> Add support for:
> - Reading EEPROM data and store a copy at end of SRAM
> - Updating env variable with relevant board info
> - Printing board info during boot
>
> Use the generic do_board_detect_am6() and setup_serial_am6()
> functions to avoid code duplication across AM6x family boards.
>
> Signed-off-by: Guillaume La Roque (TI.com) <glaroque@baylibre.com>
> ---
> arch/arm/mach-k3/am62x/Kconfig | 3 +++
> board/ti/am62x/evm.c | 54 +++++++++++++++++++++++++++++++++++++++++-
> configs/am62x_evm_r5_defconfig | 1 +
> 3 files changed, 57 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-k3/am62x/Kconfig b/arch/arm/mach-k3/am62x/Kconfig
> index 81199ada3a1..f7ad52db7d8 100644
> --- a/arch/arm/mach-k3/am62x/Kconfig
> +++ b/arch/arm/mach-k3/am62x/Kconfig
> @@ -14,6 +14,8 @@ config TARGET_AM625_A53_EVM
> select ARM64
> select BINMAN
> select OF_SYSTEM_SETUP
> + imply TI_COMMON_CMD_OPTIONS
> + imply TI_I2C_BOARD_DETECT
>
> config TARGET_AM625_R5_EVM
> bool "TI K3 based AM625 EVM running on R5"
> @@ -25,6 +27,7 @@ config TARGET_AM625_R5_EVM
> select K3_DDRSS
> select BINMAN
> imply SYS_K3_SPL_ATF
> + imply TI_I2C_BOARD_DETECT
>
> config TARGET_PHYCORE_AM62X_A53
> bool "PHYTEC phyCORE-AM62x running on A53"
> diff --git a/board/ti/am62x/evm.c b/board/ti/am62x/evm.c
> index c2c7a0216b9..591324ecc15 100644
> --- a/board/ti/am62x/evm.c
> +++ b/board/ti/am62x/evm.c
> @@ -22,8 +22,16 @@
> #include <dm/uclass.h>
> #include <asm/arch/k3-ddr.h>
>
> +#include "../common/board_detect.h"
> #include "../common/fdt_ops.h"
>
> +#define board_is_am62x_skevm() (board_ti_k3_is("AM62-SKEVM") || \
> + board_ti_k3_is("AM62B-SKEVM"))
> +#define board_is_am62b_p1_skevm() board_ti_k3_is("AM62B-SKEVM-P1")
> +#define board_is_am62x_lp_skevm() board_ti_k3_is("AM62-LP-SKEVM")
> +#define board_is_am62x_sip_skevm() board_ti_k3_is("AM62SIP-SKEVM")
> +#define board_is_am62x_play() board_ti_k3_is("BEAGLEPLAY-A0-")
BeaglePlay is not a TI AM62x EVM variant, its support is handled
separately over in board/beagle/beagleplay/, might be good to drop
this line to avoid any confusion around how the board is supported.
Andrew
> +
> DECLARE_GLOBAL_DATA_PTR;
>
> #if CONFIG_IS_ENABLED(SPLASH_SCREEN)
> @@ -74,9 +82,53 @@ struct efi_capsule_update_info update_info = {
> .images = fw_images,
> };
>
> -#ifdef CONFIG_BOARD_LATE_INIT
> +#if CONFIG_IS_ENABLED(TI_I2C_BOARD_DETECT)
> +int checkboard(void)
> +{
> + struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
> +
> + if (!do_board_detect_am6())
> + printf("Board: %s rev %s\n", ep->name, ep->version);
> +
> + return 0;
> +}
> +
> +#if CONFIG_IS_ENABLED(BOARD_LATE_INIT)
> +static void setup_board_eeprom_env(void)
> +{
> + char *name = "am62x_skevm";
> +
> + if (do_board_detect_am6())
> + goto invalid_eeprom;
> +
> + if (board_is_am62x_skevm())
> + name = "am62x_skevm";
> + else if (board_is_am62b_p1_skevm())
> + name = "am62b_p1_skevm";
> + else if (board_is_am62x_lp_skevm())
> + name = "am62x_lp_skevm";
> + else if (board_is_am62x_sip_skevm())
> + name = "am62x_sip_skevm";
> + else if (board_is_am62x_play())
> + name = "am62x_beagleplay";
> + else
> + printf("Unidentified board claims %s in eeprom header\n",
> + board_ti_get_name());
> +
> +invalid_eeprom:
> + set_board_info_env_am6(name);
> +}
> +#endif
> +#endif
> +
> +#if CONFIG_IS_ENABLED(BOARD_LATE_INIT)
> int board_late_init(void)
> {
> + if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) {
> + setup_board_eeprom_env();
> + setup_serial_am6();
> + }
> +
> ti_set_fdt_env(NULL, NULL);
> return 0;
> }
> diff --git a/configs/am62x_evm_r5_defconfig b/configs/am62x_evm_r5_defconfig
> index 18ffc991b25..d42bdf1f074 100644
> --- a/configs/am62x_evm_r5_defconfig
> +++ b/configs/am62x_evm_r5_defconfig
> @@ -85,6 +85,7 @@ CONFIG_SPL_CLK_K3_PLL=y
> CONFIG_SPL_CLK_K3=y
> CONFIG_TI_SCI_PROTOCOL=y
> CONFIG_DA8XX_GPIO=y
> +CONFIG_DM_I2C=y
> CONFIG_DM_MAILBOX=y
> CONFIG_K3_SEC_PROXY=y
> CONFIG_SPL_MISC=y
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v2 2/4] board: am62x: Add support for reading eeprom data
2025-10-27 18:08 ` Andrew Davis
@ 2025-10-31 8:22 ` Guillaume La Roque
0 siblings, 0 replies; 11+ messages in thread
From: Guillaume La Roque @ 2025-10-31 8:22 UTC (permalink / raw)
To: Andrew Davis, u-boot, Anshul Dalal, Bryan Brattlof
Cc: Tom Rini, Garrett Giordano, Wadim Egorov, Neha Malcom Francis,
Mattijs Korpershoek, Ilias Apalodimas, Santhosh Kumar K,
Jonathan Humphreys, Sam Protsenko, Devarsh Thakkar,
Prasanth Babu Mantena, Judith Mendez, Marek Vasut, Dhruva Gole,
Vignesh Raghavendra, Neil Armstrong, Aashvij Shenai, Peng Fan
Le 27/10/2025 à 19:08, Andrew Davis a écrit :
> On 10/24/25 9:17 AM, Guillaume La Roque (TI.com) wrote:
>> I2C EEPROM data contains the board name and its revision.
>> Add support for:
>> - Reading EEPROM data and store a copy at end of SRAM
>> - Updating env variable with relevant board info
>> - Printing board info during boot
>>
>> Use the generic do_board_detect_am6() and setup_serial_am6()
>> functions to avoid code duplication across AM6x family boards.
>>
>> Signed-off-by: Guillaume La Roque (TI.com) <glaroque@baylibre.com>
>> ---
>> arch/arm/mach-k3/am62x/Kconfig | 3 +++
>> board/ti/am62x/evm.c | 54
>> +++++++++++++++++++++++++++++++++++++++++-
>> configs/am62x_evm_r5_defconfig | 1 +
>> 3 files changed, 57 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/mach-k3/am62x/Kconfig
>> b/arch/arm/mach-k3/am62x/Kconfig
>> index 81199ada3a1..f7ad52db7d8 100644
>> --- a/arch/arm/mach-k3/am62x/Kconfig
>> +++ b/arch/arm/mach-k3/am62x/Kconfig
>> @@ -14,6 +14,8 @@ config TARGET_AM625_A53_EVM
>> select ARM64
>> select BINMAN
>> select OF_SYSTEM_SETUP
>> + imply TI_COMMON_CMD_OPTIONS
>> + imply TI_I2C_BOARD_DETECT
>> config TARGET_AM625_R5_EVM
>> bool "TI K3 based AM625 EVM running on R5"
>> @@ -25,6 +27,7 @@ config TARGET_AM625_R5_EVM
>> select K3_DDRSS
>> select BINMAN
>> imply SYS_K3_SPL_ATF
>> + imply TI_I2C_BOARD_DETECT
>> config TARGET_PHYCORE_AM62X_A53
>> bool "PHYTEC phyCORE-AM62x running on A53"
>> diff --git a/board/ti/am62x/evm.c b/board/ti/am62x/evm.c
>> index c2c7a0216b9..591324ecc15 100644
>> --- a/board/ti/am62x/evm.c
>> +++ b/board/ti/am62x/evm.c
>> @@ -22,8 +22,16 @@
>> #include <dm/uclass.h>
>> #include <asm/arch/k3-ddr.h>
>> +#include "../common/board_detect.h"
>> #include "../common/fdt_ops.h"
>> +#define board_is_am62x_skevm() (board_ti_k3_is("AM62-SKEVM") || \
>> + board_ti_k3_is("AM62B-SKEVM"))
>> +#define board_is_am62b_p1_skevm() board_ti_k3_is("AM62B-SKEVM-P1")
>> +#define board_is_am62x_lp_skevm() board_ti_k3_is("AM62-LP-SKEVM")
>> +#define board_is_am62x_sip_skevm() board_ti_k3_is("AM62SIP-SKEVM")
>> +#define board_is_am62x_play() board_ti_k3_is("BEAGLEPLAY-A0-")
>
> BeaglePlay is not a TI AM62x EVM variant, its support is handled
> separately over in board/beagle/beagleplay/, might be good to drop
> this line to avoid any confusion around how the board is supported.
yes sorry i forgot it i will fix in v3
>
> Andrew
>
>> +
>> DECLARE_GLOBAL_DATA_PTR;
>> #if CONFIG_IS_ENABLED(SPLASH_SCREEN)
>> @@ -74,9 +82,53 @@ struct efi_capsule_update_info update_info = {
>> .images = fw_images,
>> };
>> -#ifdef CONFIG_BOARD_LATE_INIT
>> +#if CONFIG_IS_ENABLED(TI_I2C_BOARD_DETECT)
>> +int checkboard(void)
>> +{
>> + struct ti_am6_eeprom *ep = TI_AM6_EEPROM_DATA;
>> +
>> + if (!do_board_detect_am6())
>> + printf("Board: %s rev %s\n", ep->name, ep->version);
>> +
>> + return 0;
>> +}
>> +
>> +#if CONFIG_IS_ENABLED(BOARD_LATE_INIT)
>> +static void setup_board_eeprom_env(void)
>> +{
>> + char *name = "am62x_skevm";
>> +
>> + if (do_board_detect_am6())
>> + goto invalid_eeprom;
>> +
>> + if (board_is_am62x_skevm())
>> + name = "am62x_skevm";
>> + else if (board_is_am62b_p1_skevm())
>> + name = "am62b_p1_skevm";
>> + else if (board_is_am62x_lp_skevm())
>> + name = "am62x_lp_skevm";
>> + else if (board_is_am62x_sip_skevm())
>> + name = "am62x_sip_skevm";
>> + else if (board_is_am62x_play())
>> + name = "am62x_beagleplay";
>> + else
>> + printf("Unidentified board claims %s in eeprom header\n",
>> + board_ti_get_name());
>> +
>> +invalid_eeprom:
>> + set_board_info_env_am6(name);
>> +}
>> +#endif
>> +#endif
>> +
>> +#if CONFIG_IS_ENABLED(BOARD_LATE_INIT)
>> int board_late_init(void)
>> {
>> + if (IS_ENABLED(CONFIG_TI_I2C_BOARD_DETECT)) {
>> + setup_board_eeprom_env();
>> + setup_serial_am6();
>> + }
>> +
>> ti_set_fdt_env(NULL, NULL);
>> return 0;
>> }
>> diff --git a/configs/am62x_evm_r5_defconfig
>> b/configs/am62x_evm_r5_defconfig
>> index 18ffc991b25..d42bdf1f074 100644
>> --- a/configs/am62x_evm_r5_defconfig
>> +++ b/configs/am62x_evm_r5_defconfig
>> @@ -85,6 +85,7 @@ CONFIG_SPL_CLK_K3_PLL=y
>> CONFIG_SPL_CLK_K3=y
>> CONFIG_TI_SCI_PROTOCOL=y
>> CONFIG_DA8XX_GPIO=y
>> +CONFIG_DM_I2C=y
>> CONFIG_DM_MAILBOX=y
>> CONFIG_K3_SEC_PROXY=y
>> CONFIG_SPL_MISC=y
>>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2025-10-31 8:22 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-24 14:17 [PATCH v2 0/4] board: ti: am62x: Add EEPROM support and refactor board detection Guillaume La Roque (TI.com)
2025-10-24 14:17 ` [PATCH v2 1/4] board: ti: common: Add generic AM6x board detection functions Guillaume La Roque (TI.com)
2025-10-27 16:10 ` Mattijs Korpershoek
2025-10-24 14:17 ` [PATCH v2 2/4] board: am62x: Add support for reading eeprom data Guillaume La Roque (TI.com)
2025-10-27 16:13 ` Mattijs Korpershoek
2025-10-27 18:08 ` Andrew Davis
2025-10-31 8:22 ` Guillaume La Roque
2025-10-24 14:17 ` [PATCH v2 3/4] board: am64x: Use generic AM6x board detection functions Guillaume La Roque (TI.com)
2025-10-27 16:15 ` Mattijs Korpershoek
2025-10-24 14:17 ` [PATCH v2 4/4] board: am65x: Use generic AM6x board detection function Guillaume La Roque (TI.com)
2025-10-27 16:18 ` Mattijs Korpershoek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox