From: t-kristo@ti.com (Tero Kristo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv5 02/31] CLK: TI: Add DPLL clock support
Date: Wed, 21 Aug 2013 19:16:45 +0300 [thread overview]
Message-ID: <5214E7ED.80909@ti.com> (raw)
In-Reply-To: <20130819220006.4443.23042@quantum>
On 08/20/2013 01:00 AM, Mike Turquette wrote:
> Quoting Tero Kristo (2013-08-19 10:06:39)
>> On 08/19/2013 07:24 PM, Mark Rutland wrote:
>>> On Mon, Aug 19, 2013 at 04:09:37PM +0100, Tero Kristo wrote:
>>>> On 08/19/2013 05:18 PM, Mark Rutland wrote:
>>>>> On Mon, Aug 19, 2013 at 02:34:45PM +0100, Tero Kristo wrote:
>>>>>> On 08/13/2013 01:50 PM, Mark Rutland wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> On Fri, Aug 02, 2013 at 05:25:21PM +0100, Tero Kristo wrote:
>>>>>>>> The OMAP clock driver now supports DPLL clock type. This patch also
>>>>>>>> adds support for DT DPLL nodes.
>>>>>>>>
>>>>>>>> Signed-off-by: Tero Kristo <t-kristo@ti.com>
>>>>>>>> ---
>>>>>>>> .../devicetree/bindings/clock/ti/dpll.txt | 70 +++
>>>>>>>> arch/arm/mach-omap2/clock.h | 144 +-----
>>>>>>>> arch/arm/mach-omap2/clock3xxx.h | 2 -
>>>>>>>> drivers/clk/Makefile | 1 +
>>>>>>>> drivers/clk/ti/Makefile | 3 +
>>>>>>>> drivers/clk/ti/dpll.c | 488 ++++++++++++++++++++
>>>>>>>> include/linux/clk/ti.h | 164 +++++++
>>>>>>>> 7 files changed, 727 insertions(+), 145 deletions(-)
>>>>>>>> create mode 100644 Documentation/devicetree/bindings/clock/ti/dpll.txt
>>>>>>>> create mode 100644 drivers/clk/ti/Makefile
>>>>>>>> create mode 100644 drivers/clk/ti/dpll.c
>>>>>>>> create mode 100644 include/linux/clk/ti.h
>>>>>>>>
>>>>>>>> diff --git a/Documentation/devicetree/bindings/clock/ti/dpll.txt b/Documentation/devicetree/bindings/clock/ti/dpll.txt
>>>>>>>> new file mode 100644
>>>>>>>> index 0000000..dcd6e63
>>>>>>>> --- /dev/null
>>>>>>>> +++ b/Documentation/devicetree/bindings/clock/ti/dpll.txt
>>>>>>>> @@ -0,0 +1,70 @@
>>>>>>>> +Binding for Texas Instruments DPLL clock.
>>>>>>>> +
>>>>>>>> +This binding uses the common clock binding[1]. It assumes a
>>>>>>>> +register-mapped DPLL with usually two selectable input clocks
>>>>>>>> +(reference clock and bypass clock), with digital phase locked
>>>>>>>> +loop logic for multiplying the input clock to a desired output
>>>>>>>> +clock. This clock also typically supports different operation
>>>>>>>> +modes (locked, low power stop etc.) This binding has several
>>>>>>>> +sub-types, which effectively result in slightly different setup
>>>>>>>> +for the actual DPLL clock.
>>>>>>>> +
>>>>>>>> +[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
>>>>>>>> +
>>>>>>>> +Required properties:
>>>>>>>> +- compatible : shall be one of:
>>>>>>>> + "ti,omap4-dpll-x2-clock",
>>>>>>>> + "ti,omap3-dpll-clock",
>>>>>>>> + "ti,omap3-dpll-core-clock",
>>>>>>>> + "ti,omap3-dpll-per-clock",
>>>>>>>> + "ti,omap3-dpll-per-j-type-clock",
>>>>>>>> + "ti,omap4-dpll-clock",
>>>>>>>> + "ti,omap4-dpll-core-clock",
>>>>>>>> + "ti,omap4-dpll-m4xen-clock",
>>>>>>>> + "ti,omap4-dpll-j-type-clock",
>>>>>>>> + "ti,omap4-dpll-no-gate-clock",
>>>>>>>> + "ti,omap4-dpll-no-gate-j-type-clock",
>>>>>>>> +
>>>>>>>> +- #clock-cells : from common clock binding; shall be set to 0.
>>>>>>>> +- clocks : link phandles of parent clocks (clk-ref and clk-bypass)
>>>>>>>
>>>>>>> It might be a good idea to use clock-names to clarify which clocks are
>>>>>>> present (I notice your examples contain only one clock input).
>>>>>>
>>>>>> All DPLLs have both bypass and reference clocks, but these can be the
>>>>>> same. Is it better to just list both always (and hence drop
>>>>>> clock-names), or provide clock-names always?
>>>>>
>>>>> If they're separate inputs, it's worth listing both (even if they're fed
>>>>> by the same provider). If it's possible one input might not be wired up,
>>>>> use clock-names.
>>>>
>>>> Ref and bypass clocks are used currently by all DPLLs (also the APLL) so
>>>> I guess I just enforce both to be specified.
>>>
>>> Ok. It's always possible to add clock-names later if a platform doesn't
>>> wire an input. We lose the possibility of future compatibility, but
>>> backwards compatibility is easy enough to maintain.
>>>
>>>>>>>> +- ti,clkdm-name : clockdomain name for the DPLL
>>>>>>>
>>>>>>> Could you elaborate on what this is for? What constitutes a valid name?
>>>>>>>
>>>>>>> I'm not sure a string is the best way to define the linkage of several
>>>>>>> elements to a domain...
>>>>>>
>>>>>> Well, I am not sure if we can do this any better at this point, we don't
>>>>>> have DT nodes for clockdomain at the moment (I am not sure if we will
>>>>>> have those either as there are only a handful of those per SoC) but I'll
>>>>>> add some more documentation for this.
>>>>>
>>>>> I'll have to see the documentation, but I'd be very wary of putting that
>>>>> in as-is. Does having the clock domain string link this up to domains in
>>>>> platform data?
>>>>>
>>>>> I'm not sure how well we'll be able to maintain support for that in
>>>>> future if it requires other platform code to use now, and we're not sure
>>>>> how the domains themselves will be represented in dt.
>>>>
>>>> Hmm so, should I add a stub representation for the clockdomains to the
>>>> DT then for now or how should this be handled? The stubs could then be
>>>> mapped to the actual clock domains based on their node names.
>
> I'm not sure that this binding should know about the clock domain at
> all. Maybe the clock domain binding should list the clocks that are
> within the domain?
Ok, I experimented with this stuff a bit to have a proper reply, and it
looks like I can get this done with a clockdomain mapping, which has its
own binding. Something like this:
clockdomains {
usbhost_clkdm: usbhost_clkdm {
compatible = "ti,clockdomain";
clocks = <&usbhost_48m_fck>, <&usbhost_ick>;
};
};
Mike, what is your approach on this? Are you okay having the
implementation for this under drivers/clk? I recall you mentioned
earlier that you don't want clockdomain stuff under drivers/clk, hence I
am asking.
Here is the initial implementation for the binding:
void __init of_omap_clockdomain_setup(struct device_node *node)
{
struct clk *clk;
struct clk_hw *clk_hw;
const char *clkdm_name = node->name;
int i;
int num_clks;
num_clks = of_count_phandle_with_args(node, "clocks",
"#clock-cells");
for (i = 0; i < num_clks; i++) {
clk = of_clk_get(node, i);
if (__clk_get_flags(clk) & CLK_IS_BASIC) {
pr_warn("%s: can't setup clkdm for basic clk %s\n",
__func__, __clk_get_name(clk));
continue;
}
clk_hw = __clk_get_hw(clk);
to_clk_hw_omap(clk_hw)->clkdm_name = clkdm_name;
omap2_init_clk_clkdm(clk_hw);
}
}
CLK_OF_DECLARE(omap_clockdomain, "ti,clockdomain",
of_omap_clockdomain_setup);
>
>>>>
>>>
>>> I unfortunately don't have a good answer here, because I'm not that
>>> familiar with how we handle clockdomains for power management purposes.
>>>
>>> As I understand it, each clock domain is essentially a clock gate
>>> controlling multiple clock signals, so it's possible to describe that
>>> with the common clock bindings, with a domain's clocks all coming from a
>>> "domain-gate-clock" node (or something like that). That would make the
>>> wiring of clocks to a domain explicit and in line with the rest of the
>>> common clock bindings. But perhaps I've simplified things a bit too
>>> far.
>>
>> You got it basically right, but maybe oversimplified it a bit. The
>> root/parent clocks can still cross clockdomain boundaries, so mapping
>> everything under a simple clockdomain gate would not work. Basically
>> each clock has a mapping on the SoC for both its parent clock signal and
>> the clockdomain association, kind of having two parents at the same
>> time. In OMAP case, most of the clockdomains support hardware autoidle
>> type functionality, which puts the domain to idle once all the clocks on
>> it are disabled.
>
> I always thought that OMAP clock domains were poorly named. Seems to me
> that they had more to do with the IP/module programming than clocks per
> se. Again, I'm not sure that putting clkdm data into this binding is
> correct.
>
> Is it because you want a call to clk_enable to program the clock domain
> in the .enable callback? I always thought that this was better left to a
> pm_runtime_get callback...
My guess is that some clocks require the clockdomain itself to be forced
on before they are enabled, some of the DPLLs do this for example. I am
just trying not to cause any regressions with this set, thus attempting
to keep most of the implementation specifics intact.
-Tero
>
> Regards,
> Mike
>
>>
>> -Tero
>>
>>> I'm not sure how easy it would be to use that information for power
>>> management. I don't know what the kernel logic for clock domain power
>>> management needs to know about consumers of the clocks and how it would
>>> need to poke those consumers.
>>
>>>
>>> Cheers,
>>> Mark.
>>>
next prev parent reply other threads:[~2013-08-21 16:16 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-02 16:25 [PATCHv5 00/31] CLK: OMAP conversion to DT Tero Kristo
2013-08-02 16:25 ` [PATCHv5 01/31] CLK: clkdev: add support for looking up clocks from DT Tero Kristo
2013-08-03 14:02 ` Tomasz Figa
2013-08-03 18:35 ` Russell King - ARM Linux
2013-08-03 18:39 ` Tomasz Figa
2013-08-03 18:48 ` Russell King - ARM Linux
2013-08-03 19:04 ` Tomasz Figa
2013-08-19 9:12 ` Tero Kristo
2013-08-03 18:31 ` Russell King - ARM Linux
2013-08-26 14:36 ` Tero Kristo
2013-08-26 17:03 ` Russell King - ARM Linux
2013-08-26 18:12 ` Tero Kristo
2013-08-27 6:55 ` Tony Lindgren
2013-08-02 16:25 ` [PATCHv5 02/31] CLK: TI: Add DPLL clock support Tero Kristo
2013-08-13 10:50 ` Mark Rutland
2013-08-19 13:34 ` Tero Kristo
2013-08-19 14:18 ` Mark Rutland
2013-08-19 15:09 ` Tero Kristo
2013-08-19 16:24 ` Mark Rutland
2013-08-19 17:06 ` Tero Kristo
2013-08-19 22:00 ` Mike Turquette
2013-08-21 16:16 ` Tero Kristo [this message]
2013-08-22 8:04 ` Mike Turquette
2013-08-02 16:25 ` [PATCHv5 03/31] CLK: TI: add DT alias clock registration mechanism Tero Kristo
2013-08-02 16:25 ` [PATCHv5 04/31] CLK: TI: add autoidle support Tero Kristo
2013-08-02 16:25 ` [PATCHv5 05/31] CLK: TI: add support for OMAP gate clock Tero Kristo
2013-08-13 11:04 ` Mark Rutland
2013-08-19 13:42 ` Tero Kristo
2013-08-19 14:29 ` Mark Rutland
2013-08-19 14:43 ` Tero Kristo
2013-08-19 15:58 ` Mark Rutland
2013-08-19 16:19 ` Tero Kristo
2013-08-02 16:25 ` [PATCHv5 06/31] ARM: dts: omap4 clock data Tero Kristo
2013-08-03 14:16 ` Tomasz Figa
2013-08-19 13:43 ` Tero Kristo
2013-08-02 16:25 ` [PATCHv5 07/31] CLK: TI: add omap4 clock init file Tero Kristo
2013-08-05 7:27 ` Tony Lindgren
2013-08-19 13:46 ` Tero Kristo
2013-08-02 16:25 ` [PATCHv5 08/31] ARM: OMAP4: remove old clock data and link in new clock init code Tero Kristo
2013-08-02 16:25 ` [PATCHv5 09/31] ARM: dts: omap5 clock data Tero Kristo
2013-08-02 16:25 ` [PATCHv5 10/31] CLK: TI: add omap5 clock init file Tero Kristo
2013-08-02 16:25 ` [PATCHv5 11/31] CLK: TI: omap5: Initialize USB_DPLL at boot Tero Kristo
2013-08-02 16:25 ` [PATCHv5 12/31] ARM: dts: dra7 clock data Tero Kristo
2013-08-02 16:25 ` [PATCHv5 13/31] ARM: dts: clk: Add apll related clocks Tero Kristo
2013-08-02 16:25 ` [PATCHv5 14/31] ARM: dts: DRA7: Change apll_pcie_m2_ck to fixed factor clock Tero Kristo
2013-08-02 16:25 ` [PATCHv5 15/31] ARM: dts: DRA7: Add PCIe related clock nodes Tero Kristo
2013-08-02 16:25 ` [PATCHv5 16/31] CLK: TI: DRA7: Add APLL support Tero Kristo
2013-08-13 11:14 ` Mark Rutland
2013-08-19 13:52 ` Tero Kristo
2013-08-20 4:09 ` Keerthy
2013-08-02 16:25 ` [PATCHv5 17/31] CLK: TI: add dra7 clock init file Tero Kristo
2013-08-02 16:25 ` [PATCHv5 18/31] CLK: DT: add support for set-rate-parent flag Tero Kristo
2013-08-13 11:25 ` Mark Rutland
2013-08-02 16:25 ` [PATCHv5 19/31] ARM: dts: am33xx clock data Tero Kristo
2013-08-02 16:25 ` [PATCHv5 20/31] CLK: TI: add am33xx clock init file Tero Kristo
2013-08-02 16:25 ` [PATCHv5 21/31] ARM: AM33xx: remove old clock data and link in new clock init code Tero Kristo
2013-08-02 16:25 ` [PATCHv5 22/31] CLK: TI: add interface clock support for OMAP3 Tero Kristo
2013-08-13 11:30 ` Mark Rutland
2013-08-19 13:54 ` Tero Kristo
2013-08-02 16:25 ` [PATCHv5 23/31] ARM: OMAP: hwmod: fix an incorrect clk type cast with _get_clkdm Tero Kristo
2013-08-02 16:25 ` [PATCHv5 24/31] CLK: TI: gate: add support for OMAP36xx dpllx_mx_ck:s Tero Kristo
2013-08-02 16:25 ` [PATCHv5 25/31] ARM: OMAP3: hwmod: initialize clkdm from clkdm_name Tero Kristo
2013-08-02 16:25 ` [PATCHv5 26/31] ARM: dts: omap3 clock data Tero Kristo
2013-08-02 16:25 ` [PATCHv5 27/31] CLK: TI: add omap3 clock init file Tero Kristo
2013-08-02 16:25 ` [PATCHv5 28/31] ARM: dts: AM35xx clock data Tero Kristo
2013-08-02 16:25 ` [PATCHv5 29/31] ARM: dts: AM35xx: use DT " Tero Kristo
2013-08-02 16:25 ` [PATCHv5 30/31] ARM: OMAP3: use DT clock init if DT data is available Tero Kristo
2013-08-02 16:25 ` [PATCHv5 31/31] ARM: dts: am43xx clock data 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=5214E7ED.80909@ti.com \
--to=t-kristo@ti.com \
--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).