board: am62x: Add support for reading eeprom data
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. Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org> Signed-off-by: Guillaume La Roque (TI.com) <glaroque@baylibre.com>
This commit is contained in:
committed by
Tom Rini
parent
46684bb036
commit
ff1b83c095
@@ -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"
|
||||
|
||||
@@ -22,8 +22,15 @@
|
||||
#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")
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
#if CONFIG_IS_ENABLED(SPLASH_SCREEN)
|
||||
@@ -74,9 +81,51 @@ 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
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user