From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Vinod Koul <vkoul@kernel.org>
Cc: Stephen Boyd <sboyd@kernel.org>,
linux-arm-msm@vger.kernel.org, Andy Gross <agross@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Rob Herring <robh+dt@kernel.org>,
Taniya Das <tdas@codeaurora.org>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@somainline.org>,
linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/5] clk: qcom: clk-alpha-pll: modularize alpha_pll_trion_set_rate()
Date: Mon, 25 Jan 2021 11:14:40 -0600 [thread overview]
Message-ID: <YA78gO7xEoZSb+Wy@builder.lan> (raw)
In-Reply-To: <20210118044321.2571775-3-vkoul@kernel.org>
On Sun 17 Jan 22:43 CST 2021, Vinod Koul wrote:
> Trion 5LPE set rate uses code similar to alpha_pll_trion_set_rate() but
> with different registers. Modularize these by moving out latch and latch
> ack bits so that we can reuse the function.
>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Regards,
Bjorn
> Suggested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
> Signed-off-by: Vinod Koul <vkoul@kernel.org>
> ---
> drivers/clk/qcom/clk-alpha-pll.c | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/clk/qcom/clk-alpha-pll.c b/drivers/clk/qcom/clk-alpha-pll.c
> index f7721088494c..a30ea7b09224 100644
> --- a/drivers/clk/qcom/clk-alpha-pll.c
> +++ b/drivers/clk/qcom/clk-alpha-pll.c
> @@ -1471,8 +1471,8 @@ static int alpha_pll_lucid_prepare(struct clk_hw *hw)
> return __alpha_pll_trion_prepare(hw, LUCID_PCAL_DONE);
> }
>
> -static int alpha_pll_trion_set_rate(struct clk_hw *hw, unsigned long rate,
> - unsigned long prate)
> +static int __alpha_pll_trion_set_rate(struct clk_hw *hw, unsigned long rate,
> + unsigned long prate, u32 latch_bit, u32 latch_ack)
> {
> struct clk_alpha_pll *pll = to_clk_alpha_pll(hw);
> unsigned long rrate;
> @@ -1490,22 +1490,20 @@ static int alpha_pll_trion_set_rate(struct clk_hw *hw, unsigned long rate,
> regmap_write(pll->clkr.regmap, PLL_ALPHA_VAL(pll), a);
>
> /* Latch the PLL input */
> - ret = regmap_update_bits(pll->clkr.regmap, PLL_MODE(pll),
> - PLL_UPDATE, PLL_UPDATE);
> + ret = regmap_update_bits(pll->clkr.regmap, PLL_MODE(pll), latch_bit, latch_bit);
> if (ret)
> return ret;
>
> /* Wait for 2 reference cycles before checking the ACK bit. */
> udelay(1);
> regmap_read(pll->clkr.regmap, PLL_MODE(pll), &val);
> - if (!(val & ALPHA_PLL_ACK_LATCH)) {
> + if (!(val & latch_ack)) {
> pr_err("Lucid PLL latch failed. Output may be unstable!\n");
> return -EINVAL;
> }
>
> /* Return the latch input to 0 */
> - ret = regmap_update_bits(pll->clkr.regmap, PLL_MODE(pll),
> - PLL_UPDATE, 0);
> + ret = regmap_update_bits(pll->clkr.regmap, PLL_MODE(pll), latch_bit, 0);
> if (ret)
> return ret;
>
> @@ -1520,6 +1518,12 @@ static int alpha_pll_trion_set_rate(struct clk_hw *hw, unsigned long rate,
> return 0;
> }
>
> +static int alpha_pll_trion_set_rate(struct clk_hw *hw, unsigned long rate,
> + unsigned long prate)
> +{
> + return __alpha_pll_trion_set_rate(hw, rate, prate, PLL_UPDATE, ALPHA_PLL_ACK_LATCH);
> +}
> +
> const struct clk_ops clk_alpha_pll_trion_ops = {
> .prepare = alpha_pll_trion_prepare,
> .enable = clk_trion_pll_enable,
> --
> 2.26.2
>
next prev parent reply other threads:[~2021-01-25 17:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-18 4:43 [PATCH v4 0/5] Add clock drivers for SM8350 Vinod Koul
2021-01-18 4:43 ` [PATCH v4 1/5] clk: qcom: clk-alpha-pll: replace regval with val Vinod Koul
2021-01-25 17:13 ` Bjorn Andersson
2021-01-18 4:43 ` [PATCH v4 2/5] clk: qcom: clk-alpha-pll: modularize alpha_pll_trion_set_rate() Vinod Koul
2021-01-25 17:14 ` Bjorn Andersson [this message]
2021-01-18 4:43 ` [PATCH v4 3/5] clk: qcom: clk-alpha-pll: Add support for Lucid 5LPE PLL Vinod Koul
2021-01-19 21:54 ` AngeloGioacchino Del Regno
2021-01-25 17:18 ` Bjorn Andersson
2021-01-26 7:59 ` Vinod Koul
2021-01-18 4:43 ` [PATCH v4 4/5] dt-bindings: clock: Add SM8350 GCC clock bindings Vinod Koul
2021-01-25 17:25 ` Bjorn Andersson
2021-01-26 8:00 ` Vinod Koul
2021-01-26 14:17 ` 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=YA78gO7xEoZSb+Wy@builder.lan \
--to=bjorn.andersson@linaro.org \
--cc=agross@kernel.org \
--cc=angelogioacchino.delregno@somainline.org \
--cc=devicetree@vger.kernel.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=sboyd@kernel.org \
--cc=tdas@codeaurora.org \
--cc=vkoul@kernel.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).