Re: [PATCH] sh: sh7305: add TMU0 module clock gate

From: Geert Uytterhoeven

Date: Fri Oct 30 2026 - 07:17:43 EST


Hi Artem,

On Thu, 22 Oct 2026 at 07:10, Artem Novak <artem122novak@xxxxxxxxx> wrote:
> 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@xxxxxxxxx>

Thanks for your patch!

> --- a/arch/sh/kernel/cpu/clock-cpg.c
> +++ b/arch/sh/kernel/cpu/clock-cpg.c

This file is only compiled if CONFIG_SH_CLK_CPG_LEGACY=y.
Probably you should not use it for new SoC support.
E.g. the similar sh7724 has:
arch/sh/kernel/cpu/sh4a/clock-sh7724.c: CLKDEV_ICK_ID("fck",
"sh-tmu.0", &mstp_clks[HWBLK_TMU0]),

> @@ -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

... and thus there is no need to sprinkle #ifdefs in this file.

> 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);

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds