Skip to contentSkip to conversation

AM57 timer fixes

PATCH Superseded Anurag Dutta 2 participants 5 messages Aug 29, 2025

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover AM57 timer fixes

Hi all
This series introduces a couple of fixes for the am57 board viz.
1. Add DRA7 SoC matching to avoid probe failures for timers
2. Use DMtimer as clocksource to avoid using 32k counter due to incorrect frequency.

logs:
https://gist.github.com/anuragdutta731/9366b4e582f7adb86e40ede1add1c79c

Sinthu Raja (2):
bus: ti-sysc: Add DRA7 SoC matching
arm: dts: Use DMTimer as Clocksource instead of counter_32k

 arch/arm/boot/dts/ti/omap/am57xx-beagle-x15.dts | 9 +++++++++
 arch/arm/boot/dts/ti/omap/dra7-l4.dtsi          | 2 +-
 drivers/bus/ti-sysc.c                           | 3 ++-
 3 files changed, 12 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 bus: ti-sysc: Add DRA7 SoC matching

From: Sinthu Raja <[email protected]>

Kernel Commit 25de4ce5ed02 ("clocksource/drivers/timer-ti-dm: Handle dra7 timer wrap errata i940") states that "There is a timer wrap issue on dra7 and as a work around, we need to use timer-ti-dm percpu timers instead. So, configure dmtimer3 and 4 as percpu timers by default." In this commit, the author has used ti,no-reset-on-init and ti,no-idle quirks.

The sysc_check_active_timer() checks for these quirks and accordingly, returns EBUSY error if the quirks match. Because of this, the timer modules fail to probe as can be observed during bootup :"ti-sysc 4882c000.target-module: probe with driver ti-sysc failed with error -16"

Return 'ENXIO' instead of 'EBUSY' for DRA7 SoC, so that the error is set to ENXIO and the module gets probed under "certain conditions".

---
 drivers/bus/ti-sysc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bus/ti-sysc.c +2 -1
index 5566ad11399e..90766f804706 100644
@@ -3117,7 +3117,8 @@ static int sysc_check_active_timer(struct sysc *ddata)
 	 * can be dropped if we stop supporting old beagleboard revisions
 	 * A to B4 at some point.
 	 */
-	if (sysc_soc->soc == SOC_3430 || sysc_soc->soc == SOC_AM35)
+	if (sysc_soc->soc == SOC_3430 || sysc_soc->soc == SOC_AM35 ||
+					 sysc_soc->soc == SOC_DRA7)
 		error = -ENXIO;
 	else
 		error = -EBUSY;
Signature · 1 line
2.34.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] bus: ti-sysc: Add DRA7 SoC matching

Quoted 8 lines · Anurag Dutta

From: Sinthu Raja <[email protected]>

Kernel Commit 25de4ce5ed02 ("clocksource/drivers/timer-ti-dm: Handle dra7 timer wrap errata i940") states that "There is a timer wrap issue on dra7 and as a work around, we need to use timer-ti-dm percpu timers instead. So, configure dmtimer3 and 4 as percpu timers by default." In this commit, the author has used ti,no-reset-on-init and ti,no-idle quirks.

Quoted 7 lines

The sysc_check_active_timer() checks for these quirks and accordingly, returns EBUSY error if the quirks match. Because of this, the timer modules fail to probe as can be observed during bootup :"ti-sysc 4882c000.target-module: probe with driver ti-sysc failed with error -16"

Return 'ENXIO' instead of 'EBUSY' for DRA7 SoC, so that the error is set to ENXIO and the module gets probed under "certain conditions".

Please define, what are "certain conditions".

With addition of conditions in commit message, for this patch

Quoted 21 lines
---
  drivers/bus/ti-sysc.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bus/ti-sysc.c +2 -1
index 5566ad11399e..90766f804706 100644
@@ -3117,7 +3117,8 @@ static int sysc_check_active_timer(struct sysc *ddata)
  	 * can be dropped if we stop supporting old beagleboard revisions
  	 * A to B4 at some point.
  	 */
-	if (sysc_soc->soc == SOC_3430 || sysc_soc->soc == SOC_AM35)
+	if (sysc_soc->soc == SOC_3430 || sysc_soc->soc == SOC_AM35 ||
+					 sysc_soc->soc == SOC_DRA7)
  		error = -ENXIO;
  	else
  		error = -EBUSY;
