From patchwork Thu Mar 2 19:04:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Franklin S Cooper Jr X-Patchwork-Id: 94800 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp304741qgd; Thu, 2 Mar 2017 11:04:54 -0800 (PST) X-Received: by 10.223.164.83 with SMTP id e19mr13588948wra.201.1488481494289; Thu, 02 Mar 2017 11:04:54 -0800 (PST) Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 74si27130700wmq.55.2017.03.02.11.04.53; Thu, 02 Mar 2017 11:04:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ti.com Received: by lists.denx.de (Postfix, from userid 105) id 5BCCEC21C92; Thu, 2 Mar 2017 19:04:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 5E0DEC21C35; Thu, 2 Mar 2017 19:04:50 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BFBF2C21C35; Thu, 2 Mar 2017 19:04:48 +0000 (UTC) Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by lists.denx.de (Postfix) with ESMTPS id 14943C21C33 for ; Thu, 2 Mar 2017 19:04:47 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id v22J4kmG032615 for ; Thu, 2 Mar 2017 13:04:46 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1488481486; bh=SVcyMHGi8kWugMIMCn0nBaezXP4pXQD12Js3GRWiemI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Crh+SddFR4Fz9RbmlBw6UvPNhEITyU+ao0fTA60+1MhygUDIijDg6WoR1HHHAnP1W RmHElg/MuBAyDqr9MiirJ8xKeXlVCQ4pexvegR6ew5bOEWW7c/UYm4y5SU5/bFbuWf lO5QiQVz0q4EENwuxMbOf3HufhBDYiHt4SXEqXHI= Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v22J4kXE013631 for ; Thu, 2 Mar 2017 13:04:46 -0600 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.294.0; Thu, 2 Mar 2017 13:04:45 -0600 Received: from dbdmail01.india.ti.com (dbdmail01.india.ti.com [172.24.162.206]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v22J4iQk006759; Thu, 2 Mar 2017 13:04:45 -0600 Received: from udb0273011.am.dhcp.ti.com (udb0273011.am.dhcp.ti.com [128.247.83.33]) by dbdmail01.india.ti.com (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id v22J4d25015682; Fri, 3 Mar 2017 00:34:42 +0530 From: Franklin S Cooper Jr To: , , , Date: Thu, 2 Mar 2017 13:04:05 -0600 Message-ID: <20170302190435.23212-2-fcooper@ti.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20170302190435.23212-1-fcooper@ti.com> References: <20170302190435.23212-1-fcooper@ti.com> MIME-Version: 1.0 Cc: Tero Kristo , "Franklin S Cooper Jr ." Subject: [U-Boot] [PATCH 01/31] ti: common: board_detect: Allow settings board detection variables manually X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" From: Nishanth Menon In some situations the EEPROM used for board detection may not be programmed or simply programmed incorrectly. Therefore, it may be necessary to "simulate" reading the contents of the EEPROM to set appropriate variables used in the board detection code. This may also be helpful in certain boot modes where doing i2c reads may be costly and the config supports running only a specific board. Signed-off-by: Nishanth Menon Signed-off-by: Tero Kristo Signed-off-by: Keerthy Signed-off-by: Franklin S Cooper Jr. --- board/ti/common/board_detect.c | 24 ++++++++++++++++++++++++ board/ti/common/board_detect.h | 17 +++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c index a5dba94..5aaf884 100644 --- a/board/ti/common/board_detect.c +++ b/board/ti/common/board_detect.c @@ -116,6 +116,30 @@ static int __maybe_unused ti_i2c_eeprom_get(int bus_addr, int dev_addr, return 0; } +int __maybe_unused ti_i2c_eeprom_am_set(const char *name, const char *rev) +{ + struct ti_common_eeprom *ep; + + if (!name || !rev) + return -1; + + ep = TI_EEPROM_DATA; + if (ep->header == TI_EEPROM_HEADER_MAGIC) + goto already_set; + + /* Set to 0 all fields */ + memset(ep, 0, sizeof(*ep)); + strncpy(ep->name, name, TI_EEPROM_HDR_NAME_LEN); + strncpy(ep->version, rev, TI_EEPROM_HDR_REV_LEN); + /* Some dummy serial number to identify the platform */ + strncpy(ep->serial, "0000", TI_EEPROM_HDR_SERIAL_LEN); + /* Mark it with a valid header */ + ep->header = TI_EEPROM_HEADER_MAGIC; + +already_set: + return 0; +} + int __maybe_unused ti_i2c_eeprom_am_get(int bus_addr, int dev_addr) { int rc; diff --git a/board/ti/common/board_detect.h b/board/ti/common/board_detect.h index 343fcb4..eeeacd3 100644 --- a/board/ti/common/board_detect.h +++ b/board/ti/common/board_detect.h @@ -193,4 +193,21 @@ u64 board_ti_get_emif2_size(void); */ void set_board_info_env(char *name); +/** + * ti_i2c_eeprom_am_set() - Setup the eeprom data with predefined values + * @name: Name of the board + * @rev: Revision of the board + * + * In some cases such as in RTC-only mode, we are able to skip reading eeprom + * and wasting i2c based initialization time by using predefined flags for + * detecting what platform we are booting on. For those platforms, provide + * a handy function to pre-program information. + * + * NOTE: many eeprom information such as serial number, mac address etc is not + * available. + * + * Return: 0 if all went fine, else return error. + */ +int ti_i2c_eeprom_am_set(const char *name, const char *rev); + #endif /* __BOARD_DETECT_H */ From patchwork Thu Mar 2 19:04:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Franklin S Cooper Jr X-Patchwork-Id: 94801 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp306524qgd; Thu, 2 Mar 2017 11:09:20 -0800 (PST) X-Received: by 10.223.173.76 with SMTP id p70mr13032396wrc.168.1488481760305; Thu, 02 Mar 2017 11:09:20 -0800 (PST) Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id u4si11784129wrb.59.2017.03.02.11.09.19; Thu, 02 Mar 2017 11:09:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ti.com Received: by lists.denx.de (Postfix, from userid 105) id B3BB8C21C45; Thu, 2 Mar 2017 19:07:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 881B1C21CB9; Thu, 2 Mar 2017 19:06:07 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C44E6C21C9D; Thu, 2 Mar 2017 19:05:14 +0000 (UTC) Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by lists.denx.de (Postfix) with ESMTPS id BEB13C21CE1 for ; Thu, 2 Mar 2017 19:05:07 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v22J56K3021071 for ; Thu, 2 Mar 2017 13:05:06 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1488481506; bh=mINhq7/W4NtpcSYyxwy3YAyj7eE2kFpVTuHTGRAsO/0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=oQtgeeTPbp3fxGhNWVf2WdFMd6GvpkCBlG2ko86zxLOFkkD9d7/GMEnHrt7UvlQHx u8fqJdhQ1cyfO7AFGS1ZD+7IwVwHdiR0+slngFGC+U6WurJlNLYBzJ80/PkO6SIyTG nf70L2hqwlS+Tni1TCl6KnqDFTy9Wz3/xKF6N9Ks= Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v22J56ao014016 for ; Thu, 2 Mar 2017 13:05:06 -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.294.0; Thu, 2 Mar 2017 13:05:05 -0600 Received: from dbdmail01.india.ti.com (dbdmail01.india.ti.com [172.24.162.206]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v22J54r1023358; Thu, 2 Mar 2017 13:05:05 -0600 Received: from udb0273011.am.dhcp.ti.com (udb0273011.am.dhcp.ti.com [128.247.83.33]) by dbdmail01.india.ti.com (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id v22J4d2E015682; Fri, 3 Mar 2017 00:35:02 +0530 From: Franklin S Cooper Jr To: , , , Date: Thu, 2 Mar 2017 13:04:14 -0600 Message-ID: <20170302190435.23212-11-fcooper@ti.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20170302190435.23212-1-fcooper@ti.com> References: <20170302190435.23212-1-fcooper@ti.com> MIME-Version: 1.0 Subject: [U-Boot] [PATCH 10/31] ARM: Use Kconfig for board EEPROM's I2C bus and chip address X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" From: Roger Quadros In stead of defining the board EEPROM address in the board headers let's define them in the board config files and make them configurable by Kconfig. Signed-off-by: Roger Quadros Reviewed-by: Tom Rini --- board/ti/common/Kconfig | 20 +++++++++++++++++--- board/ti/ks2_evm/Kconfig | 2 ++ include/configs/am57xx_evm.h | 4 ---- include/configs/dra7xx_evm.h | 4 ---- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/board/ti/common/Kconfig b/board/ti/common/Kconfig index 4980a04..162248c 100644 --- a/board/ti/common/Kconfig +++ b/board/ti/common/Kconfig @@ -1,12 +1,24 @@ -config SPL_ENV_SUPPORT - default y - config TI_I2C_BOARD_DETECT bool "Support for Board detection for TI platforms" help Support for detection board information on Texas Instrument's Evaluation Boards which have I2C based EEPROM detection +config EEPROM_BUS_ADDRESS + int "Board EEPROM's I2C bus address" + range 0 8 + default 0 + +config EEPROM_CHIP_ADDRESS + hex "Board EEPROM's I2C chip address" + range 0 0xff + default 0x50 + +if ARCH_OMAP2 + +config SPL_ENV_SUPPORT + default y + config SPL_EXT_SUPPORT default y @@ -39,3 +51,5 @@ config SPL_POWER_SUPPORT config SPL_SERIAL_SUPPORT default y + +endif diff --git a/board/ti/ks2_evm/Kconfig b/board/ti/ks2_evm/Kconfig index c0568ec..9477f53 100644 --- a/board/ti/ks2_evm/Kconfig +++ b/board/ti/ks2_evm/Kconfig @@ -49,3 +49,5 @@ config SYS_CONFIG_NAME default "k2g_evm" endif + +source "board/ti/common/Kconfig" diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h index 3d8b996..40a3bbd 100644 --- a/include/configs/am57xx_evm.h +++ b/include/configs/am57xx_evm.h @@ -103,10 +103,6 @@ #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 - /* * Default to using SPI for environment, etc. * 0x000000 - 0x040000 : QSPI.SPL (256KiB) diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h index 549439e..2996807 100644 --- a/include/configs/dra7xx_evm.h +++ b/include/configs/dra7xx_evm.h @@ -261,8 +261,4 @@ #endif #endif /* NOR support */ -/* EEPROM */ -#define CONFIG_EEPROM_CHIP_ADDRESS 0x50 -#define CONFIG_EEPROM_BUS_ADDRESS 0 - #endif /* __CONFIG_DRA7XX_EVM_H */