linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC/PATCH-v4.2-rc6 0/5] arm: am437x: use TWD/Global timers
@ 2015-08-10 21:41 Felipe Balbi
  2015-08-10 21:41 ` [RFC/PATCH-v4.2-rc6 1/5] Revert "ARM: 7655/1: smp_twd: make twd_local_timer_of_register() no-op for nosmp" Felipe Balbi
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Felipe Balbi @ 2015-08-10 21:41 UTC (permalink / raw)
  To: linux-arm-kernel

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

Felipe Balbi (5):
  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: timer: simplify omap4_local_timer_init()
  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 +-
 arch/arm/mach-omap2/timer.c         | 16 ++++------------
 5 files changed, 29 insertions(+), 17 deletions(-)

-- 
2.5.0

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

* [RFC/PATCH-v4.2-rc6 1/5] Revert "ARM: 7655/1: smp_twd: make twd_local_timer_of_register() no-op for nosmp"
  2015-08-10 21:41 [RFC/PATCH-v4.2-rc6 0/5] arm: am437x: use TWD/Global timers Felipe Balbi
@ 2015-08-10 21:41 ` Felipe Balbi
  2015-08-12  7:15   ` Tony Lindgren
  2015-08-10 21:41 ` [RFC/PATCH-v4.2-rc6 2/5] arm: boot: dts: am4372: add ARM timers and SCU nodes Felipe Balbi
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Felipe Balbi @ 2015-08-10 21:41 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Dirk Behme <dirk.behme@de.bosch.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/kernel/smp_twd.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index 172c6a05d27f..e8f6d241881f 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -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 */
@@ -388,9 +387,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;
-- 
2.5.0

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

* [RFC/PATCH-v4.2-rc6 2/5] arm: boot: dts: am4372: add ARM timers and SCU nodes
  2015-08-10 21:41 [RFC/PATCH-v4.2-rc6 0/5] arm: am437x: use TWD/Global timers Felipe Balbi
  2015-08-10 21:41 ` [RFC/PATCH-v4.2-rc6 1/5] Revert "ARM: 7655/1: smp_twd: make twd_local_timer_of_register() no-op for nosmp" Felipe Balbi
@ 2015-08-10 21:41 ` Felipe Balbi
  2015-08-12  7:28   ` Tony Lindgren
  2015-08-10 21:41 ` [RFC/PATCH-v4.2-rc6 3/5] arm: omap2: Kconfig: select TWD and global timer on AM43xx devices Felipe Balbi
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Felipe Balbi @ 2015-08-10 21:41 UTC (permalink / raw)
  To: linux-arm-kernel

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.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/boot/dts/am4372.dtsi | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
index ade28c790f4b..08bcdc8f0b6f 100644
--- a/arch/arm/boot/dts/am4372.dtsi
+++ b/arch/arm/boot/dts/am4372.dtsi
@@ -59,6 +59,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>;
-- 
2.5.0

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

* [RFC/PATCH-v4.2-rc6 3/5] arm: omap2: Kconfig: select TWD and global timer on AM43xx devices
  2015-08-10 21:41 [RFC/PATCH-v4.2-rc6 0/5] arm: am437x: use TWD/Global timers Felipe Balbi
  2015-08-10 21:41 ` [RFC/PATCH-v4.2-rc6 1/5] Revert "ARM: 7655/1: smp_twd: make twd_local_timer_of_register() no-op for nosmp" Felipe Balbi
  2015-08-10 21:41 ` [RFC/PATCH-v4.2-rc6 2/5] arm: boot: dts: am4372: add ARM timers and SCU nodes Felipe Balbi
@ 2015-08-10 21:41 ` Felipe Balbi
  2015-08-10 21:41 ` [RFC/PATCH-v4.2-rc6 4/5] arm: omap2: timer: simplify omap4_local_timer_init() Felipe Balbi
  2015-08-10 21:41 ` [RFC/PATCH-v4.2-rc6 5/5] arm: omap2: board-generic: use omap4_local_timer_init for AM437x Felipe Balbi
  4 siblings, 0 replies; 12+ messages in thread
From: Felipe Balbi @ 2015-08-10 21:41 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/Kconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 4a023e8d1bdb..eea902280989 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -61,6 +61,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"
-- 
2.5.0

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

* [RFC/PATCH-v4.2-rc6 4/5] arm: omap2: timer: simplify omap4_local_timer_init()
  2015-08-10 21:41 [RFC/PATCH-v4.2-rc6 0/5] arm: am437x: use TWD/Global timers Felipe Balbi
                   ` (2 preceding siblings ...)
  2015-08-10 21:41 ` [RFC/PATCH-v4.2-rc6 3/5] arm: omap2: Kconfig: select TWD and global timer on AM43xx devices Felipe Balbi
@ 2015-08-10 21:41 ` Felipe Balbi
  2015-08-12  7:14   ` Tony Lindgren
  2015-08-10 21:41 ` [RFC/PATCH-v4.2-rc6 5/5] arm: omap2: board-generic: use omap4_local_timer_init for AM437x Felipe Balbi
  4 siblings, 1 reply; 12+ messages in thread
