Skip to contentSkip to conversation

arm: am437x: use TWD/Global timers

PATCH New Felipe Balbi 3 participants 9 messages Aug 12, 2015 – Aug 13, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover arm: am437x: use TWD/Global timers

Hi,

with these patches AM437x devices can use TWD/global timers.

At least TWD is now used as sched_clock() which gives better latency as seen below. Keep in mind that while I ran cyclictest to have a feel for avg latency this test was not against an RT kernel, so results should be taken with a grain of salt.

Also, I'm not 100% sure clock rate is correct. According to TRM, this timer should run as MPU_CLK/2 which would be 1GHz / 2 = 500MHz, but even though I'm using dpll_mpu_m2_ck clock, it still shows as 1000MHz.

Are there any other tests I could/should run ? BTW, I boot-tested on AM4372 with and without 'nosmp' on cmdline.

pre-patch:
T: 0 ( 245) P:95 I:1000 C: 9995 Min: 24 Act: 31 Avg: 36 Max: 596

post-patch:
T: 0 ( 253) P:95 I:1000 C: 9995 Min: 10 Act: 12 Avg: 14 Max: 68

Changes since v1:

	- Rebased on top of today's linux-next (c1a0c66f231d Add linux-next
	  specific files for 20150812)

Felipe Balbi (4):
Revert "ARM: 7655/1: smp_twd: make twd_local_timer_of_register() no-op
for nosmp"
arm: boot: dts: am4372: add ARM timers and SCU nodes
arm: omap2: Kconfig: select TWD and global timer on AM43xx devices
arm: omap2: board-generic: use omap4_local_timer_init for AM437x

 arch/arm/boot/dts/am4372.dtsi       | 21 +++++++++++++++++++++
 arch/arm/kernel/smp_twd.c           |  4 ----
 arch/arm/mach-omap2/Kconfig         |  3 +++
 arch/arm/mach-omap2/board-generic.c |  2 +-
 4 files changed, 25 insertions(+), 5 deletions(-)
Signature · 1 line
2.5.0
#1 lore raw

PATCH 1/4 Revert "ARM: 7655/1: smp_twd: make twd_local_timer_of_register() no-op for nosmp"

This reverts commit 904464b91eca8c665acea033489225af02eeb75a.

