lkml.org 
[lkml]   [2019]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH V3 2/2] clk: imx: scu: add cpu frequency scaling support
Date


Best Regards!
Anson Huang

> -----Original Message-----
> From: Stephen Boyd [mailto:sboyd@kernel.org]
> Sent: 2019年2月14日 1:43
> To: devicetree@vger.kernel.org; festevam@gmail.com;
> kernel@pengutronix.de; linux-arm-kernel@lists.infradead.org; linux-
> clk@vger.kernel.org; linux-kernel@vger.kernel.org; mark.rutland@arm.com;
> mturquette@baylibre.com; robh+dt@kernel.org; s.hauer@pengutronix.de;
> shawnguo@kernel.org; viresh.kumar@linaro.org; Aisheng Dong
> <aisheng.dong@nxp.com>; Anson Huang <anson.huang@nxp.com>; Daniel
> Baluta <daniel.baluta@nxp.com>
> Cc: dl-linux-imx <linux-imx@nxp.com>
> 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.

\
 
 \ /
  Last update: 2019-02-14 02:59    [W:0.262 / U:0.796 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site