mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH V4 1/2] soc: imx: Correct i.MX8MP soc device
@ 2023-05-29  3:37 Peng Fan (OSS)
  2023-05-29  3:37 ` [PATCH V4 2/2] soc: imx: support i.MX93 " Peng Fan (OSS)
  2023-05-30  8:06 ` [PATCH V4 1/2] soc: imx: Correct i.MX8MP " Rasmus Villemoes
  0 siblings, 2 replies; 4+ messages in thread
From: Peng Fan (OSS) @ 2023-05-29  3:37 UTC (permalink / raw)
  To: shawnguo, s.hauer
  Cc: kernel, festevam, linux-imx, linux-kernel, linux-arm-kernel,
	Peng Fan, Rasmus Villemoes

From: Peng Fan <peng.fan@nxp.com>

i.MX8MP UID is actually 128bits and partitioned into two parts, with 1st
64bits at 0x410 and 0x420, with 2nd 64bits at 0xE00 and 0xE10.

So introduce soc_uid_h for the higher 64bits

Fixes: 18f662a73862 ("soc: imx: Add i.MX8MP SoC driver support")
Reported-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Closes: https://lore.kernel.org/all/fe5e2b36-6a8e-656c-a4a6-13a47f4871af@prevas.dk/
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---

V4:
 New patch

 drivers/soc/imx/soc-imx8m.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/imx/soc-imx8m.c b/drivers/soc/imx/soc-imx8m.c
index 1dcd243df567..be26bbdac9fa 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
 
 /* 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)
@@ -114,6 +116,12 @@ 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);
+	}
+
 	iounmap(ocotp_base);
 	of_node_put(np);
 }
@@ -212,7 +220,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);
+
 	if (!soc_dev_attr->serial_number) {
 		ret = -ENOMEM;
 		goto free_rev;
-- 
2.37.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-30  9:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-29  3:37 [PATCH V4 1/2] soc: imx: Correct i.MX8MP soc device Peng Fan (OSS)
2023-05-29  3:37 ` [PATCH V4 2/2] soc: imx: support i.MX93 " Peng Fan (OSS)
2023-05-30  8:06 ` [PATCH V4 1/2] soc: imx: Correct i.MX8MP " Rasmus Villemoes
2023-05-30  9:05   ` Peng Fan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®