Best Regards! Anson Huang > -----Original Message----- > From: Stephen Boyd [mailto:sboyd@xxxxxxxxxx] > Sent: 2019年2月14日 1:43 > To: devicetree@xxxxxxxxxxxxxxx; festevam@xxxxxxxxx; > kernel@xxxxxxxxxxxxxx; linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; linux- > clk@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; mark.rutland@xxxxxxx; > mturquette@xxxxxxxxxxxx; robh+dt@xxxxxxxxxx; s.hauer@xxxxxxxxxxxxxx; > shawnguo@xxxxxxxxxx; viresh.kumar@xxxxxxxxxx; Aisheng Dong > <aisheng.dong@xxxxxxx>; Anson Huang <anson.huang@xxxxxxx>; Daniel > Baluta <daniel.baluta@xxxxxxx> > Cc: dl-linux-imx <linux-imx@xxxxxxx> > Subject: Re: [PATCH V3 2/2] clk: imx: scu: add cpu frequency scaling support > > 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. Agree, I can avoid string comparison in runtime, in V4 patch I just sent, I add another clk ops for CPU clock, and use resource ID to determine the CPU clk ops and cluster id, thus we can save the runtime check and string comparison. Thanks, Anson.