[clocksource: timers/drivers/next] clocksource/drivers/timer-ti-dm: Register clocksource/event only for am654

clocksource-bot for Markus Schneider-Pargmann (TI) posted 1 patch 1 day, 3 hours ago
drivers/clocksource/timer-ti-dm.c          | 4 +++-
include/linux/platform_data/dmtimer-omap.h | 2 ++
2 files changed, 5 insertions(+), 1 deletion(-)
[clocksource: timers/drivers/next] clocksource/drivers/timer-ti-dm: Register clocksource/event only for am654
Posted by clocksource-bot for Markus Schneider-Pargmann (TI) 1 day, 3 hours ago
The following commit has been merged into the timers/drivers/next branch of clocksource:

Commit-ID:     0d3a67b1954a3988fef20ba7641d33e6085ad313
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/daniel.lezcano/linux.git//0d3a67b1954a3988fef20ba7641d33e6085ad313
Author:        Markus Schneider-Pargmann (TI) <msp@baylibre.com>
AuthorDate:    Fri, 28 Aug 2026 20:47:45 +02:00
Committer:     Daniel Lezcano <daniel.lezcano@kernel.org>
CommitterDate: Fri, 02 Oct 2026 12:03:36 +02:00

clocksource/drivers/timer-ti-dm: Register clocksource/event only for am654

Registering clocksource/clockevent for the older platforms breaks
booting them. The older platforms have their own implementation in early
boot that is used to register clocksource/clockevent in
timer-ti-dm-systimer.c.

With am654, the timer is much more complex with more dependencies so
doing this in early boot with the other driver is very difficult and
gets ugly. Instead it is implemented in the platform driver for am654.
However the old platforms may not register clocksource/clockevent in
this driver as that would break the boot.

Add a system_timer_capable flag that is only set for am654-timer that
gates the clocksource/clockevent registration.

Reported-by: H. Nikolaus Schaller <hns@goldelico.com>
Closes: https://lore.kernel.org/r/2013A99A-0502-4128-ACFA-B04886224393@goldelico.com
Fixes: b8eeeca55456 ("clocksource/drivers/timer-ti-dm: Add clocksource support")
Signed-off-by: Markus Schneider-Pargmann (TI) <msp@baylibre.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org>
Tested-by: Andreas Kemnade <andreas@kemnade.info> # OMAP3 GTA04
Tested-by: Kevin Hilman <khilman@baylibre.com> # OMAP3 Beagle XM
Tested-by: H. Nikolaus Schaller <hns@goldelico.com> # OMAP3 OpenPandora
Link: https://patch.msgid.link/20260828-v7-3-next-topic-ti-timer-dm-clocksource-omap-fix-v1-1-85f0e4dc6f9f@baylibre.com
---
 drivers/clocksource/timer-ti-dm.c          | 4 +++-
 include/linux/platform_data/dmtimer-omap.h | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-ti-dm.c b/drivers/clocksource/timer-ti-dm.c
index 6787aca..ae8777d 100644
--- a/drivers/clocksource/timer-ti-dm.c
+++ b/drivers/clocksource/timer-ti-dm.c
@@ -1475,7 +1475,8 @@ static int omap_dm_timer_probe(struct platform_device *pdev)
 
 	timer->pdev = pdev;
 
-	if (timer->capability & OMAP_TIMER_ALWON && !IS_ERR_OR_NULL(timer->fclk)) {
+	if (pdata->system_timer_capable &&
+	    timer->capability & OMAP_TIMER_ALWON && !IS_ERR_OR_NULL(timer->fclk)) {
 		if (!omap_dm_timer_sched_clock_counter) {
 			ret = omap_dm_timer_setup_clocksource(timer);
 			if (ret)
@@ -1585,6 +1586,7 @@ static const struct dmtimer_platform_data omap3plus_pdata = {
 
 static const struct dmtimer_platform_data am6_pdata = {
 	.timer_ops = &dmtimer_ops,
+	.system_timer_capable = true,
 };
 
 static const struct of_device_id omap_timer_match[] = {
diff --git a/include/linux/platform_data/dmtimer-omap.h b/include/linux/platform_data/dmtimer-omap.h
index 726d891..b78ee46 100644
--- a/include/linux/platform_data/dmtimer-omap.h
+++ b/include/linux/platform_data/dmtimer-omap.h
@@ -57,6 +57,8 @@ struct dmtimer_platform_data {
 	u32 timer_errata;
 	int (*get_context_loss_count)(struct device *);
 	const struct omap_dm_timer_ops *timer_ops;
+	/* always-on timers can be used for clocksource/clockevent */
+	bool system_timer_capable;
 };
 
 #endif /* __PLATFORM_DATA_DMTIMER_OMAP_H__ */