From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14CE1C55ABD for ; Mon, 16 Nov 2020 08:11:07 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7FD11222C4 for ; Mon, 16 Nov 2020 08:11:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ikc1DzBV"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="b9xG+7K0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7FD11222C4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ADlqj8RAQIgYJ9R2VwhBbHmLxAEyT+4KIRN0+JqVNgc=; b=ikc1DzBVF1HOEz9rz/ym9XHkO TJ7QE+Ig38ARx6rYvni2tVm4u0dNiFnAOXjSYOfUBozZo0AYvHbabQSKT8nLWcpi4lsZf7BcTkVMe h/9/QitlgR/O0Y+2RqM1glqyiepgkybxiMR83cdD//X5lTCKF/0vOjl761+GC8/ga18l/CGbxnNs4 E5YELPx88iXuGuMNl64r6V4O0/Kj3E1rIKzS4ZlcSBSh9S9uyr04oXQobYedQxCZFsrZbP/29oPLi GuPUe0IFuLH0u7OTGVhbiWF4QiXB1Ow/XlamNLur2BCV03WwGEKx43Ov5fKu6F2QSGEhCKd8ktkj6 Aqvf8pjIQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1keZau-0004bh-M8; Mon, 16 Nov 2020 08:10:36 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1keZar-0004aq-9e for linux-arm-kernel@lists.infradead.org; Mon, 16 Nov 2020 08:10:34 +0000 Received: from dragon (80.251.214.228.16clouds.com [80.251.214.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 450662225B; Mon, 16 Nov 2020 08:10:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605514232; bh=gBo6kcsTmHnIVoOISckwU065LqWskgvsIWbnexyS8Jk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=b9xG+7K0AUIui1Az1PYlnyHeC9JFSxKe8YGCyllvkSPJFBrI6Iu7V8XDRBq4TZPcR c9Tc5T5onOI4/SzxRBjSCIUtW9VIahlacRHoGmz0Y4eZbMwzWHsnHMjaF7OrtGoO1A Nryj43pPJndIjws2R+0vdso7c1UXDdKqpmYPJv14= Date: Mon, 16 Nov 2020 16:10:26 +0800 From: Shawn Guo To: Ivan Zaentsev Subject: Re: [PATCH] ARM: mxs: Add serial number support for i.MX23, i.MX28 SoCs Message-ID: <20201116081025.GF5849@dragon> References: <20201111051859.2776-1-ivan.zaentsev@wirenboard.ru> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201111051859.2776-1-ivan.zaentsev@wirenboard.ru> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201116_031033_509387_25E1E6C8 X-CRM114-Status: GOOD ( 23.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sascha Hauer , Evgeny Boger , Russell King , linux-kernel@vger.kernel.org, NXP Linux Team , Pengutronix Kernel Team , Fabio Estevam , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Nov 11, 2020 at 08:18:59AM +0300, Ivan Zaentsev wrote: > i.MX23 and i.MX28 SoCs unique identifiers are factory-programmed > in On-Chip OTP memory. i.MX28's 64-bit unique id is in > HW_OCOTP_OPS2:HW_OCOTP_OPS3 (see MCIMX28 Ref. Man., sec. 20.4.22-23). > > i.MX23 provides 32-bit long unique id in HW_OCOTP_OPS3. > Though not clearly documented, there is a clue in sec. 35.9.3. > > The unique id is reported in /sys/devices/soc0/serial_number > and in /proc/cpuinfo > > Signed-off-by: Ivan Zaentsev > Suggested-by: Evgeny Boger > --- > arch/arm/mach-mxs/mach-mxs.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c > index c109f47e9cbc..af96368cc16a 100644 > --- a/arch/arm/mach-mxs/mach-mxs.c > +++ b/arch/arm/mach-mxs/mach-mxs.c > @@ -23,6 +23,7 @@ > #include > #include > #include > +#include Can we move it above to get them alphabetically sorted? > > #include "pm.h" > > @@ -51,6 +52,9 @@ > #define MXS_CLR_ADDR 0x8 > #define MXS_TOG_ADDR 0xc > > +#define HW_OCOTP_OPS2 19 /* offset 0x150 */ > +#define HW_OCOTP_OPS3 20 /* offset 0x160 */ Use tabs instead of spaces for indent. > + > static u32 chipid; > static u32 socid; > > @@ -379,6 +383,8 @@ static void __init mxs_machine_init(void) > struct device *parent; > struct soc_device *soc_dev; > struct soc_device_attribute *soc_dev_attr; > + u64 soc_uid = 0; > + const u32 *ocotp = mxs_get_ocotp(); > int ret; > > soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); > @@ -394,8 +400,22 @@ static void __init mxs_machine_init(void) > soc_dev_attr->soc_id = mxs_get_soc_id(); > soc_dev_attr->revision = mxs_get_revision(); > > + if (socid == HW_DIGCTL_CHIPID_MX23) { > + soc_uid = system_serial_low = ocotp[HW_OCOTP_OPS3]; > + } else if (socid == HW_DIGCTL_CHIPID_MX28) { > + soc_uid = system_serial_high = ocotp[HW_OCOTP_OPS2]; > + soc_uid <<= 32; > + system_serial_low = ocotp[HW_OCOTP_OPS3]; > + soc_uid |= system_serial_low; > + } > + > + if (soc_uid) > + soc_dev_attr->serial_number = kasprintf(GFP_KERNEL, "%016llX", soc_uid); > + > soc_dev = soc_device_register(soc_dev_attr); > + Unnecessary newline. Shawn > if (IS_ERR(soc_dev)) { > + kfree(soc_dev_attr->serial_number); > kfree(soc_dev_attr->revision); > kfree(soc_dev_attr); > return; > -- > 2.25.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel