* [PATCH v2 0/4] ARM: shmobile: Enable ARM_GLOBAL_TIMER on Cortex-A9 MPCore @ 2019-12-11 13:52 Geert Uytterhoeven 2019-12-11 13:52 ` [PATCH v2 1/4] ARM: dts: sh73a0: Rename twd clock to periph clock Geert Uytterhoeven ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: Geert Uytterhoeven @ 2019-12-11 13:52 UTC (permalink / raw) To: Magnus Damm; +Cc: linux-renesas-soc, Geert Uytterhoeven, linux-arm-kernel Hi all, SH-Mobile AG5 and R-Car H1 SoCs are based on the Cortex-A9 MPCore, which includes an ARM global timer. Enable use of the global timer on these SoCs for scheduling and delay loops, with the following impact: - Scheduler accuracy is increased from 10 ms to a few ns, - Calls to shmobile_init_delay() to preset loops-per-jiffies can be removed. Note that when using an old DTB lacking the global timer, the kernel will still work, but the delay loop will need to be calibrated during boot. Note that we still need shmobile_init_delay() to setup loops-per-jiffies for other SoCs lacking an architectured or global timer: - emev2: Dual-core Cortex-A9 r1p3, - r7s72100: single-core Cortex-A9 MPCore r3p0, global timer IRQ not wired? - r7s9210: single-core Cortex-A9 MPCore r4p1, global timer IRQ not wired? - r8a7740: single-core Cortex-A9 r2p4, - r8a7778: single-core Cortex-A9 r2p2-00rel0. Changes compared to v1: - Rebased. I have been using this on KZM-A9-GT (SH-Mobile AG5) and Marzen (R-Car H1) for the last 18 months or so. Hence I plan to queue the first 3 patches in renesas-devel for v5.6, and postpone the 4th to v5.7. Thanks! Geert Uytterhoeven (4): ARM: dts: sh73a0: Rename twd clock to periph clock ARM: dts: sh73a0: Add device node for ARM global timer ARM: dts: r8a7779: Add device node for ARM global timer ARM: shmobile: Enable ARM_GLOBAL_TIMER on Cortex-A9 MPCore SoCs arch/arm/boot/dts/r8a7779.dtsi | 8 ++++++++ arch/arm/boot/dts/sh73a0.dtsi | 11 +++++++++-- arch/arm/mach-shmobile/setup-r8a7779.c | 1 - arch/arm/mach-shmobile/setup-sh73a0.c | 1 - drivers/soc/renesas/Kconfig | 2 ++ 5 files changed, 19 insertions(+), 4 deletions(-) -- 2.17.1 Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds _______________________________________________ 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] 5+ messages in thread
* [PATCH v2 1/4] ARM: dts: sh73a0: Rename twd clock to periph clock 2019-12-11 13:52 [PATCH v2 0/4] ARM: shmobile: Enable ARM_GLOBAL_TIMER on Cortex-A9 MPCore Geert Uytterhoeven @ 2019-12-11 13:52 ` Geert Uytterhoeven 2019-12-11 13:52 ` [PATCH v2 2/4] ARM: dts: sh73a0: Add device node for ARM global timer Geert Uytterhoeven ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: Geert Uytterhoeven @ 2019-12-11 13:52 UTC (permalink / raw) To: Magnus Damm; +Cc: linux-renesas-soc, Geert Uytterhoeven, linux-arm-kernel The "TWD" clock is actually the Cortex-A9 MPCore "PERIPHCLK" clock, which not only clocks the private timers and watchdogs (TWD), but also the interrupt controller and global timer. Hence rename it from "twd" to "periph". Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> --- v2: - No changes. --- arch/arm/boot/dts/sh73a0.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi index 8b35ff4030ef9767..9093b3b9fc0cbd1d 100644 --- a/arch/arm/boot/dts/sh73a0.dtsi +++ b/arch/arm/boot/dts/sh73a0.dtsi @@ -43,7 +43,7 @@ compatible = "arm,cortex-a9-twd-timer"; reg = <0xf0000600 0x20>; interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_EDGE_RISING)>; - clocks = <&twd_clk>; + clocks = <&periph_clk>; }; gic: interrupt-controller@f0001000 { @@ -812,7 +812,7 @@ clock-div = <13>; clock-mult = <1>; }; - twd_clk: twd { + periph_clk: periph { compatible = "fixed-factor-clock"; clocks = <&cpg_clocks SH73A0_CLK_Z>; #clock-cells = <0>; -- 2.17.1 _______________________________________________ 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] 5+ messages in thread
* [PATCH v2 2/4] ARM: dts: sh73a0: Add device node for ARM global timer 2019-12-11 13:52 [PATCH v2 0/4] ARM: shmobile: Enable ARM_GLOBAL_TIMER on Cortex-A9 MPCore Geert Uytterhoeven 2019-12-11 13:52 ` [PATCH v2 1/4] ARM: dts: sh73a0: Rename twd clock to periph clock Geert Uytterhoeven @ 2019-12-11 13:52 ` Geert Uytterhoeven 2019-12-11 13:52 ` [PATCH v2 3/4] ARM: dts: r8a7779: " Geert Uytterhoeven 2019-12-11 13:52 ` [PATCH v2 4/4] ARM: shmobile: Enable ARM_GLOBAL_TIMER on Cortex-A9 MPCore SoCs Geert Uytterhoeven 3 siblings, 0 replies; 5+ messages in thread From: Geert Uytterhoeven @ 2019-12-11 13:52 UTC (permalink / raw) To: Magnus Damm; +Cc: linux-renesas-soc, Geert Uytterhoeven, linux-arm-kernel Add a device node for the global timer, which is part of the Cortex-A9 MPCore. The global timer can serve as an accurate (3 ns) clock source for scheduling and delay loops. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> --- v2: - No changes. --- arch/arm/boot/dts/sh73a0.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi index 9093b3b9fc0cbd1d..7efe33c4d041a524 100644 --- a/arch/arm/boot/dts/sh73a0.dtsi +++ b/arch/arm/boot/dts/sh73a0.dtsi @@ -39,6 +39,13 @@ }; }; + timer@f0000200 { + compatible = "arm,cortex-a9-global-timer"; + reg = <0xf0000200 0x100>; + interrupts = <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_EDGE_RISING)>; + clocks = <&periph_clk>; + }; + timer@f0000600 { compatible = "arm,cortex-a9-twd-timer"; reg = <0xf0000600 0x20>; -- 2.17.1 _______________________________________________ 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] 5+ messages in thread
* [PATCH v2 3/4] ARM: dts: r8a7779: Add device node for ARM global timer 2019-12-11 13:52 [PATCH v2 0/4] ARM: shmobile: Enable ARM_GLOBAL_TIMER on Cortex-A9 MPCore Geert Uytterhoeven 2019-12-11 13:52 ` [PATCH v2 1/4] ARM: dts: sh73a0: Rename twd clock to periph clock Geert Uytterhoeven 2019-12-11 13:52 ` [PATCH v2 2/4] ARM: dts: sh73a0: Add device node for ARM global timer Geert Uytterhoeven @ 2019-12-11 13:52 ` Geert Uytterhoeven 2019-12-11 13:52 ` [PATCH v2 4/4] ARM: shmobile: Enable ARM_GLOBAL_TIMER on Cortex-A9 MPCore SoCs Geert Uytterhoeven 3 siblings, 0 replies; 5+ messages in thread From: Geert Uytterhoeven @ 2019-12-11 13:52 UTC (permalink / raw) To: Magnus Damm; +Cc: linux-renesas-soc, Geert Uytterhoeven, linux-arm-kernel Add a device node for the global timer, which is part of the Cortex-A9 MPCore. The global timer can serve as an accurate (4 ns) clock source for scheduling and delay loops. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> --- v2: - No changes. --- arch/arm/boot/dts/r8a7779.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi index ebf5b7cfe21599c6..63341635bddf873f 100644 --- a/arch/arm/boot/dts/r8a7779.dtsi +++ b/arch/arm/boot/dts/r8a7779.dtsi @@ -68,6 +68,14 @@ <0xf0000100 0x100>; }; + timer@f0000200 { + compatible = "arm,cortex-a9-global-timer"; + reg = <0xf0000200 0x100>; + interrupts = <GIC_PPI 11 + (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_EDGE_RISING)>; + clocks = <&cpg_clocks R8A7779_CLK_ZS>; + }; + timer@f0000600 { compatible = "arm,cortex-a9-twd-timer"; reg = <0xf0000600 0x20>; -- 2.17.1 _______________________________________________ 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] 5+ messages in thread
* [PATCH v2 4/4] ARM: shmobile: Enable ARM_GLOBAL_TIMER on Cortex-A9 MPCore SoCs 2019-12-11 13:52 [PATCH v2 0/4] ARM: shmobile: Enable ARM_GLOBAL_TIMER on Cortex-A9 MPCore Geert Uytterhoeven ` (2 preceding siblings ...) 2019-12-11 13:52 ` [PATCH v2 3/4] ARM: dts: r8a7779: " Geert Uytterhoeven @ 2019-12-11 13:52 ` Geert Uytterhoeven 3 siblings, 0 replies; 5+ messages in thread From: Geert Uytterhoeven @ 2019-12-11 13:52 UTC (permalink / raw) To: Magnus Damm; +Cc: linux-renesas-soc, Geert Uytterhoeven, linux-arm-kernel SH-Mobile AG5 and R-Car H1 SoCs are based on the Cortex-A9 MPCore, which includes a global timer. Enable the ARM global timer on these SoCs, which will be used for: - the scheduler clock, improving scheduler accuracy from 10 ms to 3 or 4 ns, - delay loops, allowing removal of calls to shmobile_init_delay() from the corresponding machine vectors. Note that when using an old DTB lacking the global timer, the kernel will still work. However, loops-per-jiffies will no longer be preset, and the delay loop will need to be calibrated during boot. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> --- v2: - Rebased --- arch/arm/mach-shmobile/setup-r8a7779.c | 1 - arch/arm/mach-shmobile/setup-sh73a0.c | 1 - drivers/soc/renesas/Kconfig | 2 ++ 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c index b13ec9088ce5354c..86406e3f9b22e31f 100644 --- a/arch/arm/mach-shmobile/setup-r8a7779.c +++ b/arch/arm/mach-shmobile/setup-r8a7779.c @@ -72,7 +72,6 @@ static const char *const r8a7779_compat_dt[] __initconst = { DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)") .smp = smp_ops(r8a7779_smp_ops), .map_io = r8a7779_map_io, - .init_early = shmobile_init_delay, .init_irq = r8a7779_init_irq_dt, .init_late = shmobile_init_late, .dt_compat = r8a7779_compat_dt, diff --git a/arch/arm/mach-shmobile/setup-sh73a0.c b/arch/arm/mach-shmobile/setup-sh73a0.c index 4b7d07a36a24aa75..cac92edd2b8879cc 100644 --- a/arch/arm/mach-shmobile/setup-sh73a0.c +++ b/arch/arm/mach-shmobile/setup-sh73a0.c @@ -56,7 +56,6 @@ static const char *const sh73a0_boards_compat_dt[] __initconst = { DT_MACHINE_START(SH73A0_DT, "Generic SH73A0 (Flattened Device Tree)") .smp = smp_ops(sh73a0_smp_ops), .map_io = sh73a0_map_io, - .init_early = shmobile_init_delay, .init_machine = sh73a0_generic_init, .init_late = shmobile_init_late, .dt_compat = sh73a0_boards_compat_dt, diff --git a/drivers/soc/renesas/Kconfig b/drivers/soc/renesas/Kconfig index 2d10e34cdbe4d117..f87a7466171c5eba 100644 --- a/drivers/soc/renesas/Kconfig +++ b/drivers/soc/renesas/Kconfig @@ -116,6 +116,7 @@ config ARCH_R8A7779 bool "R-Car H1 (R8A77790)" select ARCH_RCAR_GEN1 select ARM_ERRATA_754322 + select ARM_GLOBAL_TIMER select HAVE_ARM_SCU if SMP select HAVE_ARM_TWD if SMP select SYSC_R8A7779 @@ -163,6 +164,7 @@ config ARCH_SH73A0 bool "SH-Mobile AG5 (R8A73A00)" select ARCH_RMOBILE select ARM_ERRATA_754322 + select ARM_GLOBAL_TIMER select HAVE_ARM_SCU if SMP select HAVE_ARM_TWD if SMP select RENESAS_INTC_IRQPIN -- 2.17.1 _______________________________________________ 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] 5+ messages in thread
end of thread, other threads:[~2019-12-11 13:53 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-12-11 13:52 [PATCH v2 0/4] ARM: shmobile: Enable ARM_GLOBAL_TIMER on Cortex-A9 MPCore Geert Uytterhoeven 2019-12-11 13:52 ` [PATCH v2 1/4] ARM: dts: sh73a0: Rename twd clock to periph clock Geert Uytterhoeven 2019-12-11 13:52 ` [PATCH v2 2/4] ARM: dts: sh73a0: Add device node for ARM global timer Geert Uytterhoeven 2019-12-11 13:52 ` [PATCH v2 3/4] ARM: dts: r8a7779: " Geert Uytterhoeven 2019-12-11 13:52 ` [PATCH v2 4/4] ARM: shmobile: Enable ARM_GLOBAL_TIMER on Cortex-A9 MPCore SoCs Geert Uytterhoeven
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).