From: Felipe Balbi @ 2015-08-10 21:41 UTC (permalink / raw)
  To: linux-arm-kernel

all users of omap4_local_timer_init() are already
DT-only, so we can remove the check for having
DTB or not.

While at that, fix a typo in comment.

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/timer.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index cac46d852da1..88d39f98e7ff 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -649,23 +649,15 @@ static OMAP_SYS_32K_TIMER_INIT(4, 1, "timer_32k_ck", "ti,timer-alwon",
 
 #ifdef CONFIG_ARCH_OMAP4
 #ifdef CONFIG_HAVE_ARM_TWD
-static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, OMAP44XX_LOCAL_TWD_BASE, 29);
 void __init omap4_local_timer_init(void)
 {
 	omap4_sync32k_timer_init();
-	/* Local timers are not supprted on OMAP4430 ES1.0 */
-	if (omap_rev() != OMAP4430_REV_ES1_0) {
-		int err;
 
-		if (of_have_populated_dt()) {
-			clocksource_of_init();
-			return;
-		}
+	/* Local timers are not supported on OMAP4430 ES1.0 */
+	if (omap_rev() == OMAP4430_REV_ES1_0)
+		return;
 
-		err = twd_local_timer_register(&twd_local_timer);
-		if (err)
-			pr_err("twd_local_timer_register failed %d\n", err);
-	}
+	clocksource_of_init();
 }
 #else
 void __init omap4_local_timer_init(void)
-- 
2.5.0

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

* [RFC/PATCH-v4.2-rc6 5/5] arm: omap2: board-generic: use omap4_local_timer_init for AM437x
  2015-08-10 21:41 [RFC/PATCH-v4.2-rc6 0/5] arm: am437x: use TWD/Global timers Felipe Balbi
                   ` (3 preceding siblings ...)
  2015-08-10 21:41 ` [RFC/PATCH-v4.2-rc6 4/5] arm: omap2: timer: simplify omap4_local_timer_init() Felipe Balbi
@ 2015-08-10 21:41 ` Felipe Balbi
  4 siblings, 0 replies; 12+ messages in thread
From: Felipe Balbi @ 2015-08-10 21:41 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Felipe Balbi <balbi@ti.com>
---
 arch/arm/mach-omap2/board-generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 34ff14b7beab..8acb3b4c84e3 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -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
-- 
2.5.0

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

* [RFC/PATCH-v4.2-rc6 4/5] arm: omap2: timer: simplify omap4_local_timer_init()
  2015-08-10 21:41 ` [RFC/PATCH-v4.2-rc6 4/5] arm: omap2: timer: simplify omap4_local_timer_init() Felipe Balbi
@ 2015-08-12  7:14   ` Tony Lindgren
  2015-08-12 14:53     ` Felipe Balbi
  0 siblings, 1 reply; 12+ messages in thread
From: Tony Lindgren @ 2015-08-12  7:14 UTC (permalink / raw)
  To: linux-arm-kernel

* Felipe Balbi <balbi@ti.com> [150810 14:44]:
> all users of omap4_local_timer_init() are already
> DT-only, so we can remove the check for having
> DTB or not.
> 
> While at that, fix a typo in comment.

We already have d1dabab2841d ("ARM: OMAP2+: Clean up
omap4_local_timer_init") in Linux next reviewed-by you :)

Tony

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

* [RFC/PATCH-v4.2-rc6 1/5] Revert "ARM: 7655/1: smp_twd: make twd_local_timer_of_register() no-op for nosmp"
  2015-08-10 21:41 ` [RFC/PATCH-v4.2-rc6 1/5] Revert "ARM: 7655/1: smp_twd: make twd_local_timer_of_register() no-op for nosmp" Felipe Balbi
@ 2015-08-12  7:15   ` Tony Lindgren
  0 siblings, 0 replies; 12+ messages in thread
From: Tony Lindgren @ 2015-08-12  7:15 UTC (permalink / raw)
  To: linux-arm-kernel

* Felipe Balbi <balbi@ti.com> [150810 14:45]:
> 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.

Can you please upload this into Russell's patch tracking system
if no comments? Please also feel free to add:

Acked-by: Tony Lindgren <tony@atomide.com>

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

* [RFC/PATCH-v4.2-rc6 2/5] arm: boot: dts: am4372: add ARM timers and SCU nodes
  2015-08-10 21:41 ` [RFC/PATCH-v4.2-rc6 2/5] arm: boot: dts: am4372: add ARM timers and SCU nodes Felipe Balbi
@ 2015-08-12  7:28   ` Tony Lindgren
  2015-08-12 14:52     ` Felipe Balbi
  0 siblings, 1 reply; 12+ messages in thread
From: Tony Lindgren @ 2015-08-12  7:28 UTC (permalink / raw)
  To: linux-arm-kernel

* Felipe Balbi <balbi@ti.com> [150810 14:44]:
> 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.

Is this one safe to apply already without the Kconfig change?

Or will it cause multi_v7_defconfig with the timers selected
to not boot properly?

Regards,

Tony

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

* [RFC/PATCH-v4.2-rc6 2/5] arm: boot: dts: am4372: add ARM timers and SCU nodes
  2015-08-12  7:28   ` Tony Lindgren
@ 2015-08-12 14:52     ` Felipe Balbi
  2015-08-12 19:54       ` Felipe Balbi
  0 siblings, 1 reply; 12+ messages in thread
From: Felipe Balbi @ 2015-08-12 14:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 12, 2015 at 12:28:16AM -0700, Tony Lindgren wrote:
> * Felipe Balbi <balbi@ti.com> [150810 14:44]:
> > 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.
> 
> Is this one safe to apply already without the Kconfig change?
> 
> Or will it cause multi_v7_defconfig with the timers selected
> to not boot properly?

I'd have to try :-) But it should be safe, just the timers won't be
chosen for anything :-)

