* [PATCH] ARM: imx: Add i.MX7ULP SoC serial number support
@ 2019-11-04 7:35 ` Anson Huang
0 siblings, 0 replies; 4+ messages in thread
From: Anson Huang @ 2019-11-04 7:35 UTC (permalink / raw)
To: linux, shawnguo, s.hauer, kernel, festevam, aisheng.dong,
linux-arm-kernel, linux-kernel
Cc: Linux-imx
i.MX7ULP's unique ID layout in OCOTP is different from other
i.MX6/7 SoCs as below:
OCOTP layout unique ID
0x4b0 bit[15:0] bit[15:0]
0x4c0 bit[15:0] bit[31:16]
0x4d0 bit[15:0] bit[47:32]
0x4e0 bit[15:0] bit[63:48]
Add support for reading serial number from OCOTP on i.MX7ULP.
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
arch/arm/mach-imx/cpu.c | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
index d811803..d70b6fc 100644
--- a/arch/arm/mach-imx/cpu.c
+++ b/arch/arm/mach-imx/cpu.c
@@ -15,6 +15,11 @@
#define OCOTP_UID_H 0x420
#define OCOTP_UID_L 0x410
+#define OCOTP_ULP_UID_1 0x4b0
+#define OCOTP_ULP_UID_2 0x4c0
+#define OCOTP_ULP_UID_3 0x4d0
+#define OCOTP_ULP_UID_4 0x4e0
+
unsigned int __mxc_cpu_type;
static unsigned int imx_soc_revision;
@@ -164,6 +169,7 @@ struct device * __init imx_soc_device_init(void)
soc_id = "i.MX7D";
break;
case MXC_CPU_IMX7ULP:
+ ocotp_compat = "fsl,imx7ulp-ocotp";
soc_id = "i.MX7ULP";
break;
default:
@@ -176,11 +182,25 @@ struct device * __init imx_soc_device_init(void)
if (IS_ERR(ocotp))
pr_err("%s: failed to find %s regmap!\n", __func__, ocotp_compat);
- regmap_read(ocotp, OCOTP_UID_H, &val);
- soc_uid = val;
- regmap_read(ocotp, OCOTP_UID_L, &val);
- soc_uid <<= 32;
- soc_uid |= val;
+ if (__mxc_cpu_type == MXC_CPU_IMX7ULP) {
+ regmap_read(ocotp, OCOTP_ULP_UID_4, &val);
+ soc_uid = val & 0xffff;
+ regmap_read(ocotp, OCOTP_ULP_UID_3, &val);
+ soc_uid <<= 16;
+ soc_uid |= val & 0xffff;
+ regmap_read(ocotp, OCOTP_ULP_UID_2, &val);
+ soc_uid <<= 16;
+ soc_uid |= val & 0xffff;
+ regmap_read(ocotp, OCOTP_ULP_UID_1, &val);
+ soc_uid <<= 16;
+ soc_uid |= val & 0xffff;
+ } else {
+ regmap_read(ocotp, OCOTP_UID_H, &val);
+ soc_uid = val;
+ regmap_read(ocotp, OCOTP_UID_L, &val);
+ soc_uid <<= 32;
+ soc_uid |= val;
+ }
}
soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d.%d",
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] ARM: imx: Add i.MX7ULP SoC serial number support
@ 2019-11-04 7:35 ` Anson Huang
0 siblings, 0 replies; 4+ messages in thread
From: Anson Huang @ 2019-11-04 7:35 UTC (permalink / raw)
To: linux, shawnguo, s.hauer, kernel, festevam, aisheng.dong,
linux-arm-kernel, linux-kernel
Cc: Linux-imx
i.MX7ULP's unique ID layout in OCOTP is different from other
i.MX6/7 SoCs as below:
OCOTP layout unique ID
0x4b0 bit[15:0] bit[15:0]
0x4c0 bit[15:0] bit[31:16]
0x4d0 bit[15:0] bit[47:32]
0x4e0 bit[15:0] bit[63:48]
Add support for reading serial number from OCOTP on i.MX7ULP.
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
arch/arm/mach-imx/cpu.c | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
index d811803..d70b6fc 100644
--- a/arch/arm/mach-imx/cpu.c
+++ b/arch/arm/mach-imx/cpu.c
@@ -15,6 +15,11 @@
#define OCOTP_UID_H 0x420
#define OCOTP_UID_L 0x410
+#define OCOTP_ULP_UID_1 0x4b0
+#define OCOTP_ULP_UID_2 0x4c0
+#define OCOTP_ULP_UID_3 0x4d0
+#define OCOTP_ULP_UID_4 0x4e0
+
unsigned int __mxc_cpu_type;
static unsigned int imx_soc_revision;
@@ -164,6 +169,7 @@ struct device * __init imx_soc_device_init(void)
soc_id = "i.MX7D";
break;
case MXC_CPU_IMX7ULP:
+ ocotp_compat = "fsl,imx7ulp-ocotp";
soc_id = "i.MX7ULP";
break;
default:
@@ -176,11 +182,25 @@ struct device * __init imx_soc_device_init(void)
if (IS_ERR(ocotp))
pr_err("%s: failed to find %s regmap!\n", __func__, ocotp_compat);
- regmap_read(ocotp, OCOTP_UID_H, &val);
- soc_uid = val;
- regmap_read(ocotp, OCOTP_UID_L, &val);
- soc_uid <<= 32;
- soc_uid |= val;
+ if (__mxc_cpu_type == MXC_CPU_IMX7ULP) {
+ regmap_read(ocotp, OCOTP_ULP_UID_4, &val);
+ soc_uid = val & 0xffff;
+ regmap_read(ocotp, OCOTP_ULP_UID_3, &val);
+ soc_uid <<= 16;
+ soc_uid |= val & 0xffff;
+ regmap_read(ocotp, OCOTP_ULP_UID_2, &val);
+ soc_uid <<= 16;
+ soc_uid |= val & 0xffff;
+ regmap_read(ocotp, OCOTP_ULP_UID_1, &val);
+ soc_uid <<= 16;
+ soc_uid |= val & 0xffff;
+ } else {
+ regmap_read(ocotp, OCOTP_UID_H, &val);
+ soc_uid = val;
+ regmap_read(ocotp, OCOTP_UID_L, &val);
+ soc_uid <<= 32;
+ soc_uid |= val;
+ }
}
soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d.%d",
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ARM: imx: Add i.MX7ULP SoC serial number support
2019-11-04 7:35 ` Anson Huang
@ 2019-12-02 8:42 ` Shawn Guo
-1 siblings, 0 replies; 4+ messages in thread
From: Shawn Guo @ 2019-12-02 8:42 UTC (permalink / raw)
To: Anson Huang
Cc: linux, s.hauer, kernel, festevam, aisheng.dong, linux-arm-kernel,
linux-kernel, Linux-imx
On Mon, Nov 04, 2019 at 03:35:31PM +0800, Anson Huang wrote:
> i.MX7ULP's unique ID layout in OCOTP is different from other
> i.MX6/7 SoCs as below:
>
> OCOTP layout unique ID
>
> 0x4b0 bit[15:0] bit[15:0]
> 0x4c0 bit[15:0] bit[31:16]
> 0x4d0 bit[15:0] bit[47:32]
> 0x4e0 bit[15:0] bit[63:48]
>
> Add support for reading serial number from OCOTP on i.MX7ULP.
>
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ARM: imx: Add i.MX7ULP SoC serial number support
@ 2019-12-02 8:42 ` Shawn Guo
0 siblings, 0 replies; 4+ messages in thread
From: Shawn Guo @ 2019-12-02 8:42 UTC (permalink / raw)
To: Anson Huang
Cc: aisheng.dong, s.hauer, linux, linux-kernel, Linux-imx, kernel,
festevam, linux-arm-kernel
On Mon, Nov 04, 2019 at 03:35:31PM +0800, Anson Huang wrote:
> i.MX7ULP's unique ID layout in OCOTP is different from other
> i.MX6/7 SoCs as below:
>
> OCOTP layout unique ID
>
> 0x4b0 bit[15:0] bit[15:0]
> 0x4c0 bit[15:0] bit[31:16]
> 0x4d0 bit[15:0] bit[47:32]
> 0x4e0 bit[15:0] bit[63:48]
>
> Add support for reading serial number from OCOTP on i.MX7ULP.
>
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Applied, thanks.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-12-02 8:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-04 7:35 [PATCH] ARM: imx: Add i.MX7ULP SoC serial number support Anson Huang
2019-11-04 7:35 ` Anson Huang
2019-12-02 8:42 ` Shawn Guo
2019-12-02 8:42 ` Shawn Guo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.