Re: [PATCH V3 2/2] clk: imx: scu: add cpu frequency scaling support

From: Stephen Boyd
Date: Wed Feb 13 2019 - 12:43:00 EST


Quoting Anson Huang (2019-02-13 07:59:32)
> @@ -145,6 +161,39 @@ static long clk_scu_round_rate(struct clk_hw *hw, unsigned long rate,
> return rate;
> }
>
> +static bool clk_scu_atf_set_cpu_rate(struct clk_hw *hw, unsigned long rate)
> +{
> + struct clk_scu *clk = to_clk_scu(hw);
> + struct arm_smccc_res res;
> + unsigned int cluster_id;
> + int i;
> +
> + /* CPU frequency scaling can ONLY be done by ARM-Trusted-Firmware */
> + if (clk->clk_type == IMX_SC_PM_CLK_CPU) {
> + for (i = 0; i < ARRAY_SIZE(imx_sc_cpufreq_data); i++) {
> + if (!strcmp(clk_hw_get_name(hw),
> + imx_sc_cpufreq_data[i].clk_name)) {
> + cluster_id = imx_sc_cpufreq_data[i].cluster_id;
> + break;
> + }
> + }

Is there some reason why these clks can't be determined once at boot
time? It would be a good idea to avoid doing any sort of string
comparison here, instead just calling the right arm_smccc_smc with the
right arguments based on code that registers those types of clks.