-- 
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/20150812/adb93b17/attachment.sig>

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

* [RFC/PATCH-v4.2-rc6 4/5] arm: omap2: timer: simplify omap4_local_timer_init()
  2015-08-12  7:14   ` Tony Lindgren
@ 2015-08-12 14:53     ` Felipe Balbi
  0 siblings, 0 replies; 12+ messages in thread
From: Felipe Balbi @ 2015-08-12 14:53 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 12, 2015 at 12:14:24AM -0700, Tony Lindgren wrote:
> * Felipe Balbi <balbi@ti.com> [150810 14:44]:
> > all users of omap4_local_timer_init() are already
> > DT-only, so we can remove the check for having
> > DTB or not.
> > 
> > While at that, fix a typo in comment.
> 
> We already have d1dabab2841d ("ARM: OMAP2+: Clean up
> omap4_local_timer_init") in Linux next reviewed-by you :)

hehe, I had forgotten about that sorry. I'll rebase this on today's
next and resend the series. I'll also test $subject without the other
patches.

-- 
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/20150812/68c7e75a/attachment.sig>

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

* [RFC/PATCH-v4.2-rc6 2/5] arm: boot: dts: am4372: add ARM timers and SCU nodes
  2015-08-12 14:52     ` Felipe Balbi
@ 2015-08-12 19:54       ` Felipe Balbi
  0 siblings, 0 replies; 12+ messages in thread
From: Felipe Balbi @ 2015-08-12 19:54 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wed, Aug 12, 2015 at 09:52:16AM -0500, Felipe Balbi wrote:
> On Wed, Aug 12, 2015 at 12:28:16AM -0700, Tony Lindgren wrote:
> > * Felipe Balbi <balbi@ti.com> [150810 14:44]:
> > > 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.
> > 
> > Is this one safe to apply already without the Kconfig change?
> > 
> > Or will it cause multi_v7_defconfig with the timers selected
> > to not boot properly?
> 
> I'd have to try :-) But it should be safe, just the timers won't be
> chosen for anything :-)

Just booted with only $subject and patch 1/5, it works just fine.

I'll resend the series (now, 4 patches only) and if RMK is fine with
patch 1, then I'll add to his patch system.

-- 
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/20150812/a8b0a932/attachment.sig>

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

end of thread, other threads:[~2015-08-12 19:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-10 21:41 [RFC/PATCH-v4.2-rc6 0/5] arm: am437x: use TWD/Global timers Felipe Balbi
2015-08-10 21:41 ` [RFC/PATCH-v4.2-rc6 1/5] Revert "ARM: 7655/1: smp_twd: make twd_local_timer_of_register() no-op for nosmp" Felipe Balbi
2015-08-12  7:15   ` Tony Lindgren
2015-08-10 21:41 ` [RFC/PATCH-v4.2-rc6 2/5] arm: boot: dts: am4372: add ARM timers and SCU nodes Felipe Balbi
2015-08-12  7:28   ` Tony Lindgren
2015-08-12 14:52     ` Felipe Balbi
2015-08-12 19:54       ` Felipe Balbi
2015-08-10 21:41 ` [RFC/PATCH-v4.2-rc6 3/5] arm: omap2: Kconfig: select TWD and global timer on AM43xx devices Felipe Balbi
2015-08-10 21:41 ` [RFC/PATCH-v4.2-rc6 4/5] arm: omap2: timer: simplify omap4_local_timer_init() Felipe Balbi
2015-08-12  7:14   ` Tony Lindgren
2015-08-12 14:53     ` Felipe Balbi
2015-08-10 21:41 ` [RFC/PATCH-v4.2-rc6 5/5] arm: omap2: board-generic: use omap4_local_timer_init for AM437x Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).