From patchwork Mon Jul 20 13:17:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Kocialkowski X-Patchwork-Id: 497715 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 18F671402CC for ; Mon, 20 Jul 2015 23:18:25 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DFCE54B6C7; Mon, 20 Jul 2015 15:18:11 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NKYtAeJFb5id; Mon, 20 Jul 2015 15:18:11 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 383704B691; Mon, 20 Jul 2015 15:18:06 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E34394B660 for ; Mon, 20 Jul 2015 15:18:03 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GgT46XK0Ao8i for ; Mon, 20 Jul 2015 15:18:03 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from gagarine.paulk.fr (gagarine.paulk.fr [109.190.93.129]) by theia.denx.de (Postfix) with ESMTPS id 6F4B74B695 for ; Mon, 20 Jul 2015 15:17:59 +0200 (CEST) Received: by gagarine.paulk.fr (Postfix, from userid 65534) id D5EFA1FE68; Mon, 20 Jul 2015 15:17:58 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on gagarine.paulk.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from armstrong.paulk.fr (armstrong.paulk.fr [82.233.88.171]) by gagarine.paulk.fr (Postfix) with ESMTPS id 2A45A20081; Mon, 20 Jul 2015 15:17:25 +0200 (CEST) Received: from localhost.localdomain (aldrin [192.168.0.128]) by armstrong.paulk.fr (Postfix) with ESMTP id 4E08337891; Mon, 20 Jul 2015 15:17:22 +0200 (CEST) From: Paul Kocialkowski To: u-boot@lists.denx.de Date: Mon, 20 Jul 2015 15:17:13 +0200 Message-Id: <1437398238-27912-8-git-send-email-contact@paulk.fr> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1437398238-27912-1-git-send-email-contact@paulk.fr> References: <1437398238-27912-1-git-send-email-contact@paulk.fr> Cc: Tom Rini , Tom Rix , Przemyslaw Marczak Subject: [U-Boot] [PATCH 07/12] sniper: Serial number support, obtained from die ID X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 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" The OMAP3 has some die-specific ID bits that we can use to give the device a (more or less) unique serial number. This is particularly useful for e.g. USB. Signed-off-by: Paul Kocialkowski --- board/lge/sniper/sniper.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/board/lge/sniper/sniper.c b/board/lge/sniper/sniper.c index 44d422d..f26855d 100644 --- a/board/lge/sniper/sniper.c +++ b/board/lge/sniper/sniper.c @@ -70,7 +70,9 @@ int board_init(void) int misc_init_r(void) { + char serial_string[17] = { 0 }; char reboot_mode[2] = { 0 }; + u32 dieid[4] = { 0 }; /* Reboot mode */ @@ -82,6 +84,17 @@ int misc_init_r(void) omap_reboot_mode_clear(); } + /* Serial number */ + + get_dieid((u32 *)&dieid); + + if (!getenv("serial#")) { + snprintf(serial_string, sizeof(serial_string), + "%08x%08x", dieid[0], dieid[3]); + + setenv("serial#", serial_string); + } + return 0; }