From patchwork Fri Nov 6 00:39:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kipisz, Steven" X-Patchwork-Id: 540769 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 543671409C3 for ; Fri, 6 Nov 2015 11:40:56 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 208F8A748D; Fri, 6 Nov 2015 01:40:54 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Vft_ROOE26Fs; Fri, 6 Nov 2015 01:40:53 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 28381A747D; Fri, 6 Nov 2015 01:40:53 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 74A3EA7488 for ; Fri, 6 Nov 2015 01:40:45 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QWKaHPDvYBgx for ; Fri, 6 Nov 2015 01:40:45 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by theia.denx.de (Postfix) with ESMTPS id 60C38A745F for ; Fri, 6 Nov 2015 01:40:41 +0100 (CET) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id tA60ddPL022868; Thu, 5 Nov 2015 18:39:39 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id tA60ddEL018250; Thu, 5 Nov 2015 18:39:39 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Thu, 5 Nov 2015 18:39:39 -0600 Received: from uda0867407.am.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id tA60dcSc023847; Thu, 5 Nov 2015 18:39:39 -0600 From: Steve Kipisz To: , , , Date: Thu, 5 Nov 2015 18:39:36 -0600 Message-ID: <1446770376-8205-7-git-send-email-s-kipisz2@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446770376-8205-1-git-send-email-s-kipisz2@ti.com> References: <1446770376-8205-1-git-send-email-s-kipisz2@ti.com> MIME-Version: 1.0 Cc: beagleboard-x15@googlegroups.com Subject: [U-Boot] [PATCH v4 7/7] board: ti: AM57xx: Add detection logic for AM57xx-evm X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 Acked-by: Igor Grinberg Reviewed-by: Tom Rini --- 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 #include "mux_data.h" +#include + +#define board_is_x15() board_am_is("BBRDX15_") +#define board_is_am572x_evm() board_am_is("AM572PM_") #ifdef CONFIG_DRIVER_TI_CPSW #include @@ -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 */