public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Guillaume La Roque <glaroque@baylibre.com>
To: Andrew Davis <afd@ti.com>,
	u-boot@lists.denx.de, Anshul Dalal <anshuld@ti.com>,
	Bryan Brattlof <bb@ti.com>
Cc: Tom Rini <trini@konsulko.com>,
	Garrett Giordano <ggiordano@phytec.com>,
	Wadim Egorov <w.egorov@phytec.de>,
	Neha Malcom Francis <n-francis@ti.com>,
	Mattijs Korpershoek <mkorpershoek@kernel.org>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Santhosh Kumar K <s-k6@ti.com>,
	Jonathan Humphreys <j-humphreys@ti.com>,
	Sam Protsenko <semen.protsenko@linaro.org>,
	Devarsh Thakkar <devarsht@ti.com>,
	Prasanth Babu Mantena <p-mantena@ti.com>,
	Judith Mendez <jm@ti.com>,
	Marek Vasut <marek.vasut+renesas@mailbox.org>,
	Dhruva Gole <d-gole@ti.com>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Aashvij Shenai <a-shenai@ti.com>, Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH v2 2/4] board: am62x: Add support for reading eeprom data
Date: Fri, 31 Oct 2025 09:22:06 +0100	[thread overview]
Message-ID: <c2121665-7eb3-473d-8933-e6729c3e9040@baylibre.com> (raw)
In-Reply-To: <8127d3c6-3b1e-4e8c-9ae5-efd7740cc54c@ti.com>

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
>>
>


  reply	other threads:[~2025-10-31  8:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c2121665-7eb3-473d-8933-e6729c3e9040@baylibre.com \
    --to=glaroque@baylibre.com \
    --cc=a-shenai@ti.com \
    --cc=afd@ti.com \
    --cc=anshuld@ti.com \
    --cc=bb@ti.com \
    --cc=d-gole@ti.com \
    --cc=devarsht@ti.com \
    --cc=ggiordano@phytec.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=j-humphreys@ti.com \
    --cc=jm@ti.com \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=mkorpershoek@kernel.org \
    --cc=n-francis@ti.com \
    --cc=neil.armstrong@linaro.org \
    --cc=p-mantena@ti.com \
    --cc=peng.fan@nxp.com \
    --cc=s-k6@ti.com \
    --cc=semen.protsenko@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=vigneshr@ti.com \
    --cc=w.egorov@phytec.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox