Linux clock framework development
 help / color / mirror / Atom feed
From: Emil Abildgaard Svendsen <EMAS@bang-olufsen.dk>
To: Stephen Boyd <sboyd@kernel.org>
Cc: Michael Turquette <mturquette@baylibre.com>,
	"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>
Subject: Re: [PATCH] clk: fixed: handle failed clk setup
Date: Wed, 25 Oct 2023 09:34:49 +0000	[thread overview]
Message-ID: <ZTjhLPl+TfeBiX0o@emil-HP-ZBook-Studio-G5> (raw)
In-Reply-To: <6ae70c7185bc8806299915181b282b19.sboyd@kernel.org>

On Tue, Oct 24, 2023 at 11:41:05AM -0700, Stephen Boyd wrote:
> Quoting Emil Abildgaard Svendsen (2023-10-24 07:54:28)
> > On Mon, Oct 23, 2023 at 08:14:01PM -0700, Stephen Boyd wrote:
> > > Quoting Emil Abildgaard Svendsen (2023-04-14 05:52:16)
> > > > When initializing clock providers "of_clk_init" will try and init
> > > > parents first. But if parent clock is provided by a platform driver it
> > > > can't. Then clocks will be forced on and OF_POPULATED flag will be set
> > > > blindly. So if setup failes e.g. with -EPROBE_DEFER the clock will not
> > > > be probed later on.
> > > > 
> > > > This patch will clear the OF_POPULATED falg if clock setup failes.
> > > 
> > > Are you actually running into a problem with of_clk_init() failing to
> > > register a fixed rate of fixed factor clk from DT?
> 
> Can you answer this question?

I wouldn't call it a problem with of_clk_init() because how does it know
when fixed-factor-clk fails to register a clock when the setup function
returns void? 

> > > I don't understand
> > > why that is happening. I agree it's good hygiene to clear the flag, but
> > > I don't see why this is failing.
> > 
> > The problem is of_clk_init() will not wait for clock providers
> > registered by a platform driver that returns -EPROBE_DEFER. Which can
> > result in final probe to be delayed quite a bit. If this happens and
> > CLK_OF_DECLARE tries to setup a fixed-factor-clock with a deferred
> > clock parent, it will fail.
> 
> Doesn't the 'force' local variable get set to true in this case, and
> then the fixed factor clk is registered anyway? The clk framework tries
> hard to let clks be registered in any order so that parents don't need
> to be registered before children. From what I remember, we want to wait
> for parents because of_clk_set_defaults() may fail otherwise.

Yes, the 'force' local variable get set. But it's the setup function of
fixed-factor-clk that fails to register the clock.

> > Clearing the flag will allow the
> > fixed-factor-clock to be probed after the clock provider has been
> > successfully created.
> 
> Got it. By clock provider you mean the parent, right?

Yes, you're correct.

  parent reply	other threads:[~2023-10-25  9:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-14 12:52 [PATCH] clk: fixed: handle failed clk setup Emil Abildgaard Svendsen
     [not found] ` <48bd83b09adf698976fd10f71463a553.sboyd@kernel.org>
2023-04-19  7:41   ` Emil Abildgaard Svendsen
2023-10-25  9:47   ` Emil Abildgaard Svendsen
     [not found] ` <a45ff881c83827189be308e2a8e4e13a.sboyd@kernel.org>
2023-10-24 14:54   ` Emil Abildgaard Svendsen
     [not found]     ` <6ae70c7185bc8806299915181b282b19.sboyd@kernel.org>
2023-10-25  9:34       ` Emil Abildgaard Svendsen [this message]
     [not found]         ` <ce50bcdaf831faa5dc63f5e505bde1f8.sboyd@kernel.org>
2023-10-26  9:40           ` Emil Abildgaard Svendsen
     [not found]             ` <1b3144e39af5c852f33891f313e72079.sboyd@kernel.org>
2023-10-27  8:56               ` Emil Abildgaard Svendsen
     [not found]                 ` <ef68b9e7704ce5f8a02a7067703b000c.sboyd@kernel.org>
2023-10-31  9:18                   ` Emil Abildgaard Svendsen

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=ZTjhLPl+TfeBiX0o@emil-HP-ZBook-Studio-G5 \
    --to=emas@bang-olufsen.dk \
    --cc=linux-clk@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@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