arm: am437x: use TWD/Global timers
Subsystems (4)
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
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(-)
Signature · 1 line
2.5.0
PATCH 1/5 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
@@ -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 ;
Signature · 1 line
2.5.0
Tony Lindgren
maintainerPATCH 1/5 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: maketwd_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:
PATCH 2/5 arm: boot: dts: am4372: add ARM timers and SCU nodes
In reply to Felipe BalbiAM437x 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
@@ -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>;
Signature · 1 line
2.5.0
Tony Lindgren
maintainerPATCH 2/5 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.
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
PATCH 2/5 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.Is this one safe to apply already without the
Kconfigchange?Or will it cause
multi_v7_defconfigwith 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 :-)
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/20150812/adb93b17/attachment.sig>
PATCH 2/5 arm: boot: dts: am4372: add ARM timers and SCU nodes
Hi,
Quoted 6 lines · Felipe Balbi
Quoted 5 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.
Quoted 7 lines
Quoted 4 lines
Is this one safe to apply already without the
Kconfigchange?Or will it cause
multi_v7_defconfigwith 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.
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/20150812/a8b0a932/attachment.sig>
PATCH 3/5 arm: omap2: Kconfig: select TWD and global timer on AM43xx devices
In reply to Felipe BalbiMake 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
@@ -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"
Signature · 1 line
2.5.0
PATCH 4/5 arm: omap2: timer: simplify omap4_local_timer_init()
In reply to Felipe Balbiall 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.
--- arch/arm/mach-omap2/timer.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
arch/arm/mach-omap2/timer.c +4 -12
@@ -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 )
Signature · 1 line
2.5.0
Tony Lindgren
maintainerPATCH 4/5 arm: omap2: timer: simplify omap4_local_timer_init()
Quoted 5 lines · Felipe Balbi
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
PATCH 4/5 arm: omap2: timer: simplify omap4_local_timer_init()
Quoted 9 lines · Tony Lindgren
Quoted 5 lines · Felipe Balbi
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 upomap4_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.
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/20150812/68c7e75a/attachment.sig>
PATCH 5/5 arm: omap2: board-generic: use omap4_local_timer_init for AM437x
In reply to Felipe BalbiAM437x-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
@@ -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