Re: [PATCH v3] clk: starfive: jh7100: Use clk_hw for external input clocks

From: Stephen Boyd
Date: Sun Apr 07 2024 - 22:45:09 EST


Quoting Geert Uytterhoeven (2024-03-29 05:16:58)
> The Starfive JH7100 clock driver does not use the DT "clocks" property
> to find the external main input clock, but instead relies on the name of
> the actual clock provider ("osc_sys"). This is fragile, and caused
> breakage when sanitizing clock node names in DTS.
>
> Fix this by obtaining the external main input clock using
> devm_clk_get(), and passing the returned clk_hw object to
> devm_clk_hw_register_fixed_factor_parent_hw().
>
> While name-based look-up of the other external input clocks works as-is,
> convert them to a similar clk_hw-based scheme to increase uniformity,
> and to decrease the number of (multiple identical) name-based look-ups.

Why can't we use index based lookups and clk_parent_data? We don't want
clk providers to call clk consumer APIs.

>
> Fixes: f03606470886 ("riscv: dts: starfive: replace underscores in node names")
> Fixes: 4210be668a09ee20 ("clk: starfive: Add JH7100 clock generator driver")
> Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
> Reviewed-by: Samuel Holland <samuel.holland@xxxxxxxxxx>
> ---
> After this is applied, the workaround in commit 7921e231f85a349d
> ("riscv: dts: starfive: jh7100: fix root clock names") can be reverted.
>