#3 lore raw

PATCH 2/2 arm: dts: Use DMTimer as Clocksource instead of counter_32k

In reply to Anurag Dutta

From: Sinthu Raja <[email protected]>

Clock drift of approximately 500 ppm is observed with 'counter_32k' as clocksource. Clock drift is seen because 'counter_32k' is running with 32786Hz frequency instead it should run with 32768Hz. Use DMTimer as clocksource, which is running at 32768Hz to fix the clock drift issue.

---
 arch/arm/boot/dts/ti/omap/am57xx-beagle-x15.dts | 9 +++++++++
 arch/arm/boot/dts/ti/omap/dra7-l4.dtsi          | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)
arch/arm/boot/dts/ti/omap/am57xx-beagle-x15.dts +9 -0
index 0a8b16505ed9..83009883277e 100644
@@ -36,3 +36,12 @@ &mmc2 {
 &phy1 {
 	max-speed = <100>;
 };
+
+&timer12_target {
+	ti,no-reset-on-init;
+	ti,no-idle;
+};
+
+&counter32k {
+	status = "disabled";
+};
arch/arm/boot/dts/ti/omap/dra7-l4.dtsi +1 -1
index ba7fdaae9c6e..a6ac4fd43b54 100644
@@ -4439,7 +4439,7 @@ segment@20000 {					/* 0x4ae20000 */
 			 <0x0000c000 0x0002c000 0x001000>,	/* ap 29 */
 			 <0x0000f000 0x0002f000 0x001000>;	/* ap 32 */
 
-		target-module@0 {			/* 0x4ae20000, ap 19 08.0 */
+		timer12_target: target-module@0 {			/* 0x4ae20000, ap 19 08.0 */
 			compatible = "ti,sysc-omap4-timer", "ti,sysc";
 			reg = <0x0 0x4>,
 			      <0x10 0x4>;
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH 2/2] arm: dts: Use DMTimer as Clocksource instead of counter_32k

Quoted 1 line · Anurag Dutta

From: Sinthu Raja <[email protected]>

Please check subject of patch

Quoted 34 lines

Clock drift of approximately 500 ppm is observed with 'counter_32k' as clocksource. Clock drift is seen because 'counter_32k' is running with 32786Hz frequency instead it should run with 32768Hz. Use DMTimer as clocksource, which is running at 32768Hz to fix the clock drift issue.

---
  arch/arm/boot/dts/ti/omap/am57xx-beagle-x15.dts | 9 +++++++++
  arch/arm/boot/dts/ti/omap/dra7-l4.dtsi          | 2 +-
  2 files changed, 10 insertions(+), 1 deletion(-)
arch/arm/boot/dts/ti/omap/am57xx-beagle-x15.dts +9 -0
index 0a8b16505ed9..83009883277e 100644
@@ -36,3 +36,12 @@ &mmc2 {
  &phy1 {
  	max-speed = <100>;
  };
+
+&timer12_target {
+	ti,no-reset-on-init;
+	ti,no-idle;
+};
+
+&counter32k {
+	status = "disabled";
+};
arch/arm/boot/dts/ti/omap/dra7-l4.dtsi +0 -0
index ba7fdaae9c6e..a6ac4fd43b54 100644

arch/arm/boot/dts/ti/omap/dra7-l4.dtsi segment@20000 { /* 0x4ae20000 */ · line 4442

Quoted 5 lines
arch/arm/boot/dts/ti/omap/dra7-l4.dtsi +1 -1
@@ -4439,7 +4439,7 @@ segment@20000 {					/* 0x4ae20000 */
  			 <0x0000c000 0x0002c000 0x001000>,	/* ap 29 */
  			 <0x0000f000 0x0002f000 0x001000>;	/* ap 32 */
 
-		target-module@0 {			/* 0x4ae20000, ap 19 08.0 */
+		timer12_target: target-module@0 {			/* 0x4ae20000, ap 19 08.0 */

you can reduce tab between { and comments

Quoted 3 lines
arch/arm/boot/dts/ti/omap/dra7-l4.dtsi +0 -0
  			compatible = "ti,sysc-omap4-timer", "ti,sysc";
  			reg = <0x0 0x4>,
  			      <0x10 0x4>;