From: mturquette@linaro.org (Mike Turquette)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/7] cpufreq: cpufreq-cpu0: allow optional safe voltage during frequency transitions
Date: Fri, 31 Jan 2014 20:10:51 -0800 [thread overview]
Message-ID: <20140201041051.9977.46568@quantum> (raw)
In-Reply-To: <2009408.gnUEcoqA3p@phil>
Quoting Heiko St?bner (2014-01-30 07:09:04)
> On Thursday, 30. January 2014 18:23:44 Thomas Abraham wrote:
> > Hi Mike,
> >
> > On Wed, Jan 29, 2014 at 12:17 AM, Mike Turquette <mturquette@linaro.org>
> wrote:
> > > On Mon, Jan 27, 2014 at 9:30 PM, Thomas Abraham <ta.omasab@gmail.com>
> wrote:
> > >> Hi Mike,
> > >>
> > >> On Tue, Jan 28, 2014 at 1:55 AM, Mike Turquette <mturquette@linaro.org>
> wrote:
> > >>> Quoting Thomas Abraham (2014-01-18 04:10:51)
> > >>>
> > > As far as I can tell
> > > the remux does not happen because it is necessary to generate the
> > > required clock rate, but because we don't want to run the ARM core out
> > > of spec for a short time while the PLL relocks. Assuming I have that
> > > part of it right, I prefer for the parent mux operation to be a part
> > > of the CPUfreq driver's .target callback instead of hidden away in the
> > > clock driver.
> >
> > The re-parenting is mostly done to keep the ARM CPU clocked while the
> > PLL is stopped, reprogrammed and restarted. One of the side effects of
> > that is, the clock speed of the temporary parent could be higher then
> > what is allowed due to the ARM voltage at the time of re-parenting.
> > That is the reason to use the safe voltage.
>
> The Rockchip-SoCs use something similar, so I'm following quite closely what
> Thomas is trying to do here, as similar solution would also solve this issue
> for me.
>
> On some Rockchip-SoCs even stuff like pclk and hclk seems to be sourced from
> the divided armclk, creating additional constraints.
>
> But on the RKs (at least in the upstream sources) the armclk is simply equal
> to the pll output. A divider exists, but is only used to make sure that the
> armclk stays below the original rate when sourced from the temp-parent, like
>
> if (clk_get_rate(temp_parent) > clk_get_rate(main_parent)
> set_divider(something so that rate(temp) <= rate(main)
> clk_set_parent(...)
>
> Isn't there a similar possiblity on your platform, as it would remove the need
> for the safe-voltage?
>
>
> In general I also like the approach of hiding the rate-change logic inside
> this composite clock, as the depending clocks can be easily kept in sync. As
> with the Rockchips the depending clocks are different for each of the three
> Cortex-A9 SoCs I looked at, it would be "interesting" if all of this would
> need to be done in a cpufreq driver.
I wonder if hiding these details inside of the composite clock
implementation indicates the lack of some needed feature in the clk
core? I've discussed the idea of "coordinated rate changes" before. E.g:
_________________________________________________________
| clk | opp-low | opp-mid | opp-fast |
| | | | |
|pll | 300000 | 600000 | 600000 |
| | | | |
|div | 150000 | 300000 | 600000 |
| | | | |
|mpu_clk| 150000 | 300000 | 600000 |
| | | | |
|periph | 150000 | 150000 | 300000 |
---------------------------------------------------------
A call to clk_set_rate() against any of those clocks will result in all
of their dividers being updated. At the implementation level this might
look something like this extremely simplified pseudocode:
int clk_set_rate(struct clk* clk, unsigned long rate)
{
/* trap clks that support coordinated rate changes */
if (clk->ops->coordinate_rate)
return clk->ops->coordinate_rate(clk->hw, rate);
...
}
and,
struct coord_rates {
struct clk_hw *hw;
struct clk *parent;
struct clk *rate;
};
and in the clock driver,
#define PLL 0
#define DIV 1
#define MPU 2
#define PER 3
#define NR_OPP 4
#define NR_CLK 4
struct coord_rates my_opps[NR_OPP][NR_CLK]; // populated from DT data
int my_coordinate_rate_callback(struct clk_hw *hw, unsigned long rate)
{
struct coord_rate **selected_opp;
for(i = 0; i < NR_OPP; i++) {
for(j = 0; j < NR_CLK; j++) {
if (my_opps[i][j]->hw == hw &&
my_opps[i][j]->rate == rate)
selected_opp = my_opps[i];
break;
}
}
/*
* order of operations is specific to my hardware and should be
* managed by my clock driver, not generic code
*/
__clk_set_parent(selected_opp[DIV]->hw, temp_parent);
__clk_set_rate(selected_opp[PLL]->hw, selected_opp[PLL]->rate);
__clk_set_parent(selected_opp[DIV]->hw,
selected_opp[PLL]->hw->clk);
...
/*
* note that the above could be handled by a switch-case or
* something else
*/
}
Thoughts? Please forgive any gaps in my logic or abuse of C.
I have long thought that something like the above would someday go into
a generic dvfs layer instead of the clock framework, but maybe starting
with the clk framework makes more sense?
Regards,
Mike
>
>
> Heiko
>
next prev parent reply other threads:[~2014-02-01 4:10 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-18 12:10 [PATCH v2 0/7] cpufreq: use cpufreq-cpu0 driver for exynos based platforms Thomas Abraham
2014-01-18 12:10 ` [PATCH v2 1/7] cpufreq: cpufreq-cpu0: allow optional safe voltage during frequency transitions Thomas Abraham
2014-01-20 8:09 ` Lukasz Majewski
2014-01-27 7:16 ` Shawn Guo
2014-01-28 4:30 ` Thomas Abraham
2014-01-27 20:25 ` Mike Turquette
2014-01-28 5:30 ` Thomas Abraham
2014-01-28 8:17 ` Lukasz Majewski
2014-01-28 11:36 ` Thomas Abraham
2014-01-28 15:06 ` Lukasz Majewski
2014-01-28 15:15 ` Thomas Abraham
2014-01-28 11:49 ` Shawn Guo
2014-01-28 12:47 ` Thomas Abraham
2014-01-28 18:47 ` Mike Turquette
2014-01-30 12:53 ` Thomas Abraham
2014-01-30 15:09 ` Heiko Stübner
2014-02-01 4:10 ` Mike Turquette [this message]
2014-02-03 16:06 ` Thomas Abraham
2014-02-05 9:53 ` Heiko Stübner
2014-02-03 16:06 ` Thomas Abraham
2014-01-18 12:10 ` [PATCH v2 2/7] clk: samsung: add infrastructure to register cpu clocks Thomas Abraham
2014-01-20 8:24 ` Lukasz Majewski
2014-01-21 8:35 ` Thomas Abraham
2014-01-21 10:25 ` Lukasz Majewski
2014-01-21 10:38 ` Thomas Abraham
2014-01-21 10:59 ` Lukasz Majewski
2014-01-18 12:10 ` [PATCH v2 3/7] devicetree: bindings: add cpu clock configuration data binding for Exynos4/5 Thomas Abraham
2014-01-18 15:22 ` Rob Herring
2014-01-21 7:31 ` Thomas Abraham
2014-01-24 15:24 ` Thomas Abraham
2014-01-18 12:10 ` [PATCH v2 4/7] ARM: dts: Exynos: add cpu nodes, opp and cpu clock frequency table Thomas Abraham
2014-01-20 7:32 ` Lukasz Majewski
2014-01-21 7:33 ` Thomas Abraham
2014-01-18 12:10 ` [PATCH v2 5/7] clk: exynos: use cpu-clock provider type to represent arm clock Thomas Abraham
2014-01-20 7:47 ` Lukasz Majewski
2014-01-21 7:52 ` Thomas Abraham
2014-01-21 10:38 ` Lukasz Majewski
2014-01-21 11:15 ` Thomas Abraham
2014-01-21 11:42 ` Lukasz Majewski
2014-01-18 12:10 ` [PATCH v2 6/7] ARM: Exynos: switch to using generic cpufreq-cpu0 driver Thomas Abraham
2014-01-20 7:48 ` Lukasz Majewski
2014-01-18 12:10 ` [PATCH v2 7/7] cpufreq: exynos: remove all exynos specific cpufreq driver support Thomas Abraham
2014-01-20 8:08 ` Lukasz Majewski
2014-01-21 8:08 ` Thomas Abraham
2014-01-21 8:27 ` Lukasz Majewski
2014-02-05 10:21 ` Thomas Abraham
2014-02-05 11:44 ` Lukasz Majewski
2014-02-05 12:43 ` Thomas Abraham
2014-02-05 13:15 ` Lukasz Majewski
2014-02-05 13:36 ` Nishanth Menon
2014-02-05 13:49 ` Lukasz Majewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140201041051.9977.46568@quantum \
--to=mturquette@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).