From patchwork Tue Mar 24 22:34:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dileep Katta X-Patchwork-Id: 46296 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 872082159D for ; Tue, 24 Mar 2015 22:36:15 +0000 (UTC) Received: by wivr20 with SMTP id r20sf1860959wiv.0 for ; Tue, 24 Mar 2015 15:36:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=aUXkSf5qTXEj86R368u4otaLaZyGHg+G9lMjr9sFIHI=; b=Lt3qmDjXc+4R/tJ+w9OfURo21CJFttc67jb4ul+gOp6oxEXiexmGc+eW0enaQOmqHh y1AOpAw1zlgkNsQP7Y3iqaRNgPKf8W0qjiOcg7A54pwqJNdV6lx50cfvixmCGOT3tq2/ nCi39Fl2cq90TazZNLC4g1k19a++rr376gbjk2f0KqSzBvT39VEXJ/1jLLv1EocwDt44 xdivnH8M5Y/Ms/lObta2QsJ1ctfc7wuI0WyhhwNk7qk1pbZfd3i/MqKD+AIOUWN4k2Ux emiwEC7LldLQzve4uf4mfX8k+sl9KtyoDUXdiARMTkNeAmiR5IrUdeDxgMjCtaiC8iDa mjcQ== X-Gm-Message-State: ALoCoQmvKJigXD3b7MOqCXNOwztucb2iRvHk36xEwbsIsA07YThm6h9Ln3W9ajmWu21mM7IOkB03 X-Received: by 10.194.161.194 with SMTP id xu2mr1391107wjb.1.1427236574881; Tue, 24 Mar 2015 15:36:14 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.226 with SMTP id t2ls28453laj.42.gmail; Tue, 24 Mar 2015 15:36:14 -0700 (PDT) X-Received: by 10.152.23.166 with SMTP id n6mr5537758laf.67.1427236574643; Tue, 24 Mar 2015 15:36:14 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id xl4si486053lac.1.2015.03.24.15.36.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Mar 2015 15:36:14 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by labe2 with SMTP id e2so5834481lab.3 for ; Tue, 24 Mar 2015 15:36:14 -0700 (PDT) X-Received: by 10.152.178.197 with SMTP id da5mr5903787lac.56.1427236574498; Tue, 24 Mar 2015 15:36:14 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.57.201 with SMTP id k9csp1734273lbq; Tue, 24 Mar 2015 15:36:13 -0700 (PDT) X-Received: by 10.180.103.166 with SMTP id fx6mr31780380wib.4.1427236573685; Tue, 24 Mar 2015 15:36:13 -0700 (PDT) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id z1si1728852wiy.74.2015.03.24.15.36.12; Tue, 24 Mar 2015 15:36:13 -0700 (PDT) Received-SPF: none (google.com: u-boot-bounces@lists.denx.de does not designate permitted sender hosts) client-ip=85.214.87.163; Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8355C4A047; Tue, 24 Mar 2015 23:36:12 +0100 (CET) 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 q3cEsLqgI547; Tue, 24 Mar 2015 23:36:12 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1BEEF4A033; Tue, 24 Mar 2015 23:36:12 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D41F54A033 for ; Tue, 24 Mar 2015 23:36:09 +0100 (CET) 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 CJJml9omZlCj for ; Tue, 24 Mar 2015 23:36:09 +0100 (CET) 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 mail-pa0-f41.google.com (mail-pa0-f41.google.com [209.85.220.41]) by theia.denx.de (Postfix) with ESMTPS id 5E8DF4A02E for ; Tue, 24 Mar 2015 23:36:05 +0100 (CET) Received: by pacwe9 with SMTP id we9so7328346pac.1 for ; Tue, 24 Mar 2015 15:36:04 -0700 (PDT) X-Received: by 10.68.223.226 with SMTP id qx2mr11454894pbc.71.1427236564297; Tue, 24 Mar 2015 15:36:04 -0700 (PDT) Received: from localhost.localdomain ([106.51.139.45]) by mx.google.com with ESMTPSA id dr5sm353082pdb.48.2015.03.24.15.36.01 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 24 Mar 2015 15:36:03 -0700 (PDT) From: Dileep Katta To: nm@ti.com, trini@konsulko.com, rob.herring@linaro.org, srae@broadcom.com, l.majewski@samsung.com, angelabaker@ti.com, robherring2@gmail.com, u-boot@lists.denx.de Date: Wed, 25 Mar 2015 04:04:51 +0530 Message-Id: <1427236492-18032-2-git-send-email-dileep.katta@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1427236492-18032-1-git-send-email-dileep.katta@linaro.org> References: <1427236492-18032-1-git-send-email-dileep.katta@linaro.org> Cc: Dileep Katta Subject: [U-Boot] [PATCH v3 2/3] ARM: DRA7: Set serial number environment variable X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: 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" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: dileep.katta@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This patch populates serial number environment variable from die_id_0 and die_id_1 register values for DRA7xx boards. The function is added in omap common code so that this can be re-used. Serial# environment variable will be useful to show correct information in "fastboot devices" commands. Ref: http://git.omapzoom.org/?p=repo/u-boot.git;a=commit;h=a6bcaaf67f6e4bcd97808f53d0ceb4b0c04d583c Signed-off-by: Angela Stegmaier Signed-off-by: Dileep Katta --- Changes in v2: - None Changes in v3: - corrected the error in the computation of serial# variable - Made it more generic and reusable as per the comments arch/arm/cpu/armv7/omap-common/utils.c | 13 +++++++++++++ arch/arm/cpu/armv7/omap5/prcm-regs.c | 4 ++++ arch/arm/include/asm/omap_common.h | 5 +++++ board/ti/dra7xx/evm.c | 6 ++++++ 4 files changed, 28 insertions(+) diff --git a/arch/arm/cpu/armv7/omap-common/utils.c b/arch/arm/cpu/armv7/omap-common/utils.c index 1696c2d..df5f817 100644 --- a/arch/arm/cpu/armv7/omap-common/utils.c +++ b/arch/arm/cpu/armv7/omap-common/utils.c @@ -60,3 +60,16 @@ void __weak usb_fake_mac_from_die_id(u32 *id) eth_setenv_enetaddr("usbethaddr", device_mac); } } + +void __weak usb_set_serial_num_from_die_id(u32 *id) +{ + char serialno[72]; + uint32_t serialno_lo, serialno_hi; + + if (!getenv("serial#")) { + serialno_hi = id[0]; + serialno_lo = id[1]; + sprintf(serialno, "%08x%08x", serialno_hi, serialno_lo); + setenv("serial#", serialno); + } +} diff --git a/arch/arm/cpu/armv7/omap5/prcm-regs.c b/arch/arm/cpu/armv7/omap5/prcm-regs.c index 440bb40..f80d36d 100644 --- a/arch/arm/cpu/armv7/omap5/prcm-regs.c +++ b/arch/arm/cpu/armv7/omap5/prcm-regs.c @@ -440,6 +440,10 @@ struct omap_sys_ctrl_regs const dra7xx_ctrl = { .control_emif1_sdram_config_ext = 0x4AE0C144, .control_emif2_sdram_config_ext = 0x4AE0C148, .control_wkup_ldovbb_mpu_voltage_ctrl = 0x4AE0C158, + .control_std_fuse_die_id_0 = 0x4AE0C200, + .control_std_fuse_die_id_1 = 0x4AE0C208, + .control_std_fuse_die_id_2 = 0x4AE0C20C, + .control_std_fuse_die_id_3 = 0x4AE0C210, .control_padconf_mode = 0x4AE0C5A0, .control_xtal_oscillator = 0x4AE0C5A4, .control_i2c_2 = 0x4AE0C5A8, diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h index bd43099..13a57ab 100644 --- a/arch/arm/include/asm/omap_common.h +++ b/arch/arm/include/asm/omap_common.h @@ -362,6 +362,10 @@ struct omap_sys_ctrl_regs { u32 control_core_control_io1; u32 control_core_control_io2; u32 control_id_code; + u32 control_std_fuse_die_id_0; + u32 control_std_fuse_die_id_1; + u32 control_std_fuse_die_id_2; + u32 control_std_fuse_die_id_3; u32 control_std_fuse_opp_bgap; u32 control_ldosram_iva_voltage_ctrl; u32 control_ldosram_mpu_voltage_ctrl; @@ -578,6 +582,7 @@ void abb_setup(u32 fuse, u32 ldovbb, u32 setup, u32 control, s8 abb_setup_ldovbb(u32 fuse, u32 ldovbb); void usb_fake_mac_from_die_id(u32 *id); +void usb_set_serial_num_from_die_id(u32 *id); /* ABB */ #define OMAP_ABB_NOMINAL_OPP 0 diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c index 3089fa2..cadff5a 100644 --- a/board/ti/dra7xx/evm.c +++ b/board/ti/dra7xx/evm.c @@ -93,10 +93,16 @@ int board_init(void) int board_late_init(void) { #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG + u32 id[4]; + if (omap_revision() == DRA722_ES1_0) setenv("board_name", "dra72x"); else setenv("board_name", "dra7xx"); + + id[0] = readl((*ctrl)->control_std_fuse_die_id_0); + id[1] = readl((*ctrl)->control_std_fuse_die_id_1); + usb_set_serial_num_from_die_id(id); #endif return 0; }