From patchwork Fri Jun 16 22:25:04 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: 105764 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp1521172qgd; Fri, 16 Jun 2017 15:26:44 -0700 (PDT) X-Received: by 10.80.152.112 with SMTP id h45mr8933141edb.103.1497652004570; Fri, 16 Jun 2017 15:26:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1497652004; cv=none; d=google.com; s=arc-20160816; b=dvwGMY2J3TvMca9WXaUB+gmTUXqj4W2QhlcubmMtifj1oM2ggdsL8uy651Kd5ewjGe QZIA84R6Sxt2PU/YINS9GvcRupNYlrpRqFcCfF5CUed/iqz5Hvd5l3IALzwStsVsEbV1 Gfx7mDFkA2pMi3Wf7PL/LiRq0xlBGOvQNhcrRKfBEuY56NIUlD7hDaW0PEdjFTDwbHPs XCq2pGpzBcCFFfGUKP9k6iuSaaoDVA7L/OoyRIIG7X/yDrlig/MjlxDYIpbkmPa8SbY0 9bYcJ9/qnEFSMQRxXvXOebuBewJEbCXyJlbOV15axBsCy2w+x+UkxEXnR/QNnpsK2zH9 QCjA== 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=Xzb9PUrP4OBGAyMIbJ7Sk3bWm9lA253mBD2PDffE5wk=; b=etKr/tBWLQjd8iBXXEWiOE6YMI4LqX1L3SlxMzK+z1iPqiiLlBBIcuzGgYEA53RLxS TdzNGDBQ6FlwElm0kPjHlFC6SoiIS8zZJVYGNjrGctRR7ktfKY2/d2F7OhUkeMCzcCMv SNeMbDhJFfVOIatZ2Ma2SddMSrqM1e4vgiy7d6mBIUaBdCDalNAD4on+dRlUTq410cAu k/slC12I32Fvcz/0zsN6Fw5IwHCBZfZ7y5XwD4LOw1KbwWqPjO7pRDT5iF3QcfinYn21 GT+wLl7hqm1HSdVSZmbPycEIjMN4BdVxG5pW1uQZc0LUpWynNTKKUoGKL71zGuAEwC8u c0yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.b=mg3O/6J5; 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 m26si2962528edj.60.2017.06.16.15.26.44; Fri, 16 Jun 2017 15:26:44 -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 header.b=mg3O/6J5; 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 0BD31C21CDB; Fri, 16 Jun 2017 22:26:27 +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 2F4E4C21C8C; Fri, 16 Jun 2017 22:26:10 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 95D9AC21C7F; Fri, 16 Jun 2017 22:26:05 +0000 (UTC) Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by lists.denx.de (Postfix) with ESMTPS id 36AC5C21C2D for ; Fri, 16 Jun 2017 22:26:03 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id v5GMQ1YU017476 for ; Fri, 16 Jun 2017 17:26:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1497651961; bh=gIC6xFJ8bQIIWmsZ8QCYE6fznDazX/fWFxXfjWvHExY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=mg3O/6J5Bj8xq8Hw0F4Yon2NstAUpsrabviR9T+cKf3H2N4/+4BJLa6LSZvgwm9u3 F1lolkSX3jhYOhj2VonGI0AnEpKRzFbd85VoNRMG/0oDf+GjZm+deN9aUMHpdV+j8g PxkynYipCQwprnhRk1P1seifzsZky+dkSE2URpvE= 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 v5GMQ1U3007513 for ; Fri, 16 Jun 2017 17:26:01 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.294.0; Fri, 16 Jun 2017 17:26:00 -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 v5GMQ0Yx023065; Fri, 16 Jun 2017 17:26:00 -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 v5GMPtgN005946; Sat, 17 Jun 2017 03:55:57 +0530 From: Franklin S Cooper Jr To: , Date: Fri, 16 Jun 2017 17:25:04 -0500 Message-ID: <20170616222533.25008-2-fcooper@ti.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20170616222533.25008-1-fcooper@ti.com> References: <20170616222533.25008-1-fcooper@ti.com> MIME-Version: 1.0 Cc: Tero Kristo , "Franklin S Cooper Jr ." Subject: [U-Boot] [PATCH v4 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. Reviewed-by: Tom Rini --- 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 */