summaryrefslogtreecommitdiff
path: root/drivers/soc/imx
diff options
context:
space:
mode:
authorAnson Huang <Anson.Huang@nxp.com>2019-06-26 15:44:15 +0800
committerShawn Guo <shawnguo@kernel.org>2019-07-22 09:36:48 +0800
commit8dfe397431e0e05d9e66a9f20511833bda91f978 (patch)
treebcc001063abbd1f798ec339dbba2c77c21fada2a /drivers/soc/imx
parent3026d0b7a4972fd5fb56f5a454d1efe7534e84fc (diff)
soc: imx8: Add i.MX8MM UID(unique identifier) support
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 <Anson.Huang@nxp.com> Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Diffstat (limited to 'drivers/soc/imx')
-rw-r--r--drivers/soc/imx/soc-imx8.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/soc/imx/soc-imx8.c b/drivers/soc/imx/soc-imx8.c
index c19ef4b95668..b9831576dd25 100644
--- a/drivers/soc/imx/soc-imx8.c
+++ b/drivers/soc/imx/soc-imx8.c
@@ -66,6 +66,26 @@ out:
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;
}