All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Add i.MX51/i.MX53 serial number support
@ 2021-01-27 17:40 ` Sebastian Reichel
  0 siblings, 0 replies; 8+ messages in thread
From: Sebastian Reichel @ 2021-01-27 17:40 UTC (permalink / raw)
  To: Shawn Guo, Sascha Hauer
  Cc: Rob Herring, Fabio Estevam, Pengutronix Kernel Team,
	NXP Linux Team, linux-arm-kernel, devicetree, linux-kernel,
	Sebastian Reichel, kernel

Hi,

This complements support for reading the unique ID / serial
number on i.MX by adding the feature for i.MX51 and i.MX53.
This has been tested on i.MX53. I also added support for
i.MX51 since it uses exactly the same registers according
to its datasheet.

I did not add support for older i.MX processor. They also have
an IIM IP-core, but their datasheet does not contain information
about the unique ID registers and I do not have the hardware for
testing.

-- Sebastian

Sebastian Reichel (2):
  ARM: dts: imx: Mark IIM as syscon on i.MX51/i.MX53
  soc: imx: add i.MX51/i.MX53 unique id support

 arch/arm/boot/dts/imx51.dtsi |  2 +-
 arch/arm/boot/dts/imx53.dtsi |  2 +-
 drivers/soc/imx/soc-imx.c    | 12 ++++++++++++
 3 files changed, 14 insertions(+), 2 deletions(-)

-- 
2.29.2


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

* [PATCH 0/2] Add i.MX51/i.MX53 serial number support
@ 2021-01-27 17:40 ` Sebastian Reichel
  0 siblings, 0 replies; 8+ messages in thread
From: Sebastian Reichel @ 2021-01-27 17:40 UTC (permalink / raw)
  To: Shawn Guo, Sascha Hauer
  Cc: devicetree, linux-kernel, Sebastian Reichel, Rob Herring,
	NXP Linux Team, Pengutronix Kernel Team, kernel, Fabio Estevam,
	linux-arm-kernel

Hi,

This complements support for reading the unique ID / serial
number on i.MX by adding the feature for i.MX51 and i.MX53.
This has been tested on i.MX53. I also added support for
i.MX51 since it uses exactly the same registers according
to its datasheet.

I did not add support for older i.MX processor. They also have
an IIM IP-core, but their datasheet does not contain information
about the unique ID registers and I do not have the hardware for
testing.

-- Sebastian

Sebastian Reichel (2):
  ARM: dts: imx: Mark IIM as syscon on i.MX51/i.MX53
  soc: imx: add i.MX51/i.MX53 unique id support

 arch/arm/boot/dts/imx51.dtsi |  2 +-
 arch/arm/boot/dts/imx53.dtsi |  2 +-
 drivers/soc/imx/soc-imx.c    | 12 ++++++++++++
 3 files changed, 14 insertions(+), 2 deletions(-)

-- 
2.29.2


_______________________________________________
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] 8+ messages in thread

* [PATCH 1/2] ARM: dts: imx: Mark IIM as syscon on i.MX51/i.MX53
  2021-01-27 17:40 ` Sebastian Reichel
@ 2021-01-27 17:40   ` Sebastian Reichel
  -1 siblings, 0 replies; 8+ messages in thread
From: Sebastian Reichel @ 2021-01-27 17:40 UTC (permalink / raw)
  To: Shawn Guo, Sascha Hauer
  Cc: Rob Herring, Fabio Estevam, Pengutronix Kernel Team,
	NXP Linux Team, linux-arm-kernel, devicetree, linux-kernel,
	Sebastian Reichel, kernel

IIM contains system fuses with information like SoC unique ID
(serial) on i.MX51 and i.MX53. Add "syscon" compatible allowing
simple access.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 arch/arm/boot/dts/imx51.dtsi | 2 +-
 arch/arm/boot/dts/imx53.dtsi | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
index 7ebb46ce9e36..01cfcbe5928e 100644
--- a/arch/arm/boot/dts/imx51.dtsi
+++ b/arch/arm/boot/dts/imx51.dtsi
@@ -467,7 +467,7 @@ aipstz2: bridge@83f00000 {
 			};
 
 			iim: efuse@83f98000 {
-				compatible = "fsl,imx51-iim", "fsl,imx27-iim";
+				compatible = "fsl,imx51-iim", "fsl,imx27-iim", "syscon";
 				reg = <0x83f98000 0x4000>;
 				interrupts = <69>;
 				clocks = <&clks IMX5_CLK_IIM_GATE>;
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
index 000050aeeabe..2cf3909cca2f 100644
--- a/arch/arm/boot/dts/imx53.dtsi
+++ b/arch/arm/boot/dts/imx53.dtsi
@@ -668,7 +668,7 @@ aipstz2: bridge@63f00000 {
 			};
 
 			iim: efuse@63f98000 {
-				compatible = "fsl,imx53-iim", "fsl,imx27-iim";
+				compatible = "fsl,imx53-iim", "fsl,imx27-iim", "syscon";
 				reg = <0x63f98000 0x4000>;
 				interrupts = <69>;
 				clocks = <&clks IMX5_CLK_IIM_GATE>;
-- 
2.29.2


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

* [PATCH 1/2] ARM: dts: imx: Mark IIM as syscon on i.MX51/i.MX53
@ 2021-01-27 17:40   ` Sebastian Reichel
  0 siblings, 0 replies; 8+ messages in thread
From: Sebastian Reichel @ 2021-01-27 17:40 UTC (permalink / raw)
  To: Shawn Guo, Sascha Hauer
  Cc: devicetree, linux-kernel, Sebastian Reichel, Rob Herring,
	NXP Linux Team, Pengutronix Kernel Team, kernel, Fabio Estevam,
	linux-arm-kernel

IIM contains system fuses with information like SoC unique ID
(serial) on i.MX51 and i.MX53. Add "syscon" compatible allowing
simple access.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 arch/arm/boot/dts/imx51.dtsi | 2 +-
 arch/arm/boot/dts/imx53.dtsi | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/imx51.dtsi b/arch/arm/boot/dts/imx51.dtsi
index 7ebb46ce9e36..01cfcbe5928e 100644
--- a/arch/arm/boot/dts/imx51.dtsi
+++ b/arch/arm/boot/dts/imx51.dtsi
@@ -467,7 +467,7 @@ aipstz2: bridge@83f00000 {
 			};
 
 			iim: efuse@83f98000 {
-				compatible = "fsl,imx51-iim", "fsl,imx27-iim";
+				compatible = "fsl,imx51-iim", "fsl,imx27-iim", "syscon";
 				reg = <0x83f98000 0x4000>;
 				interrupts = <69>;
 				clocks = <&clks IMX5_CLK_IIM_GATE>;
diff --git a/arch/arm/boot/dts/imx53.dtsi b/arch/arm/boot/dts/imx53.dtsi
index 000050aeeabe..2cf3909cca2f 100644
--- a/arch/arm/boot/dts/imx53.dtsi
+++ b/arch/arm/boot/dts/imx53.dtsi
@@ -668,7 +668,7 @@ aipstz2: bridge@63f00000 {
 			};
 
 			iim: efuse@63f98000 {
-				compatible = "fsl,imx53-iim", "fsl,imx27-iim";
+				compatible = "fsl,imx53-iim", "fsl,imx27-iim", "syscon";
 				reg = <0x63f98000 0x4000>;
 				interrupts = <69>;
 				clocks = <&clks IMX5_CLK_IIM_GATE>;
-- 
2.29.2


_______________________________________________
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] 8+ messages in thread

* [PATCH 2/2] soc: imx: add i.MX51/i.MX53 unique id support
  2021-01-27 17:40 ` Sebastian Reichel
@ 2021-01-27 17:40   ` Sebastian Reichel
  -1 siblings, 0 replies; 8+ messages in thread
From: Sebastian Reichel @ 2021-01-27 17:40 UTC (permalink / raw)
  To: Shawn Guo, Sascha Hauer
  Cc: Rob Herring, Fabio Estevam, Pengutronix Kernel Team,
	NXP Linux Team, linux-arm-kernel, devicetree, linux-kernel,
	Sebastian Reichel, kernel

i.MX51 and i.MX53 SoCs have a 64-bit SoC unique ID stored in IIM,
which can be used as SoC serial number. The same feature is already
implemented for i.MX6/i.MX7, so this complements support to earlier
SoCs.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 drivers/soc/imx/soc-imx.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/soc/imx/soc-imx.c b/drivers/soc/imx/soc-imx.c
index 01bfea1cb64a..0738c0f36792 100644
--- a/drivers/soc/imx/soc-imx.c
+++ b/drivers/soc/imx/soc-imx.c
@@ -13,6 +13,8 @@
 #include <soc/imx/cpu.h>
 #include <soc/imx/revision.h>
 
+#define IIM_UID		0x820
+
 #define OCOTP_UID_H	0x420
 #define OCOTP_UID_L	0x410
 
@@ -32,6 +34,7 @@ static int __init imx_soc_device_init(void)
 	u64 soc_uid = 0;
 	u32 val;
 	int ret;
+	int i;
 
 	if (of_machine_is_compatible("fsl,ls1021a"))
 		return 0;
@@ -68,9 +71,11 @@ static int __init imx_soc_device_init(void)
 		soc_id = "i.MX35";
 		break;
 	case MXC_CPU_MX51:
+		ocotp_compat = "fsl,imx51-iim";
 		soc_id = "i.MX51";
 		break;
 	case MXC_CPU_MX53:
+		ocotp_compat = "fsl,imx53-iim";
 		soc_id = "i.MX53";
 		break;
 	case MXC_CPU_IMX6SL:
@@ -153,6 +158,13 @@ static int __init imx_soc_device_init(void)
 			regmap_read(ocotp, OCOTP_ULP_UID_1, &val);
 			soc_uid <<= 16;
 			soc_uid |= val & 0xffff;
+		} else if (__mxc_cpu_type == MXC_CPU_MX51 ||
+			   __mxc_cpu_type == MXC_CPU_MX53) {
+			for (i=0; i < 8; i++) {
+				regmap_read(ocotp, IIM_UID + i*4, &val);
+				soc_uid <<= 8;
+				soc_uid |= (val & 0xff);
+			}
 		} else {
 			regmap_read(ocotp, OCOTP_UID_H, &val);
 			soc_uid = val;
-- 
2.29.2


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

* [PATCH 2/2] soc: imx: add i.MX51/i.MX53 unique id support
@ 2021-01-27 17:40   ` Sebastian Reichel
  0 siblings, 0 replies; 8+ messages in thread
From: Sebastian Reichel @ 2021-01-27 17:40 UTC (permalink / raw)
  To: Shawn Guo, Sascha Hauer
  Cc: devicetree, linux-kernel, Sebastian Reichel, Rob Herring,
	NXP Linux Team, Pengutronix Kernel Team, kernel, Fabio Estevam,
	linux-arm-kernel

i.MX51 and i.MX53 SoCs have a 64-bit SoC unique ID stored in IIM,
which can be used as SoC serial number. The same feature is already
implemented for i.MX6/i.MX7, so this complements support to earlier
SoCs.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 drivers/soc/imx/soc-imx.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/soc/imx/soc-imx.c b/drivers/soc/imx/soc-imx.c
index 01bfea1cb64a..0738c0f36792 100644
--- a/drivers/soc/imx/soc-imx.c
+++ b/drivers/soc/imx/soc-imx.c
@@ -13,6 +13,8 @@
 #include <soc/imx/cpu.h>
 #include <soc/imx/revision.h>
 
+#define IIM_UID		0x820
+
 #define OCOTP_UID_H	0x420
 #define OCOTP_UID_L	0x410
 
@@ -32,6 +34,7 @@ static int __init imx_soc_device_init(void)
 	u64 soc_uid = 0;
 	u32 val;
 	int ret;
+	int i;
 
 	if (of_machine_is_compatible("fsl,ls1021a"))
 		return 0;
@@ -68,9 +71,11 @@ static int __init imx_soc_device_init(void)
 		soc_id = "i.MX35";
 		break;
 	case MXC_CPU_MX51:
+		ocotp_compat = "fsl,imx51-iim";
 		soc_id = "i.MX51";
 		break;
 	case MXC_CPU_MX53:
+		ocotp_compat = "fsl,imx53-iim";
 		soc_id = "i.MX53";
 		break;
 	case MXC_CPU_IMX6SL:
@@ -153,6 +158,13 @@ static int __init imx_soc_device_init(void)
 			regmap_read(ocotp, OCOTP_ULP_UID_1, &val);
 			soc_uid <<= 16;
 			soc_uid |= val & 0xffff;
+		} else if (__mxc_cpu_type == MXC_CPU_MX51 ||
+			   __mxc_cpu_type == MXC_CPU_MX53) {
+			for (i=0; i < 8; i++) {
+				regmap_read(ocotp, IIM_UID + i*4, &val);
+				soc_uid <<= 8;
+				soc_uid |= (val & 0xff);
+			}
 		} else {
 			regmap_read(ocotp, OCOTP_UID_H, &val);
 			soc_uid = val;
-- 
2.29.2


_______________________________________________
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] 8+ messages in thread

* Re: [PATCH 0/2] Add i.MX51/i.MX53 serial number support
  2021-01-27 17:40 ` Sebastian Reichel
@ 2021-03-03  9:57   ` Shawn Guo
  -1 siblings, 0 replies; 8+ messages in thread
From: Shawn Guo @ 2021-03-03  9:57 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Sascha Hauer, Rob Herring, Fabio Estevam,
	Pengutronix Kernel Team, NXP Linux Team, linux-arm-kernel,
	devicetree, linux-kernel, kernel

On Wed, Jan 27, 2021 at 06:40:22PM +0100, Sebastian Reichel wrote:
> Sebastian Reichel (2):
>   ARM: dts: imx: Mark IIM as syscon on i.MX51/i.MX53
>   soc: imx: add i.MX51/i.MX53 unique id support

Applied both, thanks.

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

* Re: [PATCH 0/2] Add i.MX51/i.MX53 serial number support
@ 2021-03-03  9:57   ` Shawn Guo
  0 siblings, 0 replies; 8+ messages in thread
From: Shawn Guo @ 2021-03-03  9:57 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Sascha Hauer, Rob Herring, Fabio Estevam,
	Pengutronix Kernel Team, NXP Linux Team, linux-arm-kernel,
	devicetree, linux-kernel, kernel

On Wed, Jan 27, 2021 at 06:40:22PM +0100, Sebastian Reichel wrote:
> Sebastian Reichel (2):
>   ARM: dts: imx: Mark IIM as syscon on i.MX51/i.MX53
>   soc: imx: add i.MX51/i.MX53 unique id support

Applied both, 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] 8+ messages in thread

end of thread, other threads:[~2021-03-03 17:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-27 17:40 [PATCH 0/2] Add i.MX51/i.MX53 serial number support Sebastian Reichel
2021-01-27 17:40 ` Sebastian Reichel
2021-01-27 17:40 ` [PATCH 1/2] ARM: dts: imx: Mark IIM as syscon on i.MX51/i.MX53 Sebastian Reichel
2021-01-27 17:40   ` Sebastian Reichel
2021-01-27 17:40 ` [PATCH 2/2] soc: imx: add i.MX51/i.MX53 unique id support Sebastian Reichel
2021-01-27 17:40   ` Sebastian Reichel
2021-03-03  9:57 ` [PATCH 0/2] Add i.MX51/i.MX53 serial number support Shawn Guo
2021-03-03  9:57   ` 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.