From patchwork Wed May 24 15:42:41 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: 100445 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp339244qge; Wed, 24 May 2017 08:44:21 -0700 (PDT) X-Received: by 10.80.152.194 with SMTP id j60mr24863070edb.98.1495640661778; Wed, 24 May 2017 08:44:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495640661; cv=none; d=google.com; s=arc-20160816; b=Z+yYYDyNq4kOeWGwo3TE707oyEoxgg3q0qYZXJhlD4y+Com6TJwDk07VUSlXQmqcuU RxhDDVBnAnkvVVUEsNM9wO2RS72OfoIJQOdRmXVsAzIN2ubjF9tE1ohdiTciqQ9Ylhst aNmKbbeBZbkdtMgbzuJotIhy4+dq88so3rE0wKRSk9UPymha00gVNQlQ4o2WBqFBTxnQ oDsLl14fLam61aePfxq7vycEctLULhxrJVEEwVg5XRNhBcL64ZVEohveQmQjtDAY8H4J wmA8oX/FlU08YZ413vjoshHuRFSZdrYifBQ8bweXBfc37BDmlbjepnMxgGBTXOzADeW+ cA/g== 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=gF8k6IN5KkCBfVhcZXTrZ0ShQ1GvcQXNDpAoUF51cr4OPN+Ipt6pztNX95/IswnNIY 1Et6+Oo+9bn3OzQqkQG7+A1WbJWzBTC6qWNffqylZ32kjaoU6+DkOH61Ep5eNVsiYrGh +TGFxkkid8g/1OLW/oOX33Qz1IM3xfA0Tyny7Fw+W+0s4CXnP99tNE9ejbP42CZG8X1T z8b5uqNaJ6M1sHdGsGXAi9TuRto8EAH0drZE/BYBjiDLS+bcEqJiJeT4HVaj04XIqwp8 BK6peli7XYk9gjJNDXx5KmMMBWhKzRbjEZ+p35CeJtBxceM5M3OWmggskSFt52NnsJBs xoig== 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 93si12938148edj.311.2017.05.24.08.44.21; Wed, 24 May 2017 08:44:21 -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 4CD44C21E54; Wed, 24 May 2017 15:43:51 +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 B121BC21E45; Wed, 24 May 2017 15:43:34 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 54A7EC21E2C; Wed, 24 May 2017 15:43:31 +0000 (UTC) Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by lists.denx.de (Postfix) with ESMTPS id E46CBC21D7F for ; Wed, 24 May 2017 15:43:25 +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 v4OFhOpk028616 for ; Wed, 24 May 2017 10:43:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1495640604; bh=DNi6G1LxYMSb8slLN71Y6JfrBrKjdCh2loDG8D28S3E=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ZSSAOOLkQL9h5L2WTHRm3szMb4+OAc8PpLbHDRHPYBi25i8uvJEQGCzMkWaQd8qnC 9qM7K4YkAkj9aZs0kCkohFZK6EUtiUzCnGvIJg3vLw9TvKqh85rc99iq+4f6aFPsRC nLyg6yclYTW4LX0mhdzHsDvo+TliBUCEXQEYaSvk= Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v4OFhOeI016984 for ; Wed, 24 May 2017 10:43:24 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.294.0; Wed, 24 May 2017 10:43:23 -0500 Received: from dbdmail01.india.ti.com (dbdmail01.india.ti.com [172.24.162.206]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v4OFhMQG015986; Wed, 24 May 2017 10:43:23 -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 v4OFhIIq020950; Wed, 24 May 2017 21:13:20 +0530 From: Franklin S Cooper Jr To: , Date: Wed, 24 May 2017 10:42:41 -0500 Message-ID: <20170524154310.10400-2-fcooper@ti.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20170524154310.10400-1-fcooper@ti.com> References: <20170524154310.10400-1-fcooper@ti.com> MIME-Version: 1.0 Cc: Tero Kristo , "Franklin S Cooper Jr ." Subject: [U-Boot] [PATCH v3 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 */