diff mbox series

[RFC,v2,18/30] drivers/clocksource: sh_tmu clocks property support.

Message ID 78b37903cfb2cc64f0f09287a3e075d7dda73260.1694596125.git.ysato@users.sourceforge.jp (mailing list archive)
State New, archived
Headers show
Series Device Tree support for SH7751 based board | expand

Commit Message

Yoshinori Sato Sept. 13, 2023, 9:23 a.m. UTC
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
---
 drivers/clocksource/sh_tmu.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Geert Uytterhoeven Sept. 19, 2023, 12:15 p.m. UTC | #1
Hi Sato-san,

On Wed, Sep 13, 2023 at 11:29 AM Yoshinori Sato
<ysato@users.sourceforge.jp> wrote:
> Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>

> --- a/drivers/clocksource/sh_tmu.c
> +++ b/drivers/clocksource/sh_tmu.c
> @@ -537,6 +537,9 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
>
>         /* Get hold of clock. */
>         tmu->clk = clk_get(&tmu->pdev->dev, "fck");
> +       if (IS_ERR(tmu->clk) && IS_ENABLED(CONFIG_OF) && pdev->dev.of_node)
> +               /* use DeviceTree clocks property */
> +               tmu->clk = devm_clk_get(&tmu->pdev->dev, NULL);

This should not be needed.
I guess this is a workaround for the missing

            clock-names = "fck";

in arch/sh/boot/dts/sh7751.dtsi?

"make dtbs_check
DT_SCHEMA_FILES=Documentation/devicetree/bindings/timer/renesas,tmu.yaml"
would have told you ;-)

    timer@ffd80008: 'clock-names' is a required property

>         if (IS_ERR(tmu->clk)) {
>                 dev_err(&tmu->pdev->dev, "cannot get clock\n");
>                 return PTR_ERR(tmu->clk);

Gr{oetje,eeting}s,

                        Geert
diff mbox series

Patch

diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
index beffff81c00f..878324986f49 100644
--- a/drivers/clocksource/sh_tmu.c
+++ b/drivers/clocksource/sh_tmu.c
@@ -537,6 +537,9 @@  static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
 
 	/* Get hold of clock. */
 	tmu->clk = clk_get(&tmu->pdev->dev, "fck");
+	if (IS_ERR(tmu->clk) && IS_ENABLED(CONFIG_OF) && pdev->dev.of_node)
+		/* use DeviceTree clocks property */
+		tmu->clk = devm_clk_get(&tmu->pdev->dev, NULL);
 	if (IS_ERR(tmu->clk)) {
 		dev_err(&tmu->pdev->dev, "cannot get clock\n");
 		return PTR_ERR(tmu->clk);