Skip to contentSkip to conversation

ARM: dts: imx53: Add 'ARM platform' node

PATCH New Fabio Estevam 3 participants 10 messages Jun 18, 2018 – Jul 10, 2018

Subsystems (4)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/3 ARM: dts: imx53: Add 'ARM platform' node

From: Fabio Estevam <[email protected]>

As per the i.MX53 Reference Manual add an entry for the 'ARM platform' region in the device tree.

This is needed for accessing the ARM_GPC register to set the DBGEN bit, so that the debug clocks can be turned on.

---
 arch/arm/boot/dts/imx53.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/imx53.dtsi +5 -0
index 1a7a7bb..a70fbf4 100644
@@ -672,6 +672,11 @@
 				status = "disabled";
 			};
 
+			arm_platform: arm-platform at 63fa0000 {
+				compatible = "fsl,imx53-arm-plat", "fsl,imx51-arm-plat";
+				reg = <0x63fa0000 0x28>;
+			};
+
 			owire: owire at 63fa4000 {
 				compatible = "fsl,imx53-owire", "fsl,imx21-owire";
 				reg = <0x63fa4000 0x4000>;
Signature · 1 line
2.7.4
author reviewer
#1 lore raw

PATCH 2/3 ARM: dts: imx53: Add a label for the PMU node

From: Fabio Estevam <[email protected]>

Add a label for the PMU node so that the board dts may be able to pass the 'secure-reg-access' property like this:

&pmu {
	secure-reg-access;
};

This also makes it consistent with the PMU node in imx6qdl.dtsi

---
 arch/arm/boot/dts/imx53.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx53.dtsi +1 -1
index a70fbf4..263bd39f 100644
@@ -113,7 +113,7 @@
 		};
 	};
 
-	pmu {
+	pmu: pmu {
 		compatible = "arm,cortex-a8-pmu";
 		interrupt-parent = <&tzic>;
 		interrupts = <77>;
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/3 ARM: dts: imx53: Add a label for the PMU node

Hi,

Quoted 5 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Add a label for the PMU node so that the board dts may be able to pass the 'secure-reg-access' property like this:

Quoted 8 lines
&pmu {
	secure-reg-access;
};

This also makes it consistent with the PMU node in imx6qdl.dtsi

---

-- Sebastian

Quoted 19 lines
 arch/arm/boot/dts/imx53.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx53.dtsi +1 -1
index a70fbf4..263bd39f 100644
@@ -113,7 +113,7 @@
 		};
 	};
 
-	pmu {
+	pmu: pmu {
 		compatible = "arm,cortex-a8-pmu";
 		interrupt-parent = <&tzic>;
 		interrupts = <77>;
Signature · 1 line
2.7.4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180619/46dda09f/attachment.sig>

author reviewer
#3 lore raw

PATCH 3/3 ARM: mx5: Set the DBGEN bit in ARM_GPC register

In reply to Fabio Estevam

From: Fabio Estevam <[email protected]>

On i.MX51/i.MX53 it is necessery to set the DBGEN bit in ARM_GPC register in order to turn on the debug clocks.

The DBGEN bit of ARM_GPC register has the following description in the i.MX53 Reference Manual:

"This allows the user to manually activate clocks within the debug system. This register bit directly controls the platform's dbgen_out output signal which connects to the DAP_SYS to enable all debug clocks. Once enabled, the clocks cannot be disabled except by asserting the disable_trace input of the DAP_SYS."

Based on a previous patch from Sebastian Reichel.

---
 arch/arm/mach-imx/common.h     |  1 +
 arch/arm/mach-imx/cpu-imx5.c   | 38 ++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-imx/mach-imx53.c |  2 ++
 3 files changed, 41 insertions(+)
arch/arm/mach-imx/common.h +1 -0
index c8d68e9..db78329 100644
@@ -62,6 +62,7 @@ void imx_gpc_set_arm_power_up_timing(u32 sw2iso, u32 sw);
 void imx_gpc_set_arm_power_down_timing(u32 sw2iso, u32 sw);
 void imx25_pm_init(void);
 void imx27_pm_init(void);
+void imx5_pmu_init(void);
 
 enum mxc_cpu_pwr_mode {
 	WAIT_CLOCKED,		/* wfi only */
arch/arm/mach-imx/cpu-imx5.c +38 -0
index 4f2d1c7..6c5a055 100644
@@ -117,3 +117,41 @@ int mx53_revision(void)
 	return mx5_cpu_rev;
 }
 EXPORT_SYMBOL(mx53_revision);
+
+#define ARM_GPC		0x4
+#define DBGEN		BIT(16)
+
+/*
+ * This enables the DBGEN bit in ARM_GPC register, which is
+ * required for accessing some performance counter features.
+ * Technically it is only required while perf is used, but to
+ * keep the source code simple we just enable it all the time
+ * when the kernel configuration allows using the feature.
+ */
+void imx5_pmu_init(void)
+{
+	void __iomem *arm_plat_base;
+	struct device_node *np;
+	u32 gpc;
+
+	if (!IS_ENABLED(CONFIG_ARM_PMU))
+		return;
+
+	np = of_find_compatible_node(NULL, NULL, "arm,cortex-a8-pmu");
+	if (!np)
+		return;
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,imx51-arm-plat");
+	if (!np)
+		return;
+
+	arm_plat_base = of_iomap(np, 0);
+	if (!arm_plat_base) {
+		pr_warn("Unable to map ARM platform registers\n");
+		return;
+	}
+
+	gpc = readl_relaxed(arm_plat_base + ARM_GPC);
+	gpc |= DBGEN;
+	writel_relaxed(gpc, arm_plat_base + ARM_GPC);
+}
arch/arm/mach-imx/mach-imx53.c +2 -0
index 07c2e8d..15fba89 100644
@@ -32,6 +32,8 @@ static void __init imx53_dt_init(void)
 {
 	imx_src_init();
 
+	imx5_pmu_init();
+
 	imx_aips_allow_unprivileged_access("fsl,imx53-aipstz");
 }
 
Signature · 1 line
2.7.4
#4 lore raw

PATCH 3/3 ARM: mx5: Set the DBGEN bit in ARM_GPC register

Hi,

Quoted 14 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

On i.MX51/i.MX53 it is necessery to set the DBGEN bit in ARM_GPC register in order to turn on the debug clocks.

The DBGEN bit of ARM_GPC register has the following description in the i.MX53 Reference Manual:

"This allows the user to manually activate clocks within the debug system. This register bit directly controls the platform's dbgen_out output signal which connects to the DAP_SYS to enable all debug clocks. Once enabled, the clocks cannot be disabled except by asserting the disable_trace input of the DAP_SYS."

Quoted 4 lines

Based on a previous patch from Sebastian Reichel.

---

-- Sebastian

Quoted 79 lines
 arch/arm/mach-imx/common.h     |  1 +
 arch/arm/mach-imx/cpu-imx5.c   | 38 ++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-imx/mach-imx53.c |  2 ++
 3 files changed, 41 insertions(+)
arch/arm/mach-imx/common.h +1 -0
index c8d68e9..db78329 100644
@@ -62,6 +62,7 @@ void imx_gpc_set_arm_power_up_timing(u32 sw2iso, u32 sw);
 void imx_gpc_set_arm_power_down_timing(u32 sw2iso, u32 sw);
 void imx25_pm_init(void);
 void imx27_pm_init(void);
+void imx5_pmu_init(void);
 
 enum mxc_cpu_pwr_mode {
 	WAIT_CLOCKED,		/* wfi only */
arch/arm/mach-imx/cpu-imx5.c +38 -0
index 4f2d1c7..6c5a055 100644
@@ -117,3 +117,41 @@ int mx53_revision(void)
 	return mx5_cpu_rev;
 }
 EXPORT_SYMBOL(mx53_revision);
+
+#define ARM_GPC		0x4
+#define DBGEN		BIT(16)
+
+/*
+ * This enables the DBGEN bit in ARM_GPC register, which is
+ * required for accessing some performance counter features.
+ * Technically it is only required while perf is used, but to
+ * keep the source code simple we just enable it all the time
+ * when the kernel configuration allows using the feature.
+ */
+void imx5_pmu_init(void)
+{
+	void __iomem *arm_plat_base;
+	struct device_node *np;
+	u32 gpc;
+
+	if (!IS_ENABLED(CONFIG_ARM_PMU))
+		return;
+
+	np = of_find_compatible_node(NULL, NULL, "arm,cortex-a8-pmu");
+	if (!np)
+		return;
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,imx51-arm-plat");
+	if (!np)
+		return;
+
+	arm_plat_base = of_iomap(np, 0);
+	if (!arm_plat_base) {
+		pr_warn("Unable to map ARM platform registers\n");
+		return;
+	}
+
+	gpc = readl_relaxed(arm_plat_base + ARM_GPC);
+	gpc |= DBGEN;
+	writel_relaxed(gpc, arm_plat_base + ARM_GPC);
+}
arch/arm/mach-imx/mach-imx53.c +2 -0
index 07c2e8d..15fba89 100644
@@ -32,6 +32,8 @@ static void __init imx53_dt_init(void)
 {
 	imx_src_init();
 
+	imx5_pmu_init();
+
 	imx_aips_allow_unprivileged_access("fsl,imx53-aipstz");
 }
 
Signature · 1 line
2.7.4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180619/956e0d5d/attachment-0001.sig>

#5 lore raw

PATCH 1/3 ARM: dts: imx53: Add 'ARM platform' node

In reply to Fabio Estevam

Hi,

Quoted 9 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

As per the i.MX53 Reference Manual add an entry for the 'ARM platform' region in the device tree.

This is needed for accessing the ARM_GPC register to set the DBGEN bit, so that the debug clocks can be turned on.

-- Sebastian

Quoted 23 lines
---
 arch/arm/boot/dts/imx53.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/imx53.dtsi +5 -0
index 1a7a7bb..a70fbf4 100644
@@ -672,6 +672,11 @@
 				status = "disabled";
 			};
 
+			arm_platform: arm-platform at 63fa0000 {
+				compatible = "fsl,imx53-arm-plat", "fsl,imx51-arm-plat";
+				reg = <0x63fa0000 0x28>;
+			};
+
 			owire: owire at 63fa4000 {
 				compatible = "fsl,imx53-owire", "fsl,imx21-owire";
 				reg = <0x63fa4000 0x4000>;
Signature · 1 line
2.7.4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180619/35578c63/attachment.sig>

#6 lore raw

PATCH 1/3 ARM: dts: imx53: Add 'ARM platform' node

In reply to Fabio Estevam
Quoted 18 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

As per the i.MX53 Reference Manual add an entry for the 'ARM platform' region in the device tree.

This is needed for accessing the ARM_GPC register to set the DBGEN bit, so that the debug clocks can be turned on.

---
 arch/arm/boot/dts/imx53.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/boot/dts/imx53.dtsi +0 -0
index 1a7a7bb..a70fbf4 100644

arch/arm/boot/dts/imx53.dtsi line 676

Quoted 5 lines
arch/arm/boot/dts/imx53.dtsi +2 -0
@@ -672,6 +672,11 @@
 				status = "disabled";
 			};
 
+			arm_platform: arm-platform at 63fa0000 {
+				compatible = "fsl,imx53-arm-plat", "fsl,imx51-arm-plat";

Don't we need a bindings for that?

Shawn

Quoted 9 lines
arch/arm/boot/dts/imx53.dtsi +3 -0
+				reg = <0x63fa0000 0x28>;
+			};
+
 			owire: owire at 63fa4000 {
 				compatible = "fsl,imx53-owire", "fsl,imx21-owire";
 				reg = <0x63fa4000 0x4000>;
Signature · 1 line
2.7.4
author reviewer
#7 lore raw

PATCH 1/3 ARM: dts: imx53: Add 'ARM platform' node

Quoted 8 lines · Shawn Guo
Quoted 8 lines
arch/arm/boot/dts/imx53.dtsi +0 -0
index 1a7a7bb..a70fbf4 100644
@@ -672,6 +672,11 @@
                              status = "disabled";
                      };
 
Quoted 4 lines

arch/arm/boot/dts/imx53.dtsi line 676

Quoted 2 lines
arch/arm/boot/dts/imx53.dtsi +2 -0
+                     arm_platform: arm-platform at 63fa0000 {
+                             compatible = "fsl,imx53-arm-plat", "fsl,imx51-arm-plat";

Don't we need a bindings for that?

I thought this is the same case as "fsl,imx51-src" where we only use it inside arch/arm/mach-imx/ and there is also no bindings doc for it.

That's why I did not add an entry for the bindings doc.

If you think that a binding doc is needed, in which directory should it be placed?

#8 lore raw

PATCH 1/3 ARM: dts: imx53: Add 'ARM platform' node

Quoted 10 lines · Fabio Estevam
Quoted 8 lines · Shawn Guo
Quoted 8 lines
arch/arm/boot/dts/imx53.dtsi +0 -0
index 1a7a7bb..a70fbf4 100644
@@ -672,6 +672,11 @@
                              status = "disabled";
                      };
 
Quoted 7 lines
Quoted 4 lines

arch/arm/boot/dts/imx53.dtsi line 676

Quoted 2 lines
arch/arm/boot/dts/imx53.dtsi +2 -0
+                     arm_platform: arm-platform at 63fa0000 {
+                             compatible = "fsl,imx53-arm-plat", "fsl,imx51-arm-plat";

Don't we need a bindings for that?

I thought this is the same case as "fsl,imx51-src" where we only use it inside arch/arm/mach-imx/ and there is also no bindings doc for it.

Isn't 'ARM platform' something ARM core specific rather than i.MX?

Quoted 5 lines

That's why I did not add an entry for the bindings doc.

If you think that a binding doc is needed, in which directory should it be placed?

We can ask suggestion from DT folks.

Shawn

author reviewer
#9 lore raw

PATCH 1/3 ARM: dts: imx53: Add 'ARM platform' node

Hi Shawn,

Quoted 1 line · Shawn Guo

Isn't 'ARM platform' something ARM core specific rather than i.MX?

i.MX51 Reference Manual names this region as 'tigerp', so I sent a v2 referring to this term and also added dt-bindings.