linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Stephen Boyd <sboyd@kernel.org>
Cc: mturquette@baylibre.com, robh+dt@kernel.org,
	bjorn.andersson@linaro.org, vkoul@kernel.org,
	linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	Naveen Yadav <naveenky@codeaurora.org>
Subject: Re: [PATCH 2/4] clk: qcom: Add SDX55 GCC support
Date: Thu, 5 Nov 2020 14:21:48 +0530	[thread overview]
Message-ID: <20201105085148.GA7308@work> (raw)
In-Reply-To: <160454301723.3965362.9504622582275389041@swboyd.mtv.corp.google.com>

On Wed, Nov 04, 2020 at 06:23:37PM -0800, Stephen Boyd wrote:
> Quoting Manivannan Sadhasivam (2020-10-28 00:42:30)
> > From: Naveen Yadav <naveenky@codeaurora.org>
> > 
> > Add Global Clock Controller (GCC) support for SDX55 SoCs from Qualcomm.
> > 
> > Signed-off-by: Naveen Yadav <naveenky@codeaurora.org>
> > [mani: converted to parent_data, commented critical clocks, cleanups]
> > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > ---
> >  drivers/clk/qcom/Kconfig     |    8 +
> >  drivers/clk/qcom/Makefile    |    1 +
> >  drivers/clk/qcom/gcc-sdx55.c | 1667 ++++++++++++++++++++++++++++++++++
> >  3 files changed, 1676 insertions(+)
> >  create mode 100644 drivers/clk/qcom/gcc-sdx55.c
> > 
> > diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig
> > index 3a965bd326d5..dbca8debc06f 100644
> > --- a/drivers/clk/qcom/Kconfig
> > +++ b/drivers/clk/qcom/Kconfig
> > @@ -502,4 +502,12 @@ config KRAITCC
> >           Support for the Krait CPU clocks on Qualcomm devices.
> >           Say Y if you want to support CPU frequency scaling.
> >  
> > +config GCC_SDX55
> 
> Please sort instead of add at end.
> 
> > +       tristate "SDX55 Global Clock Controller"
> > +       depends on ARM
> 
> Why?
> 

Not needed, will remove.

> > +       help
> > +         Support for the global clock controller on SDX55 devices.
> > +         Say Y if you want to use peripheral devices such as UART,
> > +         SPI, I2C, USB, SD/UFS, PCIe etc.
> > +
> >  endif
> > diff --git a/drivers/clk/qcom/Makefile b/drivers/clk/qcom/Makefile
> > index 11ae86febe87..3e27d67f95aa 100644
> > --- a/drivers/clk/qcom/Makefile
> > +++ b/drivers/clk/qcom/Makefile
> > @@ -75,3 +75,4 @@ obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o
> >  obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o
> >  obj-$(CONFIG_QCOM_HFPLL) += hfpll.o
> >  obj-$(CONFIG_KRAITCC) += krait-cc.o
> > +obj-$(CONFIG_GCC_SDX55) += gcc-sdx55.o
> 
> Please sort this instead of add at end.
> 
> > diff --git a/drivers/clk/qcom/gcc-sdx55.c b/drivers/clk/qcom/gcc-sdx55.c
> > new file mode 100644
> > index 000000000000..75831c829202
> > --- /dev/null
> > +++ b/drivers/clk/qcom/gcc-sdx55.c
> > @@ -0,0 +1,1667 @@
> > +

[...]

> > +static const struct clk_div_table post_div_table_lucid_even[] = {
> > +       { 0x0, 1 },
> > +       { 0x1, 2 },
> > +       { 0x3, 4 },
> > +       { 0x7, 8 },
> > +       { }
> > +};
> 
> I think this table is common to all lucid plls? Maybe we can push it
> into the clk_ops somehow and stop duplicating it here?
> 

Are you referring to lucid plls in this driver? Because, this table is
not common for other SoCs. And I don't think having this way introduces
any overhead, so I'd prefer keeping it as it is.

> > +
> > +static struct clk_alpha_pll_postdiv gpll0_out_even = {
> > +       .offset = 0x0,
> > +       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID],
> > +       .post_div_shift = 8,
> > +       .post_div_table = post_div_table_lucid_even,
> > +       .num_post_div = ARRAY_SIZE(post_div_table_lucid_even),
> > +       .width = 4,
> > +       .clkr.hw.init = &(struct clk_init_data){
> > +               .name = "gpll0_out_even",
> > +               .parent_data = &(const struct clk_parent_data){
> > +                       .fw_name = "gpll0",
> > +               },
> 
> If this is gpll0 in this file, then this should be a clk_hws pointer
> instead and directly pointing to the parent.
> 

Ack

> > +               .num_parents = 1,
> > +               .ops = &clk_alpha_pll_postdiv_lucid_ops,
> > +       },
> > +};
> > +
> > +static struct clk_alpha_pll gpll4 = {
> > +       .offset = 0x76000,
> > +       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID],
> > +       .vco_table = lucid_vco,
> > +       .num_vco = ARRAY_SIZE(lucid_vco),
> > +       .clkr = {
> > +               .enable_reg = 0x6d000,
> > +               .enable_mask = BIT(4),
> > +               .hw.init = &(struct clk_init_data){
> > +                       .name = "gpll4",
> > +                       .parent_data = &(const struct clk_parent_data){
> > +                               .fw_name = "bi_tcxo",
> > +                       },
> > +                       .num_parents = 1,
> > +                       .ops = &clk_alpha_pll_fixed_lucid_ops,
> > +               },
> > +       },
> > +};
> > +
> > +static struct clk_alpha_pll_postdiv gpll4_out_even = {
> > +       .offset = 0x76000,
> > +       .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_LUCID],
> > +       .post_div_shift = 8,
> > +       .post_div_table = post_div_table_lucid_even,
> > +       .num_post_div = ARRAY_SIZE(post_div_table_lucid_even),
> > +       .width = 4,
> > +       .clkr.hw.init = &(struct clk_init_data){
> > +               .name = "gpll4_out_even",
> > +               .parent_data = &(const struct clk_parent_data){
> > +                       .fw_name = "gpll4",
> 
> If this is gpll4 in this file, then this should be a clk_hws pointer
> instead and directly pointing to the parent.
> 

Ack

> > +               },
> > +               .num_parents = 1,
> > +               .ops = &clk_alpha_pll_postdiv_lucid_ops,
> > +       },
> > +};
> > +

[...]

> > +/* For CPUSS functionality the SYS NOC clock needs to be left enabled */
> > +static struct clk_branch gcc_sys_noc_cpuss_ahb_clk = {
> > +       .halt_reg = 0x4010,
> > +       .halt_check = BRANCH_HALT_VOTED,
> > +       .clkr = {
> > +               .enable_reg = 0x6d008,
> > +               .enable_mask = BIT(0),
> > +               .hw.init = &(struct clk_init_data){
> > +                       .name = "gcc_sys_noc_cpuss_ahb_clk",
> > +                       .parent_hws = (const struct clk_hw *[]){
> > +                               &gcc_cpuss_ahb_clk_src.clkr.hw },
> > +                       .num_parents = 1,
> > +                       .flags = CLK_IS_CRITICAL | CLK_SET_RATE_PARENT,
> 
> These CLK_IS_CRITICAL clks can't be set once at driver probe time and
> forgotten about? It would be nice to not allocate memory for things that
> never matter.
> 

Makes sense! But are we moving into the direction of deprecating the use
of CLK_IS_CRITICAL?

> > +                       .ops = &clk_branch2_ops,
> > +               },
> > +       },
> > +};
> > +
> > +static struct clk_branch gcc_usb30_master_clk = {
> > +       .halt_reg = 0xb010,
> > +       .halt_check = BRANCH_HALT,
> > +       .clkr = {
> > +               .enable_reg = 0xb010,
> > +               .enable_mask = BIT(0),
> > +               .hw.init = &(struct clk_init_data){
> > +                       .name = "gcc_usb30_master_clk",
> > +                       .parent_hws = (const struct clk_hw *[]){
> > +                               &gcc_usb30_master_clk_src.clkr.hw },
> > +                       .num_parents = 1,
> > +                       .flags = CLK_SET_RATE_PARENT,
> > +                       .ops = &clk_branch2_ops,
> [...]
> > +
> > +static const struct qcom_cc_desc gcc_sdx55_desc = {
> > +       .config = &gcc_sdx55_regmap_config,
> > +       .clks = gcc_sdx55_clocks,
> > +       .num_clks = ARRAY_SIZE(gcc_sdx55_clocks),
> > +       .resets = gcc_sdx55_resets,
> > +       .num_resets = ARRAY_SIZE(gcc_sdx55_resets),
> 
> No gdscs?
> 

This will come at later point.

> > +};
> > +
> > +static const struct of_device_id gcc_sdx55_match_table[] = {
> > +       { .compatible = "qcom,gcc-sdx55" },
> > +       { }
> > +};
> > +MODULE_DEVICE_TABLE(of, gcc_sdx55_match_table);
> > +
> > +static int gcc_sdx55_probe(struct platform_device *pdev)
> > +{
> > +       return qcom_cc_probe(pdev, &gcc_sdx55_desc);
> 
> Wow haven't seen this in some time. There isn't some sort of PLL that
> needs configuring or some clks that need to be slammed on with a couple
> register writes?
> 

Nothing as per the downstream driver. Actually the downstream just sets
the rate of few clocks but I don't find them useful at the moment. So,
dropped the change.

Thanks,
Mani

> > +}
> > +

  reply	other threads:[~2020-11-05  8:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-28  7:42 [PATCH 0/4] Add GCC and RPMh clock support for SDX55 Manivannan Sadhasivam
2020-10-28  7:42 ` [PATCH 1/4] dt-bindings: clock: Add SDX55 GCC clock bindings Manivannan Sadhasivam
2020-10-30 19:22   ` Rob Herring
2020-10-31  3:29     ` Manivannan Sadhasivam
2020-11-05  2:03       ` Stephen Boyd
2020-10-28  7:42 ` [PATCH 2/4] clk: qcom: Add SDX55 GCC support Manivannan Sadhasivam
2020-11-05  2:23   ` Stephen Boyd
2020-11-05  8:51     ` Manivannan Sadhasivam [this message]
2020-11-13  7:58       ` Stephen Boyd
2020-10-28  7:42 ` [PATCH 3/4] dt-bindings: clock: Introduce RPMHCC bindings for SDX55 Manivannan Sadhasivam
2020-11-03 17:38   ` Bjorn Andersson
2020-10-28  7:42 ` [PATCH 4/4] clk: qcom: Add support for SDX55 RPMh clocks Manivannan Sadhasivam
2020-11-03 17:53   ` Bjorn Andersson
2020-11-05  2:25   ` Stephen Boyd
2020-10-28 17:08 ` [PATCH 0/4] Add GCC and RPMh clock support for SDX55 Manivannan Sadhasivam
2020-11-03 17:34   ` 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=20201105085148.GA7308@work \
    --to=manivannan.sadhasivam@linaro.org \
    --cc=bjorn.andersson@linaro.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=naveenky@codeaurora.org \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.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).