Linux-RTC Archive on
 help / color / Atom feed
* [PATCH 4.9 062/128] clocksource: dw_apb_timer_of: Fix missing clockevent timers
       [not found] <>
@ 2020-06-19 14:32 ` Greg Kroah-Hartman
  0 siblings, 0 replies; only message in thread
From: Greg Kroah-Hartman @ 2020-06-19 14:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, stable, Serge Semin, Alexey Malahov,
	Thomas Bogendoerfer, Paul Burton, Ralf Baechle, Alessandro Zummo,
	Alexandre Belloni, Arnd Bergmann, Rob Herring, linux-mips,
	linux-rtc, devicetree, Daniel Lezcano, Sasha Levin

From: Serge Semin <>

[ Upstream commit 6d2e16a3181bafb77b535095c39ad1c8b9558c8c ]

Commit 100214889973 ("clocksource: dw_apb_timer_of: use
clocksource_of_init") replaced a publicly available driver
initialization method with one called by the timer_probe() method
available after CLKSRC_OF. In current implementation it traverses
all the timers available in the system and calls their initialization
methods if corresponding devices were either in dtb or in acpi. But
if before the commit any number of available timers would be installed
as clockevent and clocksource devices, after that there would be at most
two. The rest are just ignored since default case branch doesn't do
anything. I don't see a reason of such behaviour, neither the commit
message explains it. Moreover this might be wrong if on some platforms
these timers might be used for different purpose, as virtually CPU-local
clockevent timers and as an independent broadcast timer. So in order
to keep the compatibility with the platforms where the order of the
timers detection has some meaning, lets add the secondly discovered
timer to be of clocksource/sched_clock type, while the very first and
the others would provide the clockevents service.

Fixes: 100214889973 ("clocksource: dw_apb_timer_of: use clocksource_of_init")
Signed-off-by: Serge Semin <>
Cc: Alexey Malahov <>
Cc: Thomas Bogendoerfer <>
Cc: Paul Burton <>
Cc: Ralf Baechle <>
Cc: Alessandro Zummo <>
Cc: Alexandre Belloni <>
Cc: Arnd Bergmann <>
Cc: Rob Herring <>
Signed-off-by: Daniel Lezcano <>
Signed-off-by: Sasha Levin <>
 drivers/clocksource/dw_apb_timer_of.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
index aee6c0d39a7c..024e6cc5025b 100644
--- a/drivers/clocksource/dw_apb_timer_of.c
+++ b/drivers/clocksource/dw_apb_timer_of.c
@@ -146,10 +146,6 @@ static int num_called;
 static int __init dw_apb_timer_init(struct device_node *timer)
 	switch (num_called) {
-	case 0:
-		pr_debug("%s: found clockevent timer\n", __func__);
-		add_clockevent(timer);
-		break;
 	case 1:
 		pr_debug("%s: found clocksource timer\n", __func__);
@@ -160,6 +156,8 @@ static int __init dw_apb_timer_init(struct device_node *timer)
+		pr_debug("%s: found clockevent timer\n", __func__);
+		add_clockevent(timer);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <>
2020-06-19 14:32 ` [PATCH 4.9 062/128] clocksource: dw_apb_timer_of: Fix missing clockevent timers Greg Kroah-Hartman

Linux-RTC Archive on

Archives are clonable:
	git clone --mirror linux-rtc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rtc linux-rtc/ \
	public-inbox-index linux-rtc

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone