From patchwork Tue May 23 17:42:30 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: 100381 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp434907qge; Tue, 23 May 2017 10:52:49 -0700 (PDT) X-Received: by 10.80.149.3 with SMTP id u3mr21213604eda.76.1495561969486; Tue, 23 May 2017 10:52:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495561969; cv=none; d=google.com; s=arc-20160816; b=y7yCZGEqXSYv6+O75styi6HfjlMkmyTLhGb2ru2skVtUMWQnRfUhM+4lvov7r+Kfb5 hg2JPvpRibw5f+PGz63u33xSOLmR6o+WUTWYZum9NsWhxBKiUrXufjcv0G10tXoBcxGq +EP76rSFUHKXr6G5AkibPz5kf4/e+0986F7zwrf2NogtCX7044BOMIGP1C2wMOx2POg+ c/L42DweBjgP1Ked6+fVyARMAeKF86f4x2X0W2FDyl5JVboi/uTEX1BDf7cazmMh4jWs iKSRdtUdPHhlBUTPKnawLr7G2inaGQk0F3cIRef9RBeANynNXL8FYDLpmtTGwwd3VY6u fKGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=c29w9n99xS5WI2BtiKPBMNUyu4MxTfZmTOwqiT/5DIk=; b=yW8SmpbroV/hn6wtVbz1oG6Ysu3yshy9Qm7+90ZpD7tMAuijiekTI4Oc+ZPc1JvlNb CEILXrYTVkn9T3ilLFc/tipf+F69GWRWMpBDUyF6n0CQalVpJdT5wjXk1iJW2TwJIzA1 a1ZDeFZMwcMzb+qXq9TvPObTTZq6fOQgIOUfgc4MawjUwyiagGYuD41N31eLPZC23vsp SAmBBqAEXGEUsrUhRyrPvbm+vTc1+G69Zn8D0e8uUhw4PPUIiLnMRFWCfuwuhBg6PhBa 6W9U1dsdD3rF7lzTAbibT7VilUwjMdkdmTsmnWB3XTTcp2+ap7ASJSkGCPKdu9eVCaZd qFkw== ARC-Authentication-Results: i=1; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id f5si7417368edd.72.2017.05.23.10.52.49; Tue, 23 May 2017 10:52:49 -0700 (PDT) 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: by lists.denx.de (Postfix, from userid 105) id 084E5C21C47; Tue, 23 May 2017 17:49:43 +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=RCVD_IN_DNSWL_NONE, 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 9108FC21CA1; Tue, 23 May 2017 17:46:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 46101C21C95; Tue, 23 May 2017 17:45:49 +0000 (UTC) Received: from fllnx209.ext.ti.com (fllnx209.ext.ti.com [198.47.19.16]) by lists.denx.de (Postfix) with ESMTPS id BFD29C21C3C for ; Tue, 23 May 2017 17:45:42 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v4NHjQYD001278 for ; Tue, 23 May 2017 12:45:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1495561526; bh=DNi6G1LxYMSb8slLN71Y6JfrBrKjdCh2loDG8D28S3E=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=RewtksHU3RA0sS3uNEW+bE/w8yqKc5+MFZq6FjljbYC8Z2wcD5QtIymGjQDV/961V HrMRkHUs6Fpz5hxWa5NtJpv2cxVm6P+Ed8uT1gBT4LtDGEZdu2HW3QoYNitYw1h5Df E7kznBRmhBdCQSYM4/tJQXq9LRMSqc/vVNdGRpIo= 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 v4NHjLCH025305 for ; Tue, 23 May 2017 12:45:21 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.294.0; Tue, 23 May 2017 12:45:20 -0500 Received: from dbdmail01.india.ti.com (dbdmail01.india.ti.com [172.24.162.206]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v4NHjJ7U006700; Tue, 23 May 2017 12:45:20 -0500 Received: from udb0273011.dhcp.ti.com (udb0273011.dhcp.ti.com [128.247.59.33]) by dbdmail01.india.ti.com (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id v4NHjF8X006383; Tue, 23 May 2017 23:15:17 +0530 From: Franklin S Cooper Jr To: , Date: Tue, 23 May 2017 12:42:30 -0500 Message-ID: <20170523174259.14797-2-fcooper@ti.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20170523174259.14797-1-fcooper@ti.com> References: <20170523174259.14797-1-fcooper@ti.com> MIME-Version: 1.0 Cc: Tero Kristo , "Franklin S Cooper Jr ." Subject: [U-Boot] [PATCH v2 01/30] 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 6fdcb61..bf594cb 100644 --- a/board/ti/common/board_detect.c +++ b/board/ti/common/board_detect.c @@ -173,6 +173,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 88b0a59..e8d9484 100644 --- a/board/ti/common/board_detect.h +++ b/board/ti/common/board_detect.h @@ -205,4 +205,21 @@ void set_board_info_env(char *name); */ void board_ti_set_ethaddr(int index); +/** + * 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 */