From: jbrunet@baylibre.com (Jerome Brunet)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH 17/19] clk: meson: rework meson8b cpu clock
Date: Mon, 05 Feb 2018 10:49:56 +0100 [thread overview]
Message-ID: <1517824196.3153.41.camel@baylibre.com> (raw)
In-Reply-To: <CAFBinCCpfpJQVkKvuBgS5T_AB+LNC3xXMCAUVYy38h=0Ge39Sg@mail.gmail.com>
On Sat, 2018-02-03 at 19:46 +0100, Martin Blumenstingl wrote:
> Hi Jerome,
>
> On Wed, Jan 31, 2018 at 7:09 PM, Jerome Brunet <jbrunet@baylibre.com> wrote:
> > Instead of migrating meson cpu_clk to clk_regmap, like the other meson
> > clock drivers, we take advantage of the massive rework to get rid of it
> > completely, and solve (the first part) of the related FIXME notice.
> >
> > As pointed out in the code comments, the cpu_clk should be modeled with
> > dividers and muxes it is made of, instead of one big composite clock.
> >
> > The other issue pointed out in the FIXME note, around cpu notifier,
> > remains unsolved, until CCR comes up.
> >
> > AFAIK, the cpu_clk was not working correctly to enable dvfs on meson8b.
> > This change being just a re-implementation, hopefully cleaner, of the
> > cpu_clk, the problem remains unsolved as well.
>
> I can confirm that I have seen system lock-ups when using the cpu_clk
> implementation
> your patch doesn't fully solve this (I still get some lock-ups), but I
> still think it's a step forward!
>
> > Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
>
> I have some minor comments below, with these addressed:
> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Thanks for reviewing this Martin.
I happy that changing the implementation of the cpu clock improve the situation.
However, thinking about it, I'm not really confortable upstreaming something
that we know is not stable yet, especially when it comes to the cpu clock.
To start, and until when get a stable solution, I would prefer to put the whole
thing in read-only mode, and removing the notifier. The RW WIP is available here
on the ML, so nothing is lost.
As a second step to progress on getting this clock stable, we could try to keep
in the PLL Read-Only, but have the dividers in RW w/o a notifier : The goal
would be to determine if we need to park the clock on xtal while changing the
dividers. If we do, the notifier should probably be on SCALE_OUT_SEL instead of
SYS_PLL.
This should already allow to adjust the clock quite lot, maybe it would be an
interesting first step for a working dvfs on meson8.
Once we get this stable, we'll be able to throw the sys_pll in the mix.
Would you agree with this approach Martin ?
>
[...]
> > +struct clk_regmap meson8b_cpu_div = {
> > + .data = &(struct clk_regmap_div_data){
> > + .offset = HHI_SYS_CPU_CLK_CNTL1,
> > + .shift = 20,
> > + .width = 9,
> > + .table = cpu_div_table,
> > + .flags = CLK_DIVIDER_ALLOW_ZERO,
>
> looking at the Amlogic GPL kernel sources: [0]
> they allow programming this divider with 0, however it seems that it's
> not allowed to select this in the mux below
> during my tests this seems to have worked fine because the first
> parent of the mux below is cpu_in - which has the same rate as this
> divider with register value 0. in this scenario the common clock
> framework chooses the parent it finds first (cpu_in in this case -
> which is fine)
(It was a while ago but I think) I put this flag to avoid warning on boot
because the register value could be 0 by default, when the clock is not used.
When the clock is set by the CCF, it won't ever put 0 because zero is not part
of the divider table provided with this clock. So, as soon as a set_rate() call
reaches this clock, the zero value will go away and won't ever come back.
>
> > + },
> > + .hw.init = &(struct clk_init_data){
> > + .name = "cpu_div",
>
> I suggest to call this "cpu_scale_div", so it matches the value we
> find in the public S805 datasheet on page 31: [1] (the same goes for
> the variable name above and the CLKID #define)
No problem, will do.
>
> > + .ops = &clk_regmap_divider_ops,
> > + .parent_names = (const char *[]){ "cpu_in_sel" },
> > + .num_parents = 1,
> > + .flags = CLK_SET_RATE_PARENT,
> > + },
> > +};
> > +
> > +struct clk_regmap meson8b_cpu_out_sel = {
> > + .data = &(struct clk_regmap_mux_data){
> > + .offset = HHI_SYS_CPU_CLK_CNTL0,
> > + .mask = 0x3,
> > + .shift = 2,
> > + },
> > + .hw.init = &(struct clk_init_data){
> > + .name = "cpu_out_sel",
>
> I suggest to call this "cpu_scale_out_sel", so it matches the value we
> find in the public S805 datasheet on page 34: [1] (the same goes for
> the variable name above and the CLKID #define)
Sure.
next prev parent reply other threads:[~2018-02-05 9:49 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-31 18:09 [PATCH 00/19] clk: meson: use regmap in clock controllers Jerome Brunet
2018-01-31 18:09 ` [PATCH 01/19] clk: meson: use dev pointer where possible Jerome Brunet
2018-01-31 18:09 ` [PATCH 02/19] clk: meson: use devm_of_clk_add_hw_provider Jerome Brunet
2018-01-31 18:09 ` [PATCH 03/19] clk: meson: only one loop index is necessary in probe Jerome Brunet
2018-01-31 18:09 ` [PATCH 04/19] clk: meson: remove obsolete comments Jerome Brunet
2018-01-31 18:09 ` [PATCH 05/19] clk: meson: add regmap clocks Jerome Brunet
2018-02-08 7:33 ` Yixun Lan
2018-02-08 8:07 ` Jerome Brunet
2018-01-31 18:09 ` [PATCH 06/19] clk: meson: switch gxbb ao_clk to clk_regmap Jerome Brunet
2018-01-31 18:09 ` [PATCH 07/19] clk: meson: remove superseded aoclk_gate_regmap Jerome Brunet
2018-01-31 18:09 ` [PATCH 08/19] clk: meson: add regmap to the clock controllers Jerome Brunet
2018-02-03 18:53 ` Martin Blumenstingl
2018-02-05 9:51 ` Jerome Brunet
2018-01-31 18:09 ` [PATCH 09/19] clk: meson: migrate gates to clk_regmap Jerome Brunet
2018-01-31 18:09 ` [PATCH 10/19] clk: meson: migrate dividers " Jerome Brunet
2018-01-31 18:09 ` [PATCH 11/19] clk: meson: migrate muxes " Jerome Brunet
2018-01-31 18:09 ` [PATCH 12/19] clk: meson: add regmap helpers for parm Jerome Brunet
2018-01-31 18:09 ` [PATCH 13/19] clk: meson: migrate mplls clocks to clk_regmap Jerome Brunet
2018-01-31 18:09 ` [PATCH 14/19] clk: meson: migrate the audio divider clock " Jerome Brunet
2018-01-31 18:09 ` [PATCH 15/19] clk: meson: migrate plls clocks " Jerome Brunet
2018-01-31 18:09 ` [PATCH 16/19] clk: meson: split divider and gate part of mpll Jerome Brunet
2018-01-31 18:09 ` [PATCH 17/19] clk: meson: rework meson8b cpu clock Jerome Brunet
2018-02-03 18:46 ` Martin Blumenstingl
2018-02-05 9:49 ` Jerome Brunet [this message]
2018-01-31 18:09 ` [PATCH 18/19] clk: meson: remove obsolete cpu_clk Jerome Brunet
2018-02-03 18:48 ` Martin Blumenstingl
2018-01-31 18:09 ` [PATCH 19/19] clk: meson: use hhi syscon if available Jerome Brunet
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=1517824196.3153.41.camel@baylibre.com \
--to=jbrunet@baylibre.com \
--cc=linus-amlogic@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).