mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "clocksource-bot for Luca Leonardo Scorcia" <tip-bot2@linutronix.de>
To: linux-kernel@vger.kernel.org
Cc: Luca Leonardo Scorcia <l.scorcia@gmail.com>,
	Daniel Lezcano <daniel.lezcano@kernel.org>,
	daniel.lezcano@oss.qualcomm.com
Subject: [clocksource: timers/drivers/next] clocksource/drivers/timer-mediatek: Request and enable the bus clock
Date: Wed, 14 Oct 2026 20:20:41 -0000	[thread overview]
Message-ID: <179200924156.2666337.1917810470281280243.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20261002072115.169250-4-l.scorcia@gmail.com>

The following commit has been merged into the timers/drivers/next branch of clocksource:

Commit-ID:     e234d40823808c1727e88a40d8c9ee960de1baed
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/daniel.lezcano/linux.git//e234d40823808c1727e88a40d8c9ee960de1baed
Author:        Luca Leonardo Scorcia <l.scorcia@gmail.com>
AuthorDate:    Fri, 02 Oct 2026 09:19:28 +02:00
Committer:     Daniel Lezcano <daniel.lezcano@kernel.org>
CommitterDate: Tue, 13 Oct 2026 13:17:27 +02:00

clocksource/drivers/timer-mediatek: Request and enable the bus clock

MediaTek APXGPT general purpose timers may optionally depend on a bus
clock. If this clock is not enabled the timers don't actually run. Boot
loaders usually turn it on, but later the kernel turns it off since it's
never requested by any driver.

Some platforms (like mt6735) declare it as a critical clock in their
clock definitions to keep it running, but at least on mt8167 it's not
actually required for a successful boot.

If a bus clock is declared in the device tree, make sure it is enabled
by driver probe and associated to the device.

Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org>
Link: https://patch.msgid.link/20261002072115.169250-4-l.scorcia@gmail.com
---
 drivers/clocksource/timer-mediatek.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/clocksource/timer-mediatek.c b/drivers/clocksource/timer-mediatek.c
index a9e7ff6..842d6ee 100644
--- a/drivers/clocksource/timer-mediatek.c
+++ b/drivers/clocksource/timer-mediatek.c
@@ -9,6 +9,7 @@
 
 #define pr_fmt(fmt)	KBUILD_MODNAME ": " fmt
 
+#include <linux/clk.h>
 #include <linux/clockchips.h>
 #include <linux/clocksource.h>
 #include <linux/interrupt.h>
@@ -283,8 +284,9 @@ static struct timer_of to = {
 	},
 };
 
-static int mtk_syst_init(struct device_node *node)
+static int mtk_syst_init(struct platform_device *pdev)
 {
+	struct device_node *node = pdev->dev.of_node;
 	int ret;
 
 	to.clkevt.features = CLOCK_EVT_FEAT_DYNIRQ | CLOCK_EVT_FEAT_ONESHOT;
@@ -305,10 +307,14 @@ static int mtk_syst_init(struct device_node *node)
 	return 0;
 }
 
-static int __init mtk_gpt_init(struct device_node *node)
+static int mtk_gpt_init(struct platform_device *pdev)
 {
+	struct device_node *node = pdev->dev.of_node;
+	struct clk *clk_bus;
 	int ret;
 
+	clk_bus = devm_clk_get_optional_enabled(&pdev->dev, "bus");
+
 	to.clkevt.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT;
 	to.clkevt.set_state_shutdown = mtk_gpt_clkevt_shutdown;
 	to.clkevt.set_state_periodic = mtk_gpt_clkevt_set_periodic;
@@ -344,11 +350,10 @@ static int __init mtk_gpt_init(struct device_node *node)
 
 static int mtk_timer_probe(struct platform_device *pdev)
 {
-	int (*timer_init)(struct device_node *node);
-	struct device_node *np = pdev->dev.of_node;
+	int (*timer_init)(struct platform_device *pdev);
 
 	timer_init = of_device_get_match_data(&pdev->dev);
-	return timer_init(np);
+	return timer_init(pdev);
 }
 
 static const struct of_device_id mtk_timer_match_table[] = {

  reply	other threads:[~2026-10-14 20:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02  7:19 [PATCH 0/3] Convert MediaTek GPT timers to OF probing Luca Leonardo Scorcia
2026-10-02  7:19 ` [PATCH 1/3] clocksource/drivers/timer-mediatek: Fix random crash at boot Luca Leonardo Scorcia
2026-10-14 20:20   ` [clocksource: timers/drivers/next] " clocksource-bot for Luca Leonardo Scorcia
2026-10-02  7:19 ` [PATCH 2/3] clocksource/drivers/timer-mediatek: Convert to OF probing Luca Leonardo Scorcia
2026-10-14 20:20   ` [clocksource: timers/drivers/next] " clocksource-bot for Luca Leonardo Scorcia
2026-11-09  9:50   ` [PATCH 2/3] " Chen-Yu Tsai
2026-10-02  7:19 ` [PATCH 3/3] clocksource/drivers/timer-mediatek: Request and enable the bus clock Luca Leonardo Scorcia
2026-10-14 20:20   ` clocksource-bot for Luca Leonardo Scorcia [this message]
2026-10-02  7:46 ` [PATCH 0/3] Convert MediaTek GPT timers to OF probing Roman Vivchar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179200924156.2666337.1917810470281280243.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=daniel.lezcano@kernel.org \
    --cc=daniel.lezcano@oss.qualcomm.com \
    --cc=l.scorcia@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®