All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Robert Marko <robimarko@gmail.com>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>,
	Andy Gross <agross@kernel.org>,
	Konrad Dybcio <konrad.dybcio@somainline.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	krzysztof.kozlowski+dt@linaro.org, sivaprak@codeaurora.org,
	linux-arm-msm <linux-arm-msm@vger.kernel.org>,
	linux-clk@vger.kernel.org,
	Devicetree List <devicetree@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/6] clk: qcom: apss-ipq6018: fix apcs_alias0_clk_src
Date: Mon, 11 Jul 2022 17:38:13 +0300	[thread overview]
Message-ID: <CAA8EJpr8b+UxmCjuXVj+DMrvsHkgEk=ZKw8Ktj_vRT4oRZRutQ@mail.gmail.com> (raw)
In-Reply-To: <CAOX2RU7+f3vXdOmMNi6Dt=9jadrgVFhrU56vm=6dYKkhnPUJwQ@mail.gmail.com>

On Mon, 11 Jul 2022 at 16:23, Robert Marko <robimarko@gmail.com> wrote:
>
> On Mon, 11 Jul 2022 at 14:48, Dmitry Baryshkov
> <dmitry.baryshkov@linaro.org> wrote:
> >
> > On Mon, 11 Jul 2022 at 14:22, Robert Marko <robimarko@gmail.com> wrote:
> > >
> > > While working on IPQ8074 APSS driver it was discovered that IPQ6018 and
> > > IPQ8074 use almost the same PLL and APSS clocks, however APSS driver is
> > > currently broken.
> > >
> > > More precisely apcs_alias0_clk_src is broken, it was added as regmap_mux
> > > clock.
> > > However after debugging why it was always stuck at 800Mhz, it was figured
> > > out that its not regmap_mux compatible at all.
> > > It is a simple mux but it uses RCG2 register layout and control bits, so
> >
> > To utilize control bits, you probably should also use
>
> Hi,
> I am not really sure what you mean here?

Ugh, excuse me. Sent the message too early.
I mean that to utilize RCG2 control bits, you probably also need to
use clk_rcg2_is_enabled, etc.

>
> >
> > > utilize the new clk_rcg2_mux_closest_ops to correctly drive it while not
> > > having to provide a dummy frequency table.
> >
> > Could you please clarify this. Your new rcg2 ops seems to be literally
> > equivalent to the clk_regmap_mux_closest_ops provided the shift and
> > width are set correctly..
>
> Well, I have tried playing with the clk_regmap_mux_closest_ops but I
> just cannot get it
> to work.
>
> The width like you pointed out should be 8, register offset is
> currently pointing at the RCG control
> register and not the CFG one, so it obviously does not work.
>
> Setting the register to 0x54 and shift to 8 will just fail silently,
> leaving the shift at 7 and correcting
> the register won't work as RCG control bits are not utilized at all
> with regmap_mux and DIRTY_CFG
> is active when I manually look at the register.

Ok, I missed the update_cfg part. So, yes, this looks correct.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

