linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] clk: defer clk_gets on orphan clocks
Date: Fri, 29 Jan 2016 11:54:55 -0800	[thread overview]
Message-ID: <20160129195455.GQ12841@codeaurora.org> (raw)
In-Reply-To: <7262598.5pX8AAxUPK@diego>

On 01/28, Heiko St?bner wrote:
> Am Donnerstag, 28. Januar 2016, 00:23:24 schrieb Stephen Boyd:
> > On 01/21, Emilio L?pez wrote:
> > > @@ -3059,7 +3069,25 @@ struct clk *__of_clk_get_from_provider(struct
> > > of_phandle_args *clkspec,> 
> > >   */
> > >  
> > >  struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec)
> > >  {
> > > 
> > > -	return __of_clk_get_from_provider(clkspec, NULL, __func__);
> > > +	return __of_clk_get_from_provider(clkspec, NULL, __func__, false);
> > > +}
> > > +
> > > +/**
> > > + * of_clk_get_from_provider_with_orphans() - Lookup clock from a clock
> > > provider + * @clkspec: pointer to a clock specifier data structure
> > > + *
> > > + * This function looks up a struct clk from the registered list of clock
> > > + * providers, an input is a clock specifier data structure as returned
> > > + * from the of_parse_phandle_with_args() function call.
> > > + *
> > > + * The difference to of_clk_get_from_provider() is that this function
> > > will
> > > + * also successfully lookup orphan-clocks, as it in some cases may be
> > > + * necessary to access such orphan-clocks as well.
> > > + */
> > > +struct clk *
> > > +of_clk_get_from_provider_with_orphans(struct of_phandle_args *clkspec)
> > 
> > Dislike. In fact, the whole clk conf approach is odd here. When
> > we're doing of_clk_init() we do a best effort loop around
> > parent_ready(), waiting for clk providers to register as long as
> > we have a clocks property in our provider node. We should do
> > something similar in the non of_clk_init() case too, because
> > of_clk_init() isn't special.
> 
> At least to me being able to reparent orphan clocks when knowing that they 
> won't ever get supplied is special.
> 
> The Rockchip clock controller has quite a number of clocks that can either be 
> supplied by some external source. xin32k supplied by some i2c chip being the 
> most prominent. But while this one will get supplied eventually, there are 
> others who will never get a supply and stay orphans forever.
> 
> Example:
> rk3288 sclk_edp_24m can get supplied by either the general 24MHz oscillator or 
> some separate clock input connected some chip pin. Reset-default seems to be 
> the external supply, but on all boards I've seen so far doesn't get connected.
> 
> So we know on a per-board level if this is connected and want to move away 
> from the non-existent source. Which is why the limit of this new function is 
> limited to be ccf internal and the assigned-clock-parents path.

Right, this problem isn't limited to clk-conf though. If some
clock is orphaned by its reset default, then consumers that want
to reparent them to something else will never be able to get the
clocks without some sort of clk_get_ignore_orphan() API. We can't
rely on DTS files telling us to do the reparent. This is a whole
other problem to be dealt with before we can defer clk_get()
orphans.

In this case, I wonder why we haven't specified some sort of
"ground" clock that has a rate of 0? In the example above, I
would imagine that we have our dts file specify a fixed rate
clock with frequency of 0 that's named whatever the external
supply clock is named when that pin isn't connected.

> 
> 
> I guess if you really dislike that approach the other option would be 
> reparenting all the time in the clock-controller driver and then let the 
> board-dts reparent back if needed. Which would also work for that clock, but 
> may cause other glitches down the road when it affects some pre-setup things.
> 
> 

For all we know that could cause some audio pop on a speaker 
something. Let's avoid this if we can.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

      reply	other threads:[~2016-01-29 19:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-21 14:10 [PATCH 0/2] defer clk_gets on orphan clocks Emilio López
2016-01-21 14:10 ` [PATCH 1/2] clk: sunxi: delay protected clocks until arch initcall Emilio López
2016-01-27 15:37   ` Maxime Ripard
2016-01-27 16:14     ` Heiko Stübner
2016-01-27 20:38       ` Maxime Ripard
2016-01-27 21:07         ` Heiko Stübner
2016-01-27 18:53     ` Emilio López
2016-02-01 19:32       ` Maxime Ripard
2016-01-21 14:19 ` [PATCH 2/2] clk: defer clk_gets on orphan clocks Emilio López
2016-01-28  8:23   ` Stephen Boyd
2016-01-28  9:03     ` Heiko Stübner
2016-01-29 19:54       ` Stephen Boyd [this message]

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=20160129195455.GQ12841@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.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).