public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
From: Jagadeesh Kona <quic_jkona@quicinc.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: Bjorn Andersson <andersson@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Konrad Dybcio <konradybcio@kernel.org>,
	"Vladimir Zapolskiy" <vladimir.zapolskiy@linaro.org>,
	Dmitry Baryshkov <lumag@kernel.org>,
	Ajit Pandey <quic_ajipan@quicinc.com>,
	Imran Shaik <quic_imrashai@quicinc.com>,
	Taniya Das <quic_tdas@quicinc.com>,
	"Satya Priya Kakitapalli" <quic_skakitap@quicinc.com>,
	<linux-arm-msm@vger.kernel.org>, <linux-clk@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Subject: Re: [PATCH v3 06/18] clk: qcom: common: Add support to configure clk regs in qcom_cc_really_probe
Date: Mon, 14 Apr 2025 15:39:04 +0530	[thread overview]
Message-ID: <efe91d3f-a2e3-4bee-a7e5-36ea4fc0968a@quicinc.com> (raw)
In-Reply-To: <CAO9ioeWmuPhBPivthidXTFfnXRBx9rd=iX5aqjB4bMcCKueXeg@mail.gmail.com>



On 4/11/2025 2:21 PM, Dmitry Baryshkov wrote:
> On Fri, 11 Apr 2025 at 10:14, Jagadeesh Kona <quic_jkona@quicinc.com> wrote:
>>
>>
>>
>> On 3/27/2025 6:20 PM, Dmitry Baryshkov wrote:
>>> On Thu, Mar 27, 2025 at 03:22:26PM +0530, Jagadeesh Kona wrote:
>>>> Add support to configure PLLS and clk registers in qcom_cc_really_probe().
>>>> This ensures all required power domains are enabled and kept ON by runtime
>>>> PM code in qcom_cc_really_probe() before configuring the PLLS or clock
>>>> registers.
>>>>
>>>> Signed-off-by: Jagadeesh Kona <quic_jkona@quicinc.com>
>>>> ---
>>>>  drivers/clk/qcom/common.c | 28 ++++++++++++++++++++++++++++
>>>>  drivers/clk/qcom/common.h | 19 +++++++++++++++++++
>>>>  2 files changed, 47 insertions(+)
>>>>
>>>> diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c
>>>> index 9cbf1c5296dad3ee5477a2f5a445488707663b9d..c4d980c6145834969fada14863360ee81c9aa251 100644
>>>> --- a/drivers/clk/qcom/common.c
>>>> +++ b/drivers/clk/qcom/common.c
>>>> @@ -14,6 +14,8 @@
>>>>  #include <linux/of.h>
>>>>
>>>>  #include "common.h"
>>>> +#include "clk-alpha-pll.h"
>>>> +#include "clk-branch.h"
>>>>  #include "clk-rcg.h"
>>>>  #include "clk-regmap.h"
>>>>  #include "reset.h"
>>>> @@ -285,6 +287,29 @@ static int qcom_cc_icc_register(struct device *dev,
>>>>                                                   desc->num_icc_hws, icd);
>>>>  }
>>>>
>>>> +static void qcom_cc_clk_pll_configure(const struct qcom_cc_desc *desc,
>>>> +                                  struct regmap *regmap)
>>>> +{
>>>> +    int i;
>>>> +
>>>> +    for (i = 0; i < desc->num_alpha_plls; i++)
>>>> +            qcom_clk_alpha_pll_configure(desc->alpha_plls[i], regmap);
>>>> +}
>>>> +
>>>> +static void qcom_cc_clk_regs_configure(const struct qcom_cc_desc *desc,
>>>> +                                   struct regmap *regmap)
>>>> +{
>>>> +    struct qcom_clk_reg_setting *clk_regs = desc->clk_regs;
>>>> +    int i;
>>>> +
>>>> +    for (i = 0; i < desc->num_clk_cbcrs; i++)
>>>> +            qcom_branch_set_clk_en(regmap, desc->clk_cbcrs[i]);
>>>> +
>>>> +    for (i = 0 ; i < desc->num_clk_regs; i++)
>>>> +            regmap_update_bits(regmap, clk_regs[i].offset,
>>>> +                               clk_regs[i].mask, clk_regs[i].val);
>>>
>>> I think there are other semantic functions which we don't want to
>>> convert to offset-mask-val tuples. See drivers/clk/qcom/clk-branch.h.
>>> I'd suggest to move setup steps to a driver callback. We can improve it
>>> later on if it is found to make sense, but it won't block this series
>>> from being merged.
>>>
>>
>> Yes, there are other wrapper functions as well but they are unused in most
>> clock controllers. We will check more on how we can improve this in a separate
>> series.
> 
> Please do it the other way around. Implement a generic callback, then
> we can check how to sort things out.
> 

Yeah, but since this series doesn't require any misc register settings update, I
will remove the above regmap_update_bits() code for now. I will check further on
this and post a separate series for it.

Thanks,
Jagadeesh

>>
>> Thanks,
>> Jagadeesh
>>
>>>> +}
>>>> +
>>>>  int qcom_cc_really_probe(struct device *dev,
>>>>                       const struct qcom_cc_desc *desc, struct regmap *regmap)
>>>>  {
>>>> @@ -315,6 +340,9 @@ int qcom_cc_really_probe(struct device *dev,
>>>>                      return ret;
>>>>      }
>>>>
>>>> +    qcom_cc_clk_pll_configure(desc, regmap);
>>>> +    qcom_cc_clk_regs_configure(desc, regmap);
>>>> +
>>>>      reset = &cc->reset;
>>>>      reset->rcdev.of_node = dev->of_node;
>>>>      reset->rcdev.ops = &qcom_reset_ops;
>>>> diff --git a/drivers/clk/qcom/common.h b/drivers/clk/qcom/common.h
>>>> index 9c10bc8c197cd7dfa25ccd245763ad6acb081523..01b1ae52f2dc580350409d6244578944cce571f0 100644
>>>> --- a/drivers/clk/qcom/common.h
>>>> +++ b/drivers/clk/qcom/common.h
>>>> @@ -25,6 +25,19 @@ struct qcom_icc_hws_data {
>>>>      int clk_id;
>>>>  };
>>>>
>>>> +/**
>>>> + * struct qcom_clk_reg_setting - Represents miscellaneous clock register settings
>>>> + * @offset: address offset for the clock register
>>>> + * @mask: bit mask indicating the bits to be updated
>>>> + * @val: Encoded value to be set within the specified bit mask
>>>> + *       (e.g., if writing 7 to bits 4-7, mask = 0xF0 and val = 0x70)
>>>> + */
>>>> +struct qcom_clk_reg_setting {
>>>> +    u32 offset;
>>>> +    u32 mask;
>>>> +    u32 val;
>>>> +};
>>>> +
>>>>  struct qcom_cc_desc {
>>>>      const struct regmap_config *config;
>>>>      struct clk_regmap **clks;
>>>> @@ -38,6 +51,12 @@ struct qcom_cc_desc {
>>>>      const struct qcom_icc_hws_data *icc_hws;
>>>>      size_t num_icc_hws;
>>>>      unsigned int icc_first_node_id;
>>>> +    u32 *clk_cbcrs;
>>>> +    size_t num_clk_cbcrs;
>>>> +    struct clk_alpha_pll **alpha_plls;
>>>> +    size_t num_alpha_plls;
>>>> +    struct qcom_clk_reg_setting *clk_regs;
>>>> +    size_t num_clk_regs;
>>>>      bool use_rpm;
>>>>  };
>>>>
>>>>
>>>> --
>>>> 2.34.1
>>>>
>>>
> 
> 
> 

  reply	other threads:[~2025-04-14 10:09 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-27  9:52 [PATCH v3 00/18] clk: qcom: Add support to attach multiple power domains in cc probe Jagadeesh Kona
2025-03-27  9:52 ` [PATCH v3 01/18] dt-bindings: clock: qcom,sm8450-videocc: Add MXC power domain Jagadeesh Kona
2025-03-28  8:09   ` Krzysztof Kozlowski
2025-03-28  8:10     ` Krzysztof Kozlowski
2025-03-27  9:52 ` [PATCH v3 02/18] dt-bindings: clock: qcom: Update sc8280xp camcc bindings Jagadeesh Kona
2025-03-27 15:39   ` Bryan O'Donoghue
2025-03-28  8:07   ` Krzysztof Kozlowski
2025-03-28 10:39     ` Jagadeesh Kona
2025-03-27  9:52 ` [PATCH v3 03/18] dt-bindings: clock: qcom: sm8450-camcc: Allow to specify two power domains Jagadeesh Kona
2025-03-27 15:28   ` Bryan O'Donoghue
2025-03-28 10:39     ` Jagadeesh Kona
2025-03-28  8:11   ` Krzysztof Kozlowski
2025-03-27  9:52 ` [PATCH v3 04/18] clk: qcom: clk-alpha-pll: Add support for common PLL configuration function Jagadeesh Kona
2025-03-27 15:51   ` Bryan O'Donoghue
2025-03-27 18:20     ` Dmitry Baryshkov
2025-04-11  7:13       ` Jagadeesh Kona
2025-03-27  9:52 ` [PATCH v3 05/18] clk: qcom: common: Handle runtime power management in qcom_cc_really_probe Jagadeesh Kona
2025-03-27 12:44   ` Dmitry Baryshkov
2025-03-27 15:58   ` Bryan O'Donoghue
2025-03-28 10:41     ` Jagadeesh Kona
2025-03-27  9:52 ` [PATCH v3 06/18] clk: qcom: common: Add support to configure clk regs " Jagadeesh Kona
2025-03-27 12:50   ` Dmitry Baryshkov
2025-04-11  7:14     ` Jagadeesh Kona
2025-04-11  8:51       ` Dmitry Baryshkov
2025-04-14 10:09         ` Jagadeesh Kona [this message]
2025-04-14 10:13           ` Dmitry Baryshkov
2025-03-27  9:52 ` [PATCH v3 07/18] clk: qcom: videocc-sm8450: Move PLL & clk configuration to really probe Jagadeesh Kona
2025-03-27 12:51   ` Dmitry Baryshkov
2025-03-27  9:52 ` [PATCH v3 08/18] clk: qcom: videocc-sm8550: " Jagadeesh Kona
2025-03-27 13:58   ` Dmitry Baryshkov
2025-03-27  9:52 ` [PATCH v3 09/18] clk: qcom: camcc-sm8450: " Jagadeesh Kona
2025-03-27 13:58   ` Dmitry Baryshkov
2025-03-27  9:52 ` [PATCH v3 10/18] clk: qcom: camcc-sm8550: " Jagadeesh Kona
2025-03-27 15:06   ` Dmitry Baryshkov
2025-03-27  9:52 ` [PATCH v3 11/18] clk: qcom: camcc-sm8650: " Jagadeesh Kona
2025-03-27  9:52 ` [PATCH v3 12/18] clk: qcom: camcc-x1e80100: " Jagadeesh Kona
2025-03-27 15:59   ` Bryan O'Donoghue
2025-03-27  9:52 ` [PATCH v3 13/18] arm64: dts: qcom: Add MXC power domain to videocc node on SM8450 Jagadeesh Kona
2025-03-27  9:52 ` [PATCH v3 14/18] arm64: dts: qcom: Add MXC power domain to videocc node on SM8550 Jagadeesh Kona
2025-03-27  9:52 ` [PATCH v3 15/18] arm64: dts: qcom: Add MXC power domain to videocc node on SM8650 Jagadeesh Kona
2025-04-01 15:27   ` Konrad Dybcio
2025-04-01 16:00     ` Konrad Dybcio
2025-04-11  7:27       ` Jagadeesh Kona
2025-04-11  7:16     ` Jagadeesh Kona
2025-04-11  9:15       ` Konrad Dybcio
2025-03-27  9:52 ` [PATCH v3 16/18] arm64: dts: qcom: Add MXC power domain to camcc node on SM8450 Jagadeesh Kona
2025-03-27 16:03   ` Bryan O'Donoghue
2025-03-28 10:40     ` Jagadeesh Kona
2025-03-27  9:52 ` [PATCH v3 17/18] arm64: dts: qcom: sm8550: Additionally manage MXC power domain in camcc Jagadeesh Kona
2025-03-27  9:52 ` [PATCH v3 18/18] arm64: dts: qcom: Add MXC power domain to camcc node on SM8650 Jagadeesh Kona
2025-03-27 14:03 ` [PATCH v3 00/18] clk: qcom: Add support to attach multiple power domains in cc probe Rob Herring (Arm)

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=efe91d3f-a2e3-4bee-a7e5-36ea4fc0968a@quicinc.com \
    --to=quic_jkona@quicinc.com \
    --cc=andersson@kernel.org \
    --cc=bryan.odonoghue@linaro.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lumag@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=quic_ajipan@quicinc.com \
    --cc=quic_imrashai@quicinc.com \
    --cc=quic_skakitap@quicinc.com \
    --cc=quic_tdas@quicinc.com \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=vladimir.zapolskiy@linaro.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