Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2252464rdb; Mon, 9 Oct 2023 19:39:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFJUSEyjkaZBvmMyvOV80j9JVan+5+IN6SWFNwf9jEdjIlszuA5/k/neY1xAgYsS+/Fennr X-Received: by 2002:a17:90a:ce92:b0:274:6135:8363 with SMTP id g18-20020a17090ace9200b0027461358363mr13258179pju.33.1696905558407; Mon, 09 Oct 2023 19:39:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696905558; cv=none; d=google.com; s=arc-20160816; b=vYxGzu1vE25oLQqfVPEecFpZKyxz6ivBMsC2TmF0l3EUsTVpXR4HELeiwbAfRWrcE2 rh8lCVRz0RX56TAbX1P+EUsI70FkhPt/J5suSSn6YG7CQIwQBdrvtv14U9KEdPPsmG4e T3sGOGuLWeNgKsf2KvWfy/CZYldH7kjz9X1fy2zyEefLn0uH4QD5Plb3PhkL+n04Lry0 qU4cqP1pECYFT1Hgegvk5jRn7/V40g3irPdo5XCcUoibmnIbqv8RUoR5mcnPuz4wULrB CUYSj2ILEUA33yy0LP7taknJyl0D/hBoxjxUB3WDIEHyJJ5mK+/JjbgkXWr8wq8P4zW8 2Fhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WQcO7qsNX30mMQgVmFwdCfwOcjEPSEWvZeirZyUEa1Q=; fh=+ohPFfzIOBBWc9OtvCKhynT3HOJnDVwZTgyhmo9V+I8=; b=1JqmIdhqhQVI7C5E4J2BiGSAX4uMEay3feA9aRg1mCfIEqqq+aygVAWBDw4FygPjMh kTIXH/WQWrTc+PiMT5KN3tlNfxVuOdZz7jj5kLOVxygIQLXUXbf6Sf4OQeKwxmkSfNlc 9QRUxmDgCbhMVk81H98aE5L/AYKvzjzX285D9pMj1ZIKh/VSu7ukz8+YinAFsSCZhYrR 6twAOTVzXjoJ0NH+biSnsXhSCfR2uVd/JOjTU3G930MZZTTazsjTAsLgp2XzIuIYmKAu VWrAp/tdHxOHJsTkWFq8HfWPUFFmnxbP00Uzrcz8TCbQwjMvEC8BnONnG7GjYraEMky2 AT6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dIzthgWU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id t24-20020a17090b019800b0027717627cf6si13208341pjs.41.2023.10.09.19.39.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 19:39:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dIzthgWU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 8F731804285A; Mon, 9 Oct 2023 19:39:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441893AbjJJCjE (ORCPT + 99 others); Mon, 9 Oct 2023 22:39:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441879AbjJJCjD (ORCPT ); Mon, 9 Oct 2023 22:39:03 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 487B693 for ; Mon, 9 Oct 2023 19:39:02 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D828C433C7; Tue, 10 Oct 2023 02:38:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696905541; bh=CRpJbftkNFaCLIPhcQgckrIB5Pwz8ytV6P5nMBDZFL4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dIzthgWUBODnznko5YErlVcsGedhd4oY4a9Qr7s0B5IlEk4BpX9UoKGJo+YhGhsGv eSO7SMHMfcNWH2PkQOMQhYTdHD8TrhcaFJeg1ob81gv3cM6rMruQma/5uYbleHwd1z 4ri+9+3xw+5MwzSimg7xWPexOQN2LZUYpmR1rKByTJe/bECUFglyQkmpNkMDm0wCIt l4zHkXL7oL/6DJiWTLHc9a9D53onKl7/4pxv7qQdjtIjxGGglfls0yk0fwteVHDSJB HJPR0ecyKTn+pv1aKALP8N4jJve51q3pJ5+s2OWIZRXNoAxiXjxeyG20C3sDP4omb1 SW9Wi5UPTDHgw== Date: Tue, 10 Oct 2023 10:38:51 +0800 From: Shawn Guo To: "Peng Fan (OSS)" Cc: s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan Subject: Re: [PATCH] soc: imx8mp: support 128 bits UID Message-ID: <20231010023851.GN819755@dragon> References: <20231008083808.1517132-1-peng.fan@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231008083808.1517132-1-peng.fan@oss.nxp.com> X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 09 Oct 2023 19:39:15 -0700 (PDT) X-Spam-Level: ** On Sun, Oct 08, 2023 at 04:38:08PM +0800, Peng Fan (OSS) wrote: > From: Peng Fan > > Current driver only supports 64bits UID for i.MX8MP, but > i.MX8MP UID is actually 128bits, the high 64bits is at 0xE00. > So update driver to support it. > > Signed-off-by: Peng Fan > --- > drivers/soc/imx/soc-imx8m.c | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > > diff --git a/drivers/soc/imx/soc-imx8m.c b/drivers/soc/imx/soc-imx8m.c > index ec87d9d878f3..5dcc227d41c0 100644 > --- a/drivers/soc/imx/soc-imx8m.c > +++ b/drivers/soc/imx/soc-imx8m.c > @@ -24,6 +24,7 @@ > #define OCOTP_UID_HIGH 0x420 > > #define IMX8MP_OCOTP_UID_OFFSET 0x10 > +#define IMX8MP_OCOTP_UID_HIGH 0xE00 Lowercase for hex values just like other macros in the file? > > /* Same as ANADIG_DIGPROG_IMX7D */ > #define ANADIG_DIGPROG_IMX8MM 0x800 > @@ -34,6 +35,7 @@ struct imx8_soc_data { > }; > > static u64 soc_uid; > +static u64 soc_uid_h; > > #ifdef CONFIG_HAVE_ARM_SMCCC > static u32 imx8mq_soc_revision_from_atf(void) > @@ -122,8 +124,15 @@ static void __init imx8mm_soc_uid(void) > soc_uid <<= 32; > soc_uid |= readl_relaxed(ocotp_base + OCOTP_UID_LOW + offset); > > + if (offset) { > + soc_uid_h = readl_relaxed(ocotp_base + IMX8MP_OCOTP_UID_HIGH + 0x10); > + soc_uid_h <<= 32; > + soc_uid_h |= readl_relaxed(ocotp_base + IMX8MP_OCOTP_UID_HIGH); > + } > + > clk_disable_unprepare(clk); > clk_put(clk); > + Unrelated change. > iounmap(ocotp_base); > of_node_put(np); > } > @@ -222,7 +231,12 @@ static int __init imx8_soc_init(void) > goto free_soc; > } > > - soc_dev_attr->serial_number = kasprintf(GFP_KERNEL, "%016llX", soc_uid); > + if (soc_uid_h) { > + soc_dev_attr->serial_number = kasprintf(GFP_KERNEL, "%016llX%016llX", > + soc_uid_h, soc_uid); > + } else { > + soc_dev_attr->serial_number = kasprintf(GFP_KERNEL, "%016llX", soc_uid); > + } Unnecessary braces for single statement. Also it would be nice to have a newline here. Shawn > if (!soc_dev_attr->serial_number) { > ret = -ENOMEM; > goto free_rev; > -- > 2.37.1 >