From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Stephen Boyd <sboyd@kernel.org>
Cc: Andy Gross <agross@kernel.org>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Michael Turquette <mturquette@baylibre.com>,
Taniya Das <tdas@codeaurora.org>,
linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
Mike Tipton <quic_mdtipton@quicinc.com>
Subject: Re: [PATCH 1/2] clk: qcom: add API to safely park RCG2 sources
Date: Thu, 9 Dec 2021 10:36:14 -0800 [thread overview]
Message-ID: <YbJMnvg/IDwHNeWS@ripper> (raw)
In-Reply-To: <20211209083727.30DD2C004DD@smtp.kernel.org>
On Thu 09 Dec 00:37 PST 2021, Stephen Boyd wrote:
> Quoting Dmitry Baryshkov (2021-12-07 18:22:09)
> > Some of RCG2 clocks can become stuck during the boot process, when
> > device drivers are enabling and disabling the RCG2's parent clocks.
> > To prevernt such outcome of driver probe sequences, add API to park
>
> s/prevernt/prevent/
>
> > clocks to the safe clock source (typically TCXO).
> >
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>
> I'd prefer this approach vs. adding a new clk flag. The clk framework
> doesn't handle handoff properly today so we shouldn't try to bandage
> that in the core.
>
I'm not against putting this responsibility in the drivers, but I don't
think we can blindly park all the RCGs that may or may not be used.
Note that we should do this for all RCGs that downstream are marked as
enable_safe_config (upstream should be using clk_rcg2_shared_ops)
and disabling some of those probe time won't be appreciated by the
hardware.
If you don't like the flag passed to clk_disable_unused (which is like a
very reasonable objection to have), we need to make progress towards a
proper solution that replaces clk_disable_unused().
> > diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c
> > index e1b1b426fae4..230b04a7427c 100644
> > --- a/drivers/clk/qcom/clk-rcg2.c
> > +++ b/drivers/clk/qcom/clk-rcg2.c
> > @@ -1036,6 +1036,40 @@ static void clk_rcg2_shared_disable(struct clk_hw *hw)
> > regmap_write(rcg->clkr.regmap, rcg->cmd_rcgr + CFG_REG, cfg);
> > }
> >
> > +int clk_rcg2_park_safely(struct regmap *regmap, u32 offset, unsigned int safe_src)
This seems to just duplicate clk_rcg2_shared_disable()?
Regards,
Bjorn
>
> Please add kernel doc as it's an exported symbol.
>
> > +{
> > + unsigned int val, ret, count;
> > +
> > + ret = regmap_read(regmap, offset + CFG_REG, &val);
> > + if (ret)
> > + return ret;
> > +
> > + /* assume safe source is 0 */
>
> Are we assuming safe source is 0 here? It looks like we pass it in now?
>
> > + if ((val & CFG_SRC_SEL_MASK) == (safe_src << CFG_SRC_SEL_SHIFT))
> > + return 0;
> > +
> > + regmap_write(regmap, offset + CFG_REG, safe_src << CFG_SRC_SEL_SHIFT);
> > +
> > + ret = regmap_update_bits(regmap, offset + CMD_REG,
> > + CMD_UPDATE, CMD_UPDATE);
> > + if (ret)
> > + return ret;
> > +
> > + /* Wait for update to take effect */
> > + for (count = 500; count > 0; count--) {
> > + ret = regmap_read(regmap, offset + CMD_REG, &val);
> > + if (ret)
> > + return ret;
> > + if (!(val & CMD_UPDATE))
> > + return 0;
> > + udelay(1);
> > + }
> > +
> > + WARN(1, "the rcg didn't update its configuration.");
>
> Add a newline?
>
> > + return -EBUSY;
> > +}
> > +EXPORT_SYMBOL_GPL(clk_rcg2_park_safely);
> > +
next prev parent reply other threads:[~2021-12-09 18:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-08 2:22 [PATCH 0/2] clk: qcom: fix disp_cc_mdss_mdp_clk_src issues on sdm845 Dmitry Baryshkov
2021-12-08 2:22 ` [PATCH 1/2] clk: qcom: add API to safely park RCG2 sources Dmitry Baryshkov
2021-12-09 8:37 ` Stephen Boyd
2021-12-09 18:36 ` Bjorn Andersson [this message]
2021-12-15 21:14 ` Dmitry Baryshkov
2021-12-16 4:24 ` Bjorn Andersson
2021-12-08 2:22 ` [PATCH 2/2] clk: qcom: dispcc-sdm845: park disp_cc_mdss_mdp_clk_src Dmitry Baryshkov
2021-12-09 8:37 ` Stephen Boyd
2021-12-09 14:11 ` Robert Foss
2021-12-09 14:18 ` Dmitry Baryshkov
2021-12-09 18:40 ` Bjorn Andersson
2021-12-09 21:04 ` Dmitry Baryshkov
2021-12-15 22:17 ` Dmitry Baryshkov
2021-12-16 1:38 ` Stephen Boyd
2021-12-16 3:34 ` Dmitry Baryshkov
2021-12-16 4:10 ` Stephen Boyd
2021-12-16 4:01 ` Bjorn Andersson
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=YbJMnvg/IDwHNeWS@ripper \
--to=bjorn.andersson@linaro.org \
--cc=agross@kernel.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=quic_mdtipton@quicinc.com \
--cc=sboyd@kernel.org \
--cc=tdas@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.