[U-Boot] [PATCH v4 7/7] board: ti: AM57xx: Add detection logic for AM57xx-evm
Steve Kipisz
s-kipisz2 at ti.com
Fri Nov 6 01:39:36 CET 2015
Current AM57xx evm supports both BeagleBoard-X15
(http://beagleboard.org/x15) and AM57xx EVM
(http://www.ti.com/tool/tmdxevm5728).
The AM572x EValuation Module(EVM) provides an affordable platform to
quickly start evaluation of Sitara. ARM Cortex-A15 AM57x Processors
(AM5728, AM5726, AM5718, AM5716) and accelerate development for HMI,
machine vision, networking, medical imaging and many other industrial
applications. This EVM is based on the same BeagleBoard-X15 Chassis
and adds mPCIe, mSATA, LCD, touchscreen, Camera, push button and TI's
wlink8 offering.
Since the EEPROM contents are compatible between the BeagleBoard-X15 and
the AM57xx-evm, we add support for the detection logic to enable
support for various user programmable scripting capability.
NOTE: U-boot configuration is currently a superset of AM57xx evm and
BeagleBoard-X15 and no additional configuration tweaking is needed.
This change also sets up the stage for future support of TI AM57xx EVMs
to the same base bootloader build.
Signed-off-by: Steve Kipisz <s-kipisz2 at ti.com>
---
Changes in v4 (since v3):
- No changes (except for rebase)
v3: https://patchwork.ozlabs.org/patch/540195/
v2: http://marc.info/?t=144655344600003&r=1&w=2
v1: http://marc.info/?t=144608007900002&r=1&w=2
http://marc.info/?t=144608007900004&r=1&w=2
(mailing list squashed original submission)
board/ti/am57xx/board.c | 52 ++++++++++++++++++++++++++++++++++++++++++++
include/configs/am57xx_evm.h | 4 ++++
2 files changed, 56 insertions(+)
diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index 042f9ab1965a..15da8e66fee5 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -31,6 +31,10 @@
#include <ti-usb-phy-uboot.h>
#include "mux_data.h"
+#include <board_detect.h>
+
+#define board_is_x15() board_am_is("BBRDX15_")
+#define board_is_am572x_evm() board_am_is("AM572PM_")
#ifdef CONFIG_DRIVER_TI_CPSW
#include <cpsw.h>
@@ -246,6 +250,52 @@ struct vcores_data beagle_x15_volts = {
.iva.pmic = &tps659038,
};
+#ifdef CONFIG_SPL_BUILD
+/* No env to setup for SPL */
+static inline void setup_board_eeprom_env(void) { }
+
+/* Override function to read eeprom information */
+void do_board_detect(void)
+{
+ struct ti_am_eeprom *ep;
+ int rc;
+
+ rc = ti_i2c_eeprom_am_get(CONFIG_EEPROM_BUS_ADDRESS,
+ CONFIG_EEPROM_CHIP_ADDRESS, &ep);
+ if (rc)
+ printf("ti_i2c_eeprom_init failed %d\n", rc);
+}
+
+#else /* CONFIG_SPL_BUILD */
+
+static void setup_board_eeprom_env(void)
+{
+ char *name = "beagle_x15";
+ int rc;
+ struct ti_am_eeprom_printable p;
+
+ rc = ti_i2c_eeprom_am_get_print(CONFIG_EEPROM_BUS_ADDRESS,
+ CONFIG_EEPROM_CHIP_ADDRESS, &p);
+ if (rc) {
+ printf("Invalid EEPROM data(@0x%p). Default to X15\n",
+ TI_AM_EEPROM_DATA);
+ goto invalid_eeprom;
+ }
+
+ if (board_is_am572x_evm())
+ name = "am57xx_evm";
+ else
+ printf("Unidentified board claims %s in eeprom header\n",
+ p.name);
+
+invalid_eeprom:
+ set_board_info_env(name, p.version, p.serial);
+}
+
+/* Eeprom is alread read by SPL.. nothing more to do here.. */
+
+#endif /* CONFIG_SPL_BUILD */
+
void hw_data_init(void)
{
*prcm = &dra7xx_prcm;
@@ -265,6 +315,8 @@ int board_init(void)
int board_late_init(void)
{
init_sata(0);
+ setup_board_eeprom_env();
+
/*
* DEV_CTRL.DEV_ON = 1 please - else palmas switches off in 8 seconds
* This is the POWERHOLD-in-Low behavior.
diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h
index 6308cab8e680..1fffdb18fbcd 100644
--- a/include/configs/am57xx_evm.h
+++ b/include/configs/am57xx_evm.h
@@ -88,4 +88,8 @@
#define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \
CONFIG_SYS_SCSI_MAX_LUN)
+/* EEPROM */
+#define CONFIG_EEPROM_CHIP_ADDRESS 0x50
+#define CONFIG_EEPROM_BUS_ADDRESS 0
+
#endif /* __CONFIG_AM57XX_EVM_H */
--
1.9.1
More information about the U-Boot
mailing list