From patchwork Tue Feb 27 22:26:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 129871 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp329275lja; Tue, 27 Feb 2018 14:26:25 -0800 (PST) X-Google-Smtp-Source: AH8x226Vn5mtkWPJ1kQT1zWq9jFee3RipYfy4zDfJm3XAKlaINDz2W8m6yx4GJiXH4JaMvHo52PV X-Received: by 10.80.142.83 with SMTP id 19mr20400147edx.141.1519770385111; Tue, 27 Feb 2018 14:26:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519770385; cv=none; d=google.com; s=arc-20160816; b=cltWzgz7MyRDr5N9AJZw8CvEavCgm18yJ2k7jybUtcNcfDgmdZbqNF9NjAaz7F5Cy7 iihmnP7CiduYNRN23zQAu0lb+09K9tYv9USlZKBA+Sn+VGwDI7SVw5Gc2zDZ+kBulyeZ JjctfzVtHW1FKZa+ntWl+awSt6HUpTL2pVQByHcIjIUJzkIlxMOQYb3Y+s4efwuIjQeT 1t0CoVmjopmqqh5kS+AV0+TpnCSCMYCZnAiIgU66M9lpbnRmEqC7dBCvnW8uniLKafVP SdToJFrphJxB4aPyVU6dUrxcA1AYJEBh8KMdAtIyr4kLkw+YKJOD0Rhl+aj/KaIEX/yP tOKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=lT+TYCIRolAlRRNVfYUw87lESIyfxiXNjpbhj9e3R2c=; b=dYdwtvtboLfm3HcJmbbg4YCSopqFKYBBsK2NPbWP8ZyYqpFO5ZSJIqeusHIUErE9UZ ll1yQy+zNjiOYeERrqTuhzXB1pk5VaNUI49Y6RPblpkTXbu47EH/XINFA8ppWdwhMomI eoOuSQxY5bL0Tr4ydiZqBBbLQ20pQBvWCaPjBgSQae1ymo7H8AqM1QHeMrdZZNjMxvOI pHSf9x/91WVEElry1BBEXZ9qFy4REAwQ27XGVLeuHNmXjc3w7wDApen3oKEHAQMzIfco wptQVke+1yLh31/tYaBVCkUtgISmMHgHgwneeJOzNNTYOHfFKZGDW00vxsmvyOAw0TqP KStQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DreX5USt; 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=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id j3si390613edk.34.2018.02.27.14.26.24; Tue, 27 Feb 2018 14:26:25 -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=@linaro.org header.s=google header.b=DreX5USt; 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=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 9FA5BC221CB; Tue, 27 Feb 2018 22:26:22 +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_MSPIKE_H2, 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 707F4C21F99; Tue, 27 Feb 2018 22:26:20 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 774DDC21FBB; Tue, 27 Feb 2018 22:26:19 +0000 (UTC) Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by lists.denx.de (Postfix) with ESMTPS id 5CAE9C21F99 for ; Tue, 27 Feb 2018 22:26:18 +0000 (UTC) Received: by mail-wr0-f194.google.com with SMTP id v65so376512wrc.11 for ; Tue, 27 Feb 2018 14:26:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=dNuOcoJwMNNTaSuwETNrnQHfVNBO8gpZV3KFtLjLUxE=; b=DreX5USteOTIWNSTtwgit5yK7WGB84GM1y6b/OCCeYpzBGrzXg50jIhon/n41lIfFh W+kCS/CAJCyYFfiDsn1DznmUnW9yf6BrYXSHEbg6YitBaqbrSQrO90rmNVCpWW8woZBM z3dT4I5XUSJ25enhHzel/7EaqzZdUex3xO4+E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=dNuOcoJwMNNTaSuwETNrnQHfVNBO8gpZV3KFtLjLUxE=; b=DwcRs2kFo0z+X7UETgGh2uB/a5ZfeAeoIwRWvF8B0dPF0bEDcCN5cQ3EbBTCCq9w6n Bp7HuNG/ibUHNdxzwVTzMgfOqDU9Cq4Rd+OU8g4aLPVOsKDqq4eaZmG31yZgTGdpL9r6 D2S4YiOAQCB9GngLy4iHnYo9bf/XUXvntXUeN3hOYg4MoGtvbUCCZPuHNl9r/dmaJftx za29j+FowWKS6uEuA1OwOt+1R6JBY9JTps+XNI17BcIxGwN/TNZXda9PvRqt/FMjS4Q1 69ZrNvVr/cH2g2Zsje6O2JFKHD6at0QnEvsQj2Lr9rf0cyDYxgiAANCnvoUkAvf5on2/ r35w== X-Gm-Message-State: APf1xPD/P2xWanU1do6p1n2tqe52HOVIvLJHXHGoNNSYbuB6Li/X22EI ZU5kmsY//7rPiHgqGMNRsE4+nmtObjE= X-Received: by 10.223.192.74 with SMTP id c10mr2617766wrf.145.1519770377623; Tue, 27 Feb 2018 14:26:17 -0800 (PST) Received: from localhost ([195.238.92.76]) by smtp.gmail.com with ESMTPSA id k130sm664292wmg.9.2018.02.27.14.26.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2018 14:26:16 -0800 (PST) From: Sam Protsenko To: u-boot@lists.denx.de Date: Wed, 28 Feb 2018 00:26:15 +0200 Message-Id: <20180227222615.23935-1-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.16.1 Cc: Tom Rini Subject: [U-Boot] [PATCH v2 1/1] board: am335x: Set serial# variable 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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" serial# variable is needed to show the device correctly in "fastboot devices" output. It's useful when we have several devices (in fastboot mode) connected to single host and want to choose which one to flash. We can't use omap_die_id_serial() for this, because AM335x lacks DIE_ID, as can be seen from AM335x TRM. Let's do next: - reuse board_serial variable (obtained from EEPROM in set_board_info_env() function) to set serial# - if board_serial is "unknown", reuse ethaddr variable to set serial# Signed-off-by: Sam Protsenko Reviewed-by: Tom Rini Reviewed-by: Tom Rini --- board/ti/am335x/board.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index 1a52bffc00..6a0ff5a93e 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -767,6 +767,16 @@ int board_late_init(void) } #endif + if (!env_get("serial#")) { + char *board_serial = env_get("board_serial"); + char *ethaddr = env_get("ethaddr"); + + if (!board_serial || !strncmp(board_serial, "unknown", 7)) + env_set("serial#", ethaddr); + else + env_set("serial#", board_serial); + } + return 0; } #endif