mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sh: sh7305: add TMU0 module clock gate
@ 2026-10-22  5:10 Artem Novak
  2026-10-30 10:56 ` Geert Uytterhoeven
  0 siblings, 1 reply; 2+ messages in thread
From: Artem Novak @ 2026-10-22  5:10 UTC (permalink / raw)
  To: glaubitz, dalias; +Cc: linux-sh, linux-kernel, Artem Novak

Register the SH7305 TMU0 module-stop clock using MSTPCR0 bit 15.

Provide the fck clock lookup for the sh-tmu.0 platform device.

Signed-off-by: Artem Novak <artem122novak@gmail.com>
---
 arch/sh/kernel/cpu/clock-cpg.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/arch/sh/kernel/cpu/clock-cpg.c b/arch/sh/kernel/cpu/clock-cpg.c
index 5b75a384cbf3..5a1f1479416b 100644
--- a/arch/sh/kernel/cpu/clock-cpg.c
+++ b/arch/sh/kernel/cpu/clock-cpg.c
@@ -16,6 +16,20 @@ static struct clk peripheral_clk = {
 	.flags		= CLK_ENABLE_ON_INIT,
 };
 
+#ifdef CONFIG_CPU_SUBTYPE_SH7305
+/*
+ * SH7305 TMU0 module clock.
+ *
+ * MSTPCR0 bit 15 gates the peripheral clock to TMU0.
+ * Early platform initialization enables the gate before timer setup.
+ */
+static struct clk sh7305_tmu0_clk =
+	SH_CLK_MSTP32(&peripheral_clk, 0xa4150030, 15, 0);
+
+static struct clk_lookup sh7305_tmu0_lookup =
+	CLKDEV_ICK_ID("fck", "sh-tmu.0", &sh7305_tmu0_clk);
+#endif
+
 static struct clk bus_clk = {
 	.parent		= &master_clk,
 	.flags		= CLK_ENABLE_ON_INIT,
@@ -58,7 +72,15 @@ int __init __deprecated cpg_clk_init(void)
 	clkdev_add_table(lookups, ARRAY_SIZE(lookups));
 
 	clk_add_alias("fck", "sh-tmu-sh3.0", "peripheral_clk", NULL);
+#ifdef CONFIG_CPU_SUBTYPE_SH7305
+	if (!ret) {
+		ret = sh_clk_mstp_register(&sh7305_tmu0_clk, 1);
+		if (!ret)
+			clkdev_add(&sh7305_tmu0_lookup);
+	}
+#else
 	clk_add_alias("fck", "sh-tmu.0", "peripheral_clk", NULL);
+#endif
 	clk_add_alias("fck", "sh-tmu.1", "peripheral_clk", NULL);
 	clk_add_alias("fck", "sh-tmu.2", "peripheral_clk", NULL);
 	clk_add_alias("fck", "sh-mtu2", "peripheral_clk", NULL);
-- 
2.56.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-30 10:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-22  5:10 [PATCH] sh: sh7305: add TMU0 module clock gate Artem Novak
2026-10-30 10:56 ` Geert Uytterhoeven

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®