From 25afe55de592f7b021d114d36c9ae3ae6c3bc01b Mon Sep 17 00:00:00 2001 From: Lokesh Vutla Date: Tue, 8 Mar 2016 09:18:05 +0530 Subject: ARM: DRA7: Enable EEPROM support Enable EEPROM support for DRA74-evm. Acked-by: Nishanth Menon Reviewed-by: Tom Rini Signed-off-by: Lokesh Vutla --- board/ti/dra7xx/Kconfig | 3 +++ board/ti/dra7xx/evm.c | 59 +++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 58 insertions(+), 4 deletions(-) (limited to 'board/ti') diff --git a/board/ti/dra7xx/Kconfig b/board/ti/dra7xx/Kconfig index 80341d9..b642113 100644 --- a/board/ti/dra7xx/Kconfig +++ b/board/ti/dra7xx/Kconfig @@ -17,4 +17,7 @@ config CONS_INDEX The DRA7xx (and AM57x) SoC has a total of 6 UARTs available to it. Depending on your specific board you may want something other than UART1 here. + +source "board/ti/common/Kconfig" + endif diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c index eebec88..a47122b 100644 --- a/board/ti/dra7xx/evm.c +++ b/board/ti/dra7xx/evm.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -27,6 +28,11 @@ #include #include "mux_data.h" +#include "../common/board_detect.h" + +#define board_is_dra74x_evm() board_ti_is("5777xCPU") +#define board_is_dra74x_revh_or_later() board_is_dra74x_evm() && \ + (strncmp("H", board_ti_get_rev(), 1) <= 0) #ifdef CONFIG_DRIVER_TI_CPSW #include @@ -37,8 +43,10 @@ DECLARE_GLOBAL_DATA_PTR; /* GPIO 7_11 */ #define GPIO_DDR_VTT_EN 203 +#define SYSINFO_BOARD_NAME_MAX_LEN 37 + const struct omap_sysinfo sysinfo = { - "Board: DRA7xx\n" + "Board: UNKNOWN(DRA7 EVM) REV UNKNOWN\n" }; /** @@ -57,16 +65,59 @@ int board_init(void) int board_late_init(void) { #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG - if (omap_revision() == DRA722_ES1_0) - setenv("board_name", "dra72x"); + char *name = "unknown"; + + if (is_dra72x()) + name = "dra72x"; else - setenv("board_name", "dra7xx"); + name = "dra7xx"; + + set_board_info_env(name); omap_die_id_serial(); #endif return 0; } +#ifdef CONFIG_SPL_BUILD +void do_board_detect(void) +{ + int rc; + + rc = ti_i2c_eeprom_dra7_get(CONFIG_EEPROM_BUS_ADDRESS, + CONFIG_EEPROM_CHIP_ADDRESS); + if (rc) + printf("ti_i2c_eeprom_init failed %d\n", rc); +} + +#else + +void do_board_detect(void) +{ + char *bname = NULL; + int rc; + + rc = ti_i2c_eeprom_dra7_get(CONFIG_EEPROM_BUS_ADDRESS, + CONFIG_EEPROM_CHIP_ADDRESS); + if (rc) + printf("ti_i2c_eeprom_init failed %d\n", rc); + + if (board_is_dra74x_evm()) { + bname = "DRA74x EVM"; + /* If EEPROM is not populated */ + } else { + if (is_dra72x()) + bname = "DRA72x EVM"; + else + bname = "DRA74x EVM"; + } + + if (bname) + snprintf(sysinfo.board_string, SYSINFO_BOARD_NAME_MAX_LEN, + "Board: %s REV %s\n", bname, board_ti_get_rev()); +} +#endif /* CONFIG_SPL_BUILD */ + void set_muxconf_regs_essential(void) { do_set_mux32((*ctrl)->control_padconf_core_base, -- cgit v1.1