>
> So, I am really not sure how clk_regmap_mux_closest_ops are supposed
> to work here at all.
>
> Regards,
> Robert
> >
> > > While we are here, use ARRAY_SIZE for number of parents.
> > >
> > > Tested on IPQ6018-CP01-C1 reference board and multiple IPQ8074 boards.
> > >
> > > Fixes: 5e77b4ef1b19 ("clk: qcom: Add ipq6018 apss clock controller")
> > > Signed-off-by: Robert Marko <robimarko@gmail.com>
> > > ---
> > >  drivers/clk/qcom/apss-ipq6018.c | 13 ++++++-------
> > >  1 file changed, 6 insertions(+), 7 deletions(-)
> > >
> > > diff --git a/drivers/clk/qcom/apss-ipq6018.c b/drivers/clk/qcom/apss-ipq6018.c
> > > index d78ff2f310bf..be952d417ded 100644
> > > --- a/drivers/clk/qcom/apss-ipq6018.c
> > > +++ b/drivers/clk/qcom/apss-ipq6018.c
> > > @@ -16,7 +16,7 @@
> > >  #include "clk-regmap.h"
> > >  #include "clk-branch.h"
> > >  #include "clk-alpha-pll.h"
> > > -#include "clk-regmap-mux.h"
> > > +#include "clk-rcg.h"
> > >
> > >  enum {
> > >         P_XO,
> > > @@ -33,16 +33,15 @@ static const struct parent_map parents_apcs_alias0_clk_src_map[] = {
> > >         { P_APSS_PLL_EARLY, 5 },
> > >  };
> > >
> > > -static struct clk_regmap_mux apcs_alias0_clk_src = {
> > > -       .reg = 0x0050,
> > > -       .width = 3,
> > > -       .shift = 7,
> >
> > Judging from rcg2 ops, .shift should be set to 8.
> >
> > > +static struct clk_rcg2 apcs_alias0_clk_src = {
> > > +       .cmd_rcgr = 0x0050,
> > > +       .hid_width = 5,
> > >         .parent_map = parents_apcs_alias0_clk_src_map,
> > >         .clkr.hw.init = &(struct clk_init_data){
> > >                 .name = "apcs_alias0_clk_src",
> > >                 .parent_data = parents_apcs_alias0_clk_src,
> > > -               .num_parents = 2,
> > > -               .ops = &clk_regmap_mux_closest_ops,
> > > +               .num_parents = ARRAY_SIZE(parents_apcs_alias0_clk_src),
> > > +               .ops = &clk_rcg2_mux_closest_ops,
> > >                 .flags = CLK_SET_RATE_PARENT,
> > >         },
> > >  };
> > > --
> > > 2.36.1
> > >
> >
> >
> > --
> > With best wishes
> > Dmitry



-- 
With best wishes
Dmitry

  reply	other threads:[~2022-07-11 14:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-11 10:47 [PATCH 1/6] clk: qcom: clk-rcg2: add rcg2 mux ops Robert Marko
2022-07-11 10:47 ` [PATCH 2/6] clk: qcom: apss-ipq6018: fix apcs_alias0_clk_src Robert Marko
2022-07-11 12:48   ` Dmitry Baryshkov
2022-07-11 13:23     ` Robert Marko
2022-07-11 14:38       ` Dmitry Baryshkov [this message]
2022-07-11 10:47 ` [PATCH 3/6] clk: qcom: apss-ipq6018: mark apcs_alias0_core_clk as critical Robert Marko
2022-07-11 12:49   ` Dmitry Baryshkov
2022-07-11 10:47 ` [PATCH 4/6] clk: qcom: apss-ipq6018: add MODULE_ALIAS Robert Marko
2022-07-11 11:05   ` Krzysztof Kozlowski
2022-07-11 11:46     ` Robert Marko
2022-07-11 12:02       ` Krzysztof Kozlowski
2022-07-11 12:45         ` Robert Marko
2022-07-11 10:47 ` [PATCH 5/6] dt-bindings: clock: qcom,a53pll: add IPQ8074 compatible Robert Marko
2022-07-11 11:04   ` Krzysztof Kozlowski
2022-07-11 10:47 ` [PATCH 6/6] clk: qcom: apss-ipq-pll: add support for IPQ8074 Robert Marko
2022-07-11 11:06   ` Krzysztof Kozlowski
2022-07-11 12:51   ` Dmitry Baryshkov
2022-07-11 12:55     ` Robert Marko
2022-07-11 12:56       ` Dmitry Baryshkov
2022-07-11 14:38 ` [PATCH 1/6] clk: qcom: clk-rcg2: add rcg2 mux ops Dmitry Baryshkov

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='CAA8EJpr8b+UxmCjuXVj+DMrvsHkgEk=ZKw8Ktj_vRT4oRZRutQ@mail.gmail.com' \
    --to=dmitry.baryshkov@linaro.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=konrad.dybcio@somainline.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=robimarko@gmail.com \
    --cc=sboyd@kernel.org \
    --cc=sivaprak@codeaurora.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.