The problem pointed out by commit 904464b91eca ("ARM: 7655/1:
smp_twd: make twd_local_timer_of_register() no-op for nosmp") doesn't exist anymore.

We can safely boot with nosmp and the warning won't show up.

The other side benefit of this patch is that TWD has a chance to probe on single-core A9 systems such as AM437x which sport TWD.

---
 arch/arm/kernel/smp_twd.c | 4 ----
 1 file changed, 4 deletions(-)
arch/arm/kernel/smp_twd.c +0 -4
index e9035cda1485..662ed88bc1f9 100644
@@ -23,7 +23,6 @@
 #include <linux/of_irq.h>
 #include <linux/of_address.h>
 
-#include <asm/smp_plat.h>
 #include <asm/smp_twd.h>
 
 /* set up by the platform code */
@@ -392,9 +391,6 @@ static void __init twd_local_timer_of_register(struct device_node *np)
 {
 	int err;
 
-	if (!is_smp() || !setup_max_cpus)
-		return;
-
 	twd_ppi = irq_of_parse_and_map(np, 0);
 	if (!twd_ppi) {
 		err = -EINVAL;
Signature · 1 line
2.5.0
#2 lore raw

PATCH 1/4 Revert "ARM: 7655/1: smp_twd: make twd_local_timer_of_register() no-op for nosmp"

Quoted 11 lines · Felipe Balbi

This reverts commit 904464b91eca8c665acea033489225af02eeb75a.

The problem pointed out by commit 904464b91eca ("ARM: 7655/1:
smp_twd: make twd_local_timer_of_register() no-op for nosmp") doesn't exist anymore.

We can safely boot with nosmp and the warning won't show up.

The other side benefit of this patch is that TWD has a chance to probe on single-core A9 systems such as AM437x which sport TWD.

I don't remember all the details from Feb 2013 on why we made that change. If this is proven safe, then I guess it's okay.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
#3 lore raw

PATCH 1/4 Revert "ARM: 7655/1: smp_twd: make twd_local_timer_of_register() no-op for nosmp"

Quoted 7 lines · Russell King - ARM Linux
Quoted 6 lines · Felipe Balbi

This reverts commit 904464b91eca8c665acea033489225af02eeb75a.

The problem pointed out by commit 904464b91eca ("ARM: 7655/1:
smp_twd: make twd_local_timer_of_register() no-op for nosmp") doesn't exist anymore.

Quoted 8 lines
Quoted 5 lines

We can safely boot with nosmp and the warning won't show up.

The other side benefit of this patch is that TWD has a chance to probe on single-core A9 systems such as AM437x which sport TWD.

I don't remember all the details from Feb 2013 on why we made that change. If this is proven safe, then I guess it's okay.

Do you want me to upload to your patch system and, perhaps, keep in linux-next for v4.4 merge window ? (too late for v4.3 I guess).

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150813/67ef08f1/attachment-0001.sig>
#4 lore raw

PATCH 2/4 arm: boot: dts: am4372: add ARM timers and SCU nodes

In reply to Felipe Balbi

AM437x devices sport SCU, TWD and Global timers,
let's add them to DTS so they have a chance to
probe and be used by Linux.

---
 arch/arm/boot/dts/am4372.dtsi | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/arm/boot/dts/am4372.dtsi +21 -0
index 51feccfa0e0a..7dfc9d8bd003 100644
@@ -64,6 +64,27 @@
 		interrupt-parent = <&gic>;
 	};
 
+	scu: scu at 48240000 {
+		compatible = "arm,cortex-a9-scu";
+		reg = <0x48240000 0x100>;
+	};
+
+	global_timer: timer at 48240200 {
+		compatible = "arm,cortex-a9-global-timer";
+		reg = <0x48240200 0x100>;
+		interrupts = <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-parent = <&gic>;
+		clocks = <&dpll_mpu_m2_ck>;
+	};
+
+	local_timer: timer at 48240600 {
+		compatible = "arm,cortex-a9-twd-timer";
+		reg = <0x48240600 0x100>;
+		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-parent = <&gic>;
+		clocks = <&dpll_mpu_m2_ck>;
+	};
+
 	l2-cache-controller at 48242000 {
 		compatible = "arm,pl310-cache";
 		reg = <0x48242000 0x1000>;
Signature · 1 line
2.5.0
maintainer
#5 lore raw

PATCH 2/4 arm: boot: dts: am4372: add ARM timers and SCU nodes

Quoted 3 lines · Felipe Balbi

AM437x devices sport SCU, TWD and Global timers,
let's add them to DTS so they have a chance to
probe and be used by Linux.

Applying this one into omap-for-v4.3/dt-v2. Not sure if it will get merged as we're getting close to the merge window. The rest we can patch once Russell has reverted the bogus SMP dependency.

Regards,

Tony

#6 lore raw

PATCH 2/4 arm: boot: dts: am4372: add ARM timers and SCU nodes

Quoted 9 lines · Tony Lindgren
Quoted 3 lines · Felipe Balbi

AM437x devices sport SCU, TWD and Global timers,
let's add them to DTS so they have a chance to
probe and be used by Linux.

Applying this one into omap-for-v4.3/dt-v2. Not sure if it will get merged as we're getting close to the merge window. The rest we can patch once Russell has reverted the bogus SMP dependency.

I'm just waiting for Russell's "it's okay to post on patch system".

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150813/a9e68a66/attachment-0001.sig>
#7 lore raw

PATCH 3/4 arm: omap2: Kconfig: select TWD and global timer on AM43xx devices

In reply to Felipe Balbi

Make sure to tell the kernel that AM437x has
TWD and global timers.

---
 arch/arm/mach-omap2/Kconfig | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/mach-omap2/Kconfig +3 -0
index 07d2e100caab..88ef10b2d415 100644
@@ -63,6 +63,9 @@ config SOC_AM43XX
 	select MACH_OMAP_GENERIC
 	select MIGHT_HAVE_CACHE_L2X0
 	select HAVE_ARM_SCU
+	select HAVE_ARM_TWD
+	select ARM_GLOBAL_TIMER
+	select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
 
 config SOC_DRA7XX
 	bool "TI DRA7XX"
Signature · 1 line
2.5.0
#8 lore raw

PATCH 4/4 arm: omap2: board-generic: use omap4_local_timer_init for AM437x

In reply to Felipe Balbi

AM437x-based boards, can use omap4_local_timer_init() just fine. Let's use that instead.

---
 arch/arm/mach-omap2/board-generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/board-generic.c +1 -1
index 24c9afc9e8a7..89bf39663d61 100644
@@ -279,7 +279,7 @@ DT_MACHINE_START(AM43_DT, "Generic AM43 (Flattened Device Tree)")
 	.init_late	= am43xx_init_late,
 	.init_irq	= omap_gic_of_init,
 	.init_machine	= omap_generic_init,
-	.init_time	= omap3_gptimer_timer_init,
+	.init_time	= omap4_local_timer_init,
 	.dt_compat	= am43_boards_compat,
 	.restart	= omap44xx_restart,
 MACHINE_END
Signature · 1 line
2.5.0