Skip to contentSkip to conversation

AM57 timer fixes

PATCH In review Anurag Dutta 3 participants 6 messages Sep 1, 2025 – Nov 4

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 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

Changelog: v1:
1. Modified commit messages and subject according to review comments

Sinthu Raja (2):
bus: ti-sysc: Add DRA7 SoC matching
ARM: dts: ti: omap: 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 v2 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. This tags the system timer as reserved and probes it without probing any interconnected target child devices.

---
 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
#2 lore raw

PATCH v2 2/2 ARM: dts: ti: omap: 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..0e0b5364be2b 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
#3 lore raw
In reply to Anurag Dutta
Quoted 16 lines · Anurag Dutta

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

Changelog: v1:
1. Modified commit messages and subject according to review comments

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

Quoted 10 lines
 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(-)

--
2.34.1

My bot found new DTB warnings on the .dts files added or changed in this series.

Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.

If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:

  pip3 install dtschema --upgrade

This patch series was applied (using b4) to base:
Base: attempting to guess base-commit...
Base: tags/next-20250829 (exact match)

If this is not the correct base, please add 'base-commit' tag (or use b4 which does this automatically)

New warnings running 'make CHECK_DTBS=y for arch/arm/boot/dts/ti/' for [email protected]:

arch/arm/boot/dts/ti/omap/am57xx-beagle-x15.dtb: serial@0 (ti,dra742-uart): {'compatible': ['ti,dra742-uart'], 'reg': [[0, 256]], 'interrupts': [[0, 69, 4]], 'clock-frequency': 48000000, 'status': ['okay'], 'dmas': [[153, 53], [153, 54]], 'dma-names': ['tx', 'rx'], 'interrupts-extended': [[1, 0, 69, 4], [154, 1016]], 'phandle': 390, '$nodename': ['serial@0']} is valid under each of {'required': ['interrupts-extended']}, {'required': ['interrupts']}
from schema $id: http://devicetree.org/schemas/serial/8250_omap.yaml#
arch/arm/boot/dts/ti/omap/am57xx-beagle-x15-revc.dtb: serial@0 (ti,dra742-uart): {'compatible': ['ti,dra742-uart'], 'reg': [[0, 256]], 'interrupts': [[0, 69, 4]], 'clock-frequency': 48000000, 'status': ['okay'], 'dmas': [[153, 53], [153, 54]], 'dma-names': ['tx', 'rx'], 'interrupts-extended': [[1, 0, 69, 4], [154, 1016]], 'phandle': 389, '$nodename': ['serial@0']} is valid under each of {'required': ['interrupts-extended']}, {'required': ['interrupts']}
from schema $id: http://devicetree.org/schemas/serial/8250_omap.yaml#
arch/arm/boot/dts/ti/omap/dra76-evm.dtb: ocmcram@40400000 (mmio-sram): $nodename:0: 'ocmcram@40400000' does not match '^sram(@.*)?'
from schema $id: http://devicetree.org/schemas/sram/sram.yaml#

Tested-by on the v2 series
#4 lore raw
In reply to Anurag Dutta

Tested this series on a Critical Link MitySOM-AM57x board (AM572x / DRA752-GP, 20 MHz SYS_CLK1). With counter_32k disabled and DMTimer 12 registered as the system clocksource via these patches, system clock drift dropped from +553 ppm (counter_32k 32,787Hz instead of 32,768Hz) to +2 ppm over a 50.8 h measurement window

/sys/devices/system/clocksource/clocksource0/available_clocksource:
dmtimer

Note: to make the fix apply to non-beagle-x15 DRA7/AM57 boards, I moved the &timer12_target and &counter32k overrides from am57xx-beagle-x15.dts into dra7.dtsi. Worth considering for v3 so other boards (MitySOM, am57xx-idk, AM572x-EVM, etc.) pick up the fix automatically rather than each needing the same per-board override.

Thanks,
Jonathan

#5 lore raw
Quoted 10 lines · Jonathan Cormier

Tested this series on a Critical Link MitySOM-AM57x board (AM572x / DRA752-GP, 20 MHz SYS_CLK1). With counter_32k disabled and DMTimer 12 registered as the system clocksource via these patches, system clock drift dropped from +553 ppm (counter_32k 32,787Hz instead of 32,768Hz) to +2 ppm over a 50.8 h measurement window

/sys/devices/system/clocksource/clocksource0/available_clocksource:
dmtimer

Quoted 7 lines

Note: to make the fix apply to non-beagle-x15 DRA7/AM57 boards, I moved the &timer12_target and &counter32k overrides from am57xx-beagle-x15.dts into dra7.dtsi. Worth considering for v3 so other boards (MitySOM, am57xx-idk, AM572x-EVM, etc.) pick up the fix automatically rather than each needing the same per-board override.

Conflict, dmtimer12 is used by the secure software on the secure boot processors...

Quoted 3 lines

Thanks,
Jonathan

Signature · 7 lines
Jonathan Cormier
Senior Software Engineer

Office:  315.425.4045 x222

http://www.CriticalLink.com
6712 Brooklawn Parkway, Syracuse, NY 13211