Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp449752ybd; Wed, 26 Jun 2019 00:43:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/bGCYzltKPceaiVXuKajwIE/Pw3lgCIG12+dek9ohBcywXtfv6GbLDOvQs2jbaK9gpGj2 X-Received: by 2002:a63:d950:: with SMTP id e16mr1632680pgj.271.1561535008134; Wed, 26 Jun 2019 00:43:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561535008; cv=none; d=google.com; s=arc-20160816; b=Iz6t7P8E2HKSTdok1xGR3+e2RKzhAo+WLwWhQKxc1YsUVIQ1OZVPefD+wWySLcde4g wcw5cVLIHNhlFSEA1dsZZCe1bwrXZFwRgNTUJ8CGBx7sSL9hfIVrqkErg7mpuqY5aEc/ qz4JpNBQa2SNwRaBfo6n1RQRDx8IleZ4h7d8WHmoJoU4NwO2voA8pZNzTAVVfUjQlCkp U/81A+A4zbdbj6oST6un+Xn7d6Ws+EhdjmuQrYEKWHX8Pygj4bwKP2gqjW3nOIjnpytW fE9XXNFMyWxYjCilLvUJTMfAXMyPcRWueYX+DpXU02t1RI/zdy45ClQXhZRmbktIyYr/ 0L6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=tLXvNAC6a+tSsO6NfHhqvc7Rv/CzAW/cQFXqnf7g8IU=; b=TWG8/3RRvHDY1++2gVleo3xPITbnCPTsWFWoH80XFsvxoQosLGX+Ta/HMGIsf9ULK8 BhfEqqO2PpLVw+SMtgSDB/gDb/UpciXgb905O1bHYiuYw4FIALdDVou3+6Jw2goUv8sQ RkTPeYrShDGhMUJkYauF9w/IrvL0m/cwBAg75VVlSad1jEqVWmPQCOmA0IkBOw4DcIa3 hbyUgt6iZycjF2025kg+k5zAkUkcBatxeugYk+SpsWgwm5fxIRQARgBiaSe5DVIBPRaa vsMEpc3ULfbiUF3qk8Qg2TE2c7hvphW1Hxw4NzzJVEv0Gq3vxQ9tHR9CGTEvCa+ul5tA fQCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x9si2531656plv.182.2019.06.26.00.43.11; Wed, 26 Jun 2019 00:43:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726946AbfFZHm0 (ORCPT + 99 others); Wed, 26 Jun 2019 03:42:26 -0400 Received: from inva020.nxp.com ([92.121.34.13]:38676 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726823AbfFZHmY (ORCPT ); Wed, 26 Jun 2019 03:42:24 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 2A5131A099E; Wed, 26 Jun 2019 09:42:23 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id D78F81A0997; Wed, 26 Jun 2019 09:42:17 +0200 (CEST) Received: from mega.ap.freescale.net (mega.ap.freescale.net [10.192.208.232]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 21A93402FB; Wed, 26 Jun 2019 15:42:11 +0800 (SGT) From: Anson.Huang@nxp.com To: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, leonard.crestez@nxp.com, abel.vesa@nxp.com, viresh.kumar@linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Linux-imx@nxp.com Subject: [PATCH 2/2] soc: imx8: Add i.MX8MM UID(unique identifier) support Date: Wed, 26 Jun 2019 15:44:15 +0800 Message-Id: <20190626074415.18224-2-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190626074415.18224-1-Anson.Huang@nxp.com> References: <20190626074415.18224-1-Anson.Huang@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anson Huang Add i.MX8MM SoC UID(unique identifier) support, user can read it from sysfs: root@imx8mmevk:~# cat /sys/devices/soc0/soc_uid B365FA0A5C85D6EE Signed-off-by: Anson Huang --- drivers/soc/imx/soc-imx8.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/soc/imx/soc-imx8.c b/drivers/soc/imx/soc-imx8.c index c19ef4b..b9831576 100644 --- a/drivers/soc/imx/soc-imx8.c +++ b/drivers/soc/imx/soc-imx8.c @@ -66,6 +66,26 @@ static u32 __init imx8mq_soc_revision(void) return rev; } +static void __init imx8mm_soc_uid(void) +{ + void __iomem *ocotp_base; + struct device_node *np; + + np = of_find_compatible_node(NULL, NULL, "fsl,imx8mm-ocotp"); + if (!np) + return; + + ocotp_base = of_iomap(np, 0); + WARN_ON(!ocotp_base); + + soc_uid = readl_relaxed(ocotp_base + OCOTP_UID_HIGH); + soc_uid <<= 32; + soc_uid |= readl_relaxed(ocotp_base + OCOTP_UID_LOW); + + iounmap(ocotp_base); + of_node_put(np); +} + static u32 __init imx8mm_soc_revision(void) { struct device_node *np; @@ -83,6 +103,9 @@ static u32 __init imx8mm_soc_revision(void) iounmap(anatop_base); of_node_put(np); + + imx8mm_soc_uid(); + return rev; } -- 2.7.4