From: Stephen Boyd <sboyd@codeaurora.org>
To: Tero Kristo <t-kristo@ti.com>
Cc: mturquette@baylibre.com, linux-clk@vger.kernel.org,
ssantosh@kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, nm@ti.com
Subject: Re: [PATCHv2 3/3] clk: keystone: Add sci-clk driver support
Date: Fri, 16 Sep 2016 16:01:01 -0700 [thread overview]
Message-ID: <20160916230101.GM7243@codeaurora.org> (raw)
In-Reply-To: <827e0a46-3771-67a8-1414-0cbaf0e2548e@ti.com>
On 09/05, Tero Kristo wrote:
> On 03/09/16 02:32, Stephen Boyd wrote:
> >I still don't get it. We should be registering hw pointers in
> >probe and handing them out in the xlate function. Not register
> >hws in the xlate function and then handing them out as well. I
> >haven't reviewed anything else in this patch.
>
> Ok, let me try to explain the functionality.
>
> Probe time hw pointer registration is only needed for special clocks
> that require extra flags, like adding the spread spectrum flag.
> There is ever going to be only handful of these.
>
> Xlate checks out the sci_clk list, and picks up an existing hw clock
> if it is there. If not, it will create a new one. The reason this is
> done like this, the device IDs / clock IDs don't mean anything to
> the driver itself, the driver just passes these forward to the
> underlying SCI fwk. And, we don't have inherent knowledge of valid
> device / clock IDs either, the SCI fwk returns a failure if a
> specific clock ID is bad. The device / clock IDs are going to be
> different between different generations of SoC also, and in addition
> there can be holes in the ID ranges.
Ok. Thanks for the explanation.
I understand the desire to make this SoC agnostic and consumer/dt
driven. Constructor pattern and all. Unfortunately the OF clk
provider is a getter pattern; not a constructor pattern. I'm
seriously concerned about the locking here because we're in the
framework creating a clk and tying it into a consumer list which
could cause all sorts of problems if we want to reenter the
framework and register more clks. Recursion abounds and my head
explodes! The recursive clk prepare mutex is not something anyone
should be thrilled about keeping around.
So, just don't do this. Instead, register the clks during probe
that exist for the firmware. That list could be discoverable with
firmware calls, or known based on different compatible strings
from DT that have the soc name in it, or something else. Even
scanning the entire DT tree for
clocks = <&my_clk_node x y>
would be better, but probably hugely inefficient and outright
buggy with DT overlays so don't do it. If the firmware can't tell
us what clks are there, just have a table based on compatible
string and be done.
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2016-09-16 23:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-01 12:40 [PATCHv2 0/3] ARM: K2G: support for TI-SCI Clocks Tero Kristo
2016-09-01 12:40 ` [PATCHv2 1/3] Documentation: dt: Add TI SCI clock driver Tero Kristo
[not found] ` <1472733635-22661-2-git-send-email-t-kristo-l0cyMroinI0@public.gmane.org>
2016-09-12 13:10 ` Rob Herring
2016-09-23 8:04 ` Tero Kristo
[not found] ` <1472733635-22661-1-git-send-email-t-kristo-l0cyMroinI0@public.gmane.org>
2016-09-01 12:40 ` [PATCHv2 2/3] dt-binding: clock: Add k2g clock definitions Tero Kristo
2016-09-01 12:40 ` [PATCHv2 3/3] clk: keystone: Add sci-clk driver support Tero Kristo
[not found] ` <1472733635-22661-4-git-send-email-t-kristo-l0cyMroinI0@public.gmane.org>
2016-09-02 23:32 ` Stephen Boyd
2016-09-05 7:07 ` Tero Kristo
2016-09-16 23:01 ` Stephen Boyd [this message]
2016-09-23 8:06 ` Tero Kristo
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=20160916230101.GM7243@codeaurora.org \
--to=sboyd@codeaurora.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=nm@ti.com \
--cc=ssantosh@kernel.org \
--cc=t-kristo@ti.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).