From: t-kristo@ti•com (Tero Kristo)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCHv5 05/31] CLK: TI: add support for OMAP gate clock
Date: Mon, 19 Aug 2013 16:42:05 +0300 [thread overview]
Message-ID: <521220AD.4070308@ti.com> (raw)
In-Reply-To: <20130813110437.GK27165@e106331-lin.cambridge.arm.com>
On 08/13/2013 02:04 PM, Mark Rutland wrote:
> On Fri, Aug 02, 2013 at 05:25:24PM +0100, Tero Kristo wrote:
>> This node adds support for a clock node which allows control to the
>> clockdomain enable / disable.
>>
>> Signed-off-by: Tero Kristo <t-kristo@ti•com>
>> ---
>> .../devicetree/bindings/clock/ti/gate.txt | 41 ++++++++
>> arch/arm/mach-omap2/clock.h | 9 --
>> drivers/clk/ti/Makefile | 2 +-
>> drivers/clk/ti/gate.c | 106 ++++++++++++++++++++
>> include/linux/clk/ti.h | 8 ++
>> 5 files changed, 156 insertions(+), 10 deletions(-)
>> create mode 100644 Documentation/devicetree/bindings/clock/ti/gate.txt
>> create mode 100644 drivers/clk/ti/gate.c
>>
>> diff --git a/Documentation/devicetree/bindings/clock/ti/gate.txt b/Documentation/devicetree/bindings/clock/ti/gate.txt
>> new file mode 100644
>> index 0000000..620a73d
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/clock/ti/gate.txt
>> @@ -0,0 +1,41 @@
>> +Binding for Texas Instruments gate clock.
>> +
>> +This binding uses the common clock binding[1]. This clock is
>> +quite much similar to the basic gate-clock [2], however,
>> +it supports a number of additional features. If no register
>> +is provided for this clock, the code assumes that a clockdomain
>> +will be controlled instead and the corresponding hw-ops for
>> +that is used.
>> +
>> +[1] Documentation/devicetree/bindings/clock/clock-bindings.txt
>> +[2] Documentation/devicetree/bindings/clock/gate-clock.txt
>> +
>> +Required properties:
>> +- compatible : shall be "ti,gate-clock"
>> +- #clock-cells : from common clock binding; shall be set to 0
>> +- clocks : link to phandle of parent clock
>> +
>> +Optional properties:
>> +- reg : base address for register controlling adjustable gate
>
> Optional? That's odd. If I have a clock with registers, but don't
> specify the register, will it still work? i.e. are registerless clocks
> really compatible with clocks with registers?.
I think I implemented this in somewhat confusing manner. This could be
split to:
ti,gate-clock:
requires reg and ti,enable-bit info
ti,clkdm-clock:
requires ti,clkdm-name
clkdm clock is kind of a master clock for clockdomain, the clock is
provided always if the clockdomain is active.
>
>> +- ti,enable-bit : bit shift for programming the clock gate
>
> Why is this needed? Does the hardware vary wildly, or are several clocks
> sharing the same register(s)?
Yea, same register is shared.
>
>> +- ti,dss-clk : use DSS hardware OPS for the clock
>> +- ti,am35xx-clk : use AM35xx hardware OPS for the clock
>
> Those last two sounds like the kind of thing that should be derived from
> the compatible string (e.g. ti,am35xx-gate-clock).
Hmm yea, I think I can change this and add some sub-types.
>
>> +- ti,clkdm-name : clockdomain to control this gate
>
> As previously mentioned, I'm not a fan of this property. It would make
> more sense to describe the domain and have an explicit link to it
> (either nodes being children of the domain or having a phandle).
Same comments as with patch #2.
>
> [...]
>
>> +void __init of_omap_gate_clk_setup(struct device_node *node)
>> +{
>> + struct clk *clk;
>> + struct clk_init_data init = { 0 };
>> + struct clk_hw_omap *clk_hw;
>> + const char *clk_name = node->name;
>> + int num_parents;
>> + const char **parent_names = NULL;
>> + int i;
>> + u32 val;
>> +
>> + clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
>> + if (!clk_hw) {
>> + pr_err("%s: could not allocate clk_hw_omap\n", __func__);
>> + return;
>> + }
>> +
>> + clk_hw->hw.init = &init;
>> +
>> + of_property_read_string(node, "clock-output-names", &clk_name);
>> + of_property_read_string(node, "ti,clkdm-name", &clk_hw->clkdm_name);
>> +
>> + init.name = clk_name;
>> + init.flags = 0;
>> +
>> + if (of_property_read_u32_index(node, "reg", 0, &val)) {
>> + /* No register, clkdm control only */
>> + init.ops = &omap_gate_clkdm_clk_ops;
>
> If they're truly compatible, you can just see if you can of_iomap, and
> if not, continue. Your reg values might be wider than 32 bits, and usig
> of_property_read_u32 to read this feels wrong.
I'll split this to two separate supported types.
>
>> + } else {
>> + init.ops = &omap_gate_clk_ops;
>> + clk_hw->enable_reg = of_iomap(node, 0);
>> + of_property_read_u32(node, "ti,enable-bit", &val);
>> + clk_hw->enable_bit = val;
>
> What if of_property_read_u32 failed to read the "ti,enable-bit"
> property? One might not be present, it's marked as optional in the
> binding description.
I'll make sure this is present in case it is needed.
>
>> +
>> + clk_hw->ops = &clkhwops_wait;
>> +
>> + if (of_property_read_bool(node, "ti,dss-clk"))
>> + clk_hw->ops = &clkhwops_omap3430es2_dss_usbhost_wait;
>> +
>> + if (of_property_read_bool(node, "ti,am35xx-clk"))
>> + clk_hw->ops = &clkhwops_am35xx_ipss_module_wait;
>
> I really don't like this. I think this should be done based on the
> compatible string.
Yea, will change.
-Tero
next prev parent reply other threads:[~2013-08-19 13:42 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
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 [this message]
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=521220AD.4070308@ti.com \
--to=t-kristo@ti$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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