Skip to contentSkip to conversation

ARM: dts: am4372: fix clock source for arm twd and global timers

PATCH Superseded Grygorii Strashko 3 participants 6 messages Nov 30, 2015 – Dec 10, 2015 Device tree bindings

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ARM: dts: am4372: fix clock source for arm twd and global timers

ARM TWD and Global timer are clocked by PERIPHCLK which is MPU_CLK/2. But now they are clocked by dpll_mpu_m2_ck == MPU_CLK and, as result. Timekeeping core misbehaves. For example, execution of command "sleep 5" will take 10 sec instead of 5.

Hence, fix it by adding mpu_periphclk ("fixed-factor-clock") and use it for clocking ARM TWD and Global timer (same way as on OMAP4).

Cc Tony Lindgren <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Tero Kristo <[email protected]>
Fixes commit 8cbd4c2f6a99 ("arm: boot: dts: am4372: add ARM timers and SCU nodes")

---
Changes in v2:
- fix: mpu_periphclk should be clocked from dpll_mpu_m2_ck instead of dpll_mpu_ck.
link on v1:
http://www.spinics.net/lists/arm-kernel/msg463898.html

 arch/arm/boot/dts/am4372.dtsi        | 4 ++--
 arch/arm/boot/dts/am43xx-clocks.dtsi | 8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)
arch/arm/boot/dts/am4372.dtsi +2 -2
index d83ff9c..de8791a 100644
@@ -74,7 +74,7 @@
 		reg = <0x48240200 0x100>;
 		interrupts = <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>;
 		interrupt-parent = <&gic>;
-		clocks = <&dpll_mpu_m2_ck>;
+		clocks = <&mpu_periphclk>;
 	};
 
 	local_timer: timer at 48240600 {
@@ -82,7 +82,7 @@
 		reg = <0x48240600 0x100>;
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>;
 		interrupt-parent = <&gic>;
-		clocks = <&dpll_mpu_m2_ck>;
+		clocks = <&mpu_periphclk>;
 	};
 
 	l2-cache-controller at 48242000 {
arch/arm/boot/dts/am43xx-clocks.dtsi +8 -0
index cc88728..a38af2b 100644
@@ -259,6 +259,14 @@
 		ti,invert-autoidle-bit;
 	};
 
+	mpu_periphclk: mpu_periphclk {
+		#clock-cells = <0>;
+		compatible = "fixed-factor-clock";
+		clocks = <&dpll_mpu_m2_ck>;
+		clock-mult = <1>;
+		clock-div = <2>;
+	};
+
 	dpll_ddr_ck: dpll_ddr_ck {
 		#clock-cells = <0>;
 		compatible = "ti,am3-dpll-clock";
Signature · 1 line
2.6.3
#1 lore raw

PATCH v2 1/1 ARM: dts: am4372: fix clock source for arm twd and global timers

Quoted 5 lines · Grygorii Strashko

ARM TWD and Global timer are clocked by PERIPHCLK which is MPU_CLK/2. But now they are clocked by dpll_mpu_m2_ck == MPU_CLK and, as result. Timekeeping core misbehaves. For example, execution of command "sleep 5" will take 10 sec instead of 5.

Quoted 8 lines

Hence, fix it by adding mpu_periphclk ("fixed-factor-clock") and use it for clocking ARM TWD and Global timer (same way as on OMAP4).

Cc Tony Lindgren <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Tero Kristo <[email protected]>
Fixes commit 8cbd4c2f6a99 ("arm: boot: dts: am4372: add ARM timers and SCU nodes")

Is this fix alone enough or do you still need to disable other the ARM timers in the board specific dts file?

Regards,

Tony

Quoted 55 lines

---
Changes in v2:
- fix: mpu_periphclk should be clocked from dpll_mpu_m2_ck instead of dpll_mpu_ck.
link on v1:
http://www.spinics.net/lists/arm-kernel/msg463898.html

 arch/arm/boot/dts/am4372.dtsi        | 4 ++--
 arch/arm/boot/dts/am43xx-clocks.dtsi | 8 ++++++++
 2 files changed, 10 insertions(+), 2 deletions(-)
arch/arm/boot/dts/am4372.dtsi +2 -2
index d83ff9c..de8791a 100644
@@ -74,7 +74,7 @@
 		reg = <0x48240200 0x100>;
 		interrupts = <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>;
 		interrupt-parent = <&gic>;
-		clocks = <&dpll_mpu_m2_ck>;
+		clocks = <&mpu_periphclk>;
 	};
 
 	local_timer: timer at 48240600 {
@@ -82,7 +82,7 @@
 		reg = <0x48240600 0x100>;
 		interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>;
 		interrupt-parent = <&gic>;
-		clocks = <&dpll_mpu_m2_ck>;
+		clocks = <&mpu_periphclk>;
 	};
 
 	l2-cache-controller at 48242000 {
arch/arm/boot/dts/am43xx-clocks.dtsi +8 -0
index cc88728..a38af2b 100644
@@ -259,6 +259,14 @@
 		ti,invert-autoidle-bit;
 	};
 
+	mpu_periphclk: mpu_periphclk {
+		#clock-cells = <0>;
+		compatible = "fixed-factor-clock";
+		clocks = <&dpll_mpu_m2_ck>;
+		clock-mult = <1>;
+		clock-div = <2>;
+	};
+
 	dpll_ddr_ck: dpll_ddr_ck {
 		#clock-cells = <0>;
 		compatible = "ti,am3-dpll-clock";
Signature · 1 line
2.6.3
#2 lore raw

PATCH v2 1/1 ARM: dts: am4372: fix clock source for arm twd and global timers

Quoted 9 lines · Tony Lindgren
Quoted 8 lines · Grygorii Strashko

ARM TWD and Global timer are clocked by PERIPHCLK which is MPU_CLK/2. But now they are clocked by dpll_mpu_m2_ck == MPU_CLK and, as result. Timekeeping core misbehaves. For example, execution of command "sleep 5" will take 10 sec instead of 5.

Hence, fix it by adding mpu_periphclk ("fixed-factor-clock") and use it for clocking ARM TWD and Global timer (same way as on OMAP4).

Quoted 9 lines
Quoted 5 lines
Cc Tony Lindgren <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Tero Kristo <[email protected]>
Fixes commit 8cbd4c2f6a99 ("arm: boot: dts: am4372: add ARM timers and SCU nodes")

Is this fix alone enough or do you still need to disable other the ARM timers in the board specific dts file?

This one is independent and it's required for -rc, because ARM TWD timer will be selected now for am43xx even if http://www.spinics.net/lists/arm-kernel/msg459649.html
is not merged yet ;) in case of omap2plus_defconfig build.

Signature · 2 lines
regards,
-grygorii
#3 lore raw

PATCH v2 1/1 ARM: dts: am4372: fix clock source for arm twd and global timers

Hi Tony, Felipe, Tero,

Quoted 16 lines · Grygorii Strashko
Quoted 15 lines · Tony Lindgren
Quoted 13 lines · Grygorii Strashko

ARM TWD and Global timer are clocked by PERIPHCLK which is MPU_CLK/2. But now they are clocked by dpll_mpu_m2_ck == MPU_CLK and, as result. Timekeeping core misbehaves. For example, execution of command "sleep 5" will take 10 sec instead of 5.

Hence, fix it by adding mpu_periphclk ("fixed-factor-clock") and use it for clocking ARM TWD and Global timer (same way as on OMAP4).

Cc Tony Lindgren <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Tero Kristo <[email protected]>
Fixes commit 8cbd4c2f6a99 ("arm: boot: dts: am4372: add ARM timers and SCU nodes")
Quoted 9 lines
Quoted 3 lines

Is this fix alone enough or do you still need to disable other the ARM timers in the board specific dts file?

This one is independent and it's required for -rc, because ARM TWD timer will be selected now for am43xx even if http://www.spinics.net/lists/arm-kernel/msg459649.html
is not merged yet ;) in case of omap2plus_defconfig build.

Are there any comments objection?
Could this patch be merged as part of -rc cycle?

Signature · 2 lines
regards,
-grygorii
#4 lore raw

PATCH v2 1/1 ARM: dts: am4372: fix clock source for arm twd and global timers

In reply to Grygorii Strashko

Hi,

Quoted 5 lines · Grygorii Strashko

ARM TWD and Global timer are clocked by PERIPHCLK which is MPU_CLK/2. But now they are clocked by dpll_mpu_m2_ck == MPU_CLK and, as result. Timekeeping core misbehaves. For example, execution of command "sleep 5" will take 10 sec instead of 5.

Quoted 8 lines

Hence, fix it by adding mpu_periphclk ("fixed-factor-clock") and use it for clocking ARM TWD and Global timer (same way as on OMAP4).

Cc Tony Lindgren <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Tero Kristo <[email protected]>
Fixes commit 8cbd4c2f6a99 ("arm: boot: dts: am4372: add ARM timers and SCU nodes")

this seems to be the best fix for this problem, yeah.

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151208/b82a5540/attachment.sig>
#5 lore raw

PATCH v2 1/1 ARM: dts: am4372: fix clock source for arm twd and global timers

Quoted 18 lines · Felipe Balbi

Hi,

Quoted 5 lines · Grygorii Strashko

ARM TWD and Global timer are clocked by PERIPHCLK which is MPU_CLK/2. But now they are clocked by dpll_mpu_m2_ck == MPU_CLK and, as result. Timekeeping core misbehaves. For example, execution of command "sleep 5" will take 10 sec instead of 5.

Quoted 8 lines

Hence, fix it by adding mpu_periphclk ("fixed-factor-clock") and use it for clocking ARM TWD and Global timer (same way as on OMAP4).

Cc Tony Lindgren <[email protected]>
Cc Felipe Balbi <[email protected]>
Cc Tero Kristo <[email protected]>
Fixes commit 8cbd4c2f6a99 ("arm: boot: dts: am4372: add ARM timers and SCU nodes")
Quoted 3 lines

this seems to be the best fix for this problem, yeah.

OK applying into omap-for-v4.4/fixes thanks.

Tony