linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rahul Tanwar <rtanwar@maxlinear.com>
To: Stephen Boyd <sboyd@kernel.org>,
	"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
	"mturquette@baylibre.com" <mturquette@baylibre.com>
Cc: "linux-kernel@" <"vger.kernel.org linux-kernel"@vger.kernel.org>,
	linux-lgm-soc <linux-lgm-soc@maxlinear.com>,
	Yi xin Zhu <yzhu@maxlinear.com>
Subject: Re: [PATCH RESEND v2 3/5] clk: mxl: Avoid disabling gate clocks from clk driver
Date: Tue, 11 Oct 2022 07:28:56 +0000	[thread overview]
Message-ID: <MN2PR19MB3693031CD60B09AE87885F5BB1239@MN2PR19MB3693.namprd19.prod.outlook.com> (raw)
In-Reply-To: 20221005202037.E7B43C433C1@smtp.kernel.org

Hi Stephen,

On 6/10/2022 4:20 am, Stephen Boyd wrote:
> This email was sent from outside of MaxLinear.
> 
> 
> Quoting Rahul Tanwar (2022-10-05 02:36:00)
>>>>
>>>
>>> Why is the clk driver probing on the new SoCs? Is it providing
>>> something? Can we detect that the power management IP exists and not
>>> register these clks?
>>>
>>
>> We discussed in the team about not registering gate clks at all as you
>> mentioned. But if we do that, all peripheral drivers that use these clks
>> would need modifications so their probe does not fail due to failure
>> returns of clk related standard calls for e.g devm_clk_get(),
>> clk_prepare_enable(). These are standard calls in probe for all the
>> drivers and a lot of them use gate clks. So this would need a lot of
>> changes with possibility of breaking working functionalities.
> 
> Why? We can have clk_get() return NULL when these clks can't be used.
> This is how we implement "dummy" clks on systems where the clk provider
> can provide the clk but there's nothing to do for the clk operations.
> The clk API treats NULL as a valid clk but bails out early when calling
> any consumer APIs.
> 

I agree that what you are suggesting is the ideal way to handle such 
clks. If i understand you correctly, you are suggesting below (please 
correct me if i am mistaken):

1. Disable/remove such clocks from corresponding driver's devicetree 
nodes. This will make devm_clk_get() or clk_get() return failure.

2. Modify all drivers which use such clks

from:

    clk = devm_clk_get(...);
    if (IS_ERR(clk))
        return -ERROR;
    clk_prepare_enable(clk);
    clk_get/set_rate();
    ...

to:
    clk = devm_clk_get(...);
    if (!(IS_ERR(clk)) {
        clk_prepare_enable(clk);
        clk_get/set_rate();
        ...
    } else {
       // print error info - do nothing, no clk_ops calls
    }

But the problem that we have is that 80% of the clks that we use fall 
under this category (around 65 clks). And if we follow this approach, 
then we will have to make above changes in all of the drivers which use 
these clks & retest them again. That seems like a overhaul. We already 
keep a internal driver flag in each clk entry data structure and we 
already use it in the driver for other types of clks for e.g MUX_CLKs. 
So using the internal flag to handle this becomes a preferable & 
existing driver design aligned approach for us.

Thanks,
Rahul

>>
>> Also, i incorrectly mentioned about the reason being backward
>> compatibility with older SoCs. Main reason is to support different power
>> profiles use cases as per end product requirements some of which might
>> control it from clk framework i.e. this driver. We keep a internal
>> driver flag just for this purpose to provide this flexibility depending
>> on the use case which is what we have used here.
>>
>> I am sending v3 with more clear & correct description about it to
>> justify the need for these changes.
>>
> 
> Ok
> 
> 




  parent reply	other threads:[~2022-10-11  7:29 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22  6:24 [PATCH RESEND v2 0/5] Modify MxL's CGU clk driver to make it secure boot compatible Rahul Tanwar
2022-09-22  6:24 ` [PATCH RESEND v2 1/5] clk: mxl: Switch from direct readl/writel based IO to regmap based IO Rahul Tanwar
2022-09-29  0:14   ` Stephen Boyd
2022-09-29  5:29     ` Rahul Tanwar
2022-09-22  6:24 ` [PATCH RESEND v2 2/5] clk: mxl: Remove unnecessary spinlocks Rahul Tanwar
2022-09-29  0:16   ` Stephen Boyd
2022-09-29  5:37     ` Rahul Tanwar
2022-09-22  6:24 ` [PATCH RESEND v2 3/5] clk: mxl: Avoid disabling gate clocks from clk driver Rahul Tanwar
2022-09-29  0:17   ` Stephen Boyd
2022-09-29  5:45     ` Rahul Tanwar
     [not found]       ` <20220930010123.38984C4347C@smtp.kernel.org>
2022-10-05  9:36         ` Rahul Tanwar
     [not found]           ` <20221005202037.E7B43C433C1@smtp.kernel.org>
2022-10-11  7:28             ` Rahul Tanwar [this message]
     [not found]               ` <20221011174345.906BAC433D7@smtp.kernel.org>
2022-10-12  9:34                 ` Rahul Tanwar
2022-10-11  7:33             ` Rahul Tanwar
2022-10-05 10:52         ` Rahul Tanwar
2022-09-22  6:24 ` [PATCH RESEND v2 4/5] clk: mxl: Add validation for register reads/writes Rahul Tanwar
2022-09-29  0:20   ` Stephen Boyd
2022-09-29  6:10     ` Rahul Tanwar
     [not found]       ` <20220930010212.7860DC433C1@smtp.kernel.org>
2022-10-05  9:36         ` Rahul Tanwar
2022-10-05 10:52         ` Rahul Tanwar
2022-09-22  6:24 ` [PATCH RESEND v2 5/5] clk: mxl: Add a missing flag to allow parent clock rate change Rahul Tanwar
2022-09-29  0:18   ` Stephen Boyd
2022-09-29  5:46     ` Rahul Tanwar

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=MN2PR19MB3693031CD60B09AE87885F5BB1239@MN2PR19MB3693.namprd19.prod.outlook.com \
    --to=rtanwar@maxlinear.com \
    --cc="vger.kernel.org linux-kernel"@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-lgm-soc@maxlinear.com \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    --cc=yzhu@maxlinear.com \
    /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).