From: nm@ti•com (Nishanth Menon)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCHv9 04/43] CLK: TI: Add DPLL clock support
Date: Thu, 31 Oct 2013 10:25:02 -0500 [thread overview]
Message-ID: <5272764E.6070707@ti.com> (raw)
In-Reply-To: <52726F89.4000409@ti.com>
On 10/31/2013 09:56 AM, Tero Kristo wrote:
> On 10/31/2013 04:19 PM, Nishanth Menon wrote:
>> On 10/25/2013 10:56 AM, Tero Kristo wrote:
>> [...]
>>
>>> diff --git a/Documentation/devicetree/bindings/clock/ti/dpll.txt b/Documentation/devicetree/bindings/clock/ti/dpll.txt
>>> new file mode 100644
>>> index 0000000..7b87721
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/clock/ti/dpll.txt
[...]
>>
>>> + ti,am3-* dpll types list the registers in the same order, except "autoidle"
>>> + register is left out as this hardware does not have it, e.g.:
>>> + reg = <0x40>, <0x50>, <0x60>;
>>> + results in following register map:
>>> + base + 0x40 - control
>>> + base + 0x50 - idlest
>>> + base + 0x60 - mult-div1
>>> +
>>> +Optional properties:
>>> +- DPLL mode setting - defining any one or more of the following overrides
>>> + default setting.
>>> + - ti,low-power-stop : DPLL supports low power stop mode, gating output
>>> + - ti,low-power-bypass : DPLL output matches rate of parent bypass clock
>>> + - ti,lock : DPLL locks in programmed rate
>>
>>> arch/arm/mach-omap2/cclock3xxx_data.c: .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
>>> arch/arm/mach-omap2/cclock3xxx_data.c: .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
>>> arch/arm/mach-omap2/cclock3xxx_data.c: .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
>>> arch/arm/mach-omap2/cclock3xxx_data.c: .modes = ((1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED) |
>>> arch/arm/mach-omap2/cclock3xxx_data.c: .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
>>> arch/arm/mach-omap2/dpll3xxx.c: _omap3_dpll_write_clken(clk, DPLL_LOCKED);
>>
>> There is no if checks for DPLL_LOCKED which is set with ti,lock,
>> should we just drop it?
>
> Probably better to keep it in, as there might be some code in future
> which needs this. Kind of better for readability also, as the field is
> specified to list the valid modes for the DPLL. One could argue that
> current kernel code is wrong for _omap3_dpll_write_clken(clk,
> DPLL_LOCKED) as it does not check if the mode is valid for the DPLL or not.
yep, the thought did cross my mind.
>
>>
>> [...]
>>> diff --git a/drivers/clk/ti/dpll.c b/drivers/clk/ti/dpll.c
>>> new file mode 100644
>>> index 0000000..89733c9
>>> --- /dev/null
>>> +++ b/drivers/clk/ti/dpll.c
>>
>> [...]
>>
>>> +/**
>>> + * ti_clk_register_dpll() - Registers the DPLL clock
>>> + * @name: Name of the clock node
>>> + * @parent_names: list of parent names
>>> + * @num_parents: num of parents in parent_names
>>> + * @flags: init flags
>>> + * @dpll_data: DPLL data
>>> + * @ops: ops for DPLL
>>> + */
>>> +static struct clk *ti_clk_register_dpll(const char *name,
>>> + const char **parent_names,
>>> + int num_parents, unsigned long flags,
>>> + struct dpll_data *dpll_data,
>>> + const struct clk_ops *ops,
>>> + struct regmap *regmap)
>>> +{
>>> + struct clk *clk;
>>> + struct clk_init_data init = { NULL };
>>> + struct clk_hw_omap *clk_hw;
>>> +
>>> + /* allocate the divider */
>>> + clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
>>> + if (!clk_hw) {
>>> + pr_err("%s: could not allocate clk_hw_omap\n", __func__);
>>
>> here and in every other driver - please dont add pr_err for kzalloc
>> not able to allocate, kzalloc will provide the warning anyways.
>
> Oh it does? Never seen that happen as kzalloc never failed for me. :)
> However, I can remove these as I don't think they will ever happen anyway.
There have been cleanups such as commit
38bb5253a95f2eb8cb765b7ab88aac686de6cb12 etc.. we dont want to
introduce new ones now.
>>> + clk_hw->ops = hw_ops;
>>> + of_property_read_u32(node, "reg", (u32 *)&clk_hw->clksel_reg);
>>> + clk_hw->regmap = regmap;
>>> + clk_hw->hw.init = &init;
>>> +
>>> + init.name = name;
>>> + init.ops = ops;
>>> + init.parent_names = &parent_name;
>>> + init.num_parents = 1;
>>> +
>>> + /* register the clock */
>>> + clk = clk_register(NULL, &clk_hw->hw);
>>> +
>>> + if (IS_ERR(clk))
>>> + kfree(clk_hw);
>>> + else
>>> + omap2_init_clk_hw_omap_clocks(clk);
>>> +
>>> + return clk;
>>> +}
>>> +#endif
>> [...]
>>> +
>>> +#ifdef CONFIG_ARCH_OMAP3
>>
>> just a mention - I understand we are still in transition and we need
>> these #ifdefs, but eventually, we should be able to make the dpll.c
>> independent of SoC variant #ifdefs.
>
> Eventually yes. Currently it fails to compile if you do OMAP4 / OMAP5
> only build, as you don't have the OMAP3 support routines in.
fair enough.
--
Regards,
Nishanth Menon
next prev parent reply other threads:[~2013-10-31 15:25 UTC|newest]
Thread overview: 106+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-25 15:56 [PATCHv9 00/43] ARM: TI SoC clock DT conversion Tero Kristo
2013-10-25 15:56 ` [PATCHv9 01/43] clk: Add support for regmap register read/write Tero Kristo
2013-10-31 14:03 ` Nishanth Menon
2013-10-31 14:40 ` Tero Kristo
2013-10-31 15:46 ` Nishanth Menon
2013-11-01 8:57 ` Tero Kristo
2013-11-05 21:43 ` Gerhard Sittig
2013-11-06 10:54 ` Tero Kristo
2013-11-02 13:26 ` Tomasz Figa
2013-10-25 15:56 ` [PATCHv9 02/43] clk: divider: add init call which supports regmap Tero Kristo
2013-10-25 15:56 ` [PATCHv9 03/43] clk: mux: " Tero Kristo
2013-10-25 15:56 ` [PATCHv9 04/43] CLK: TI: Add DPLL clock support Tero Kristo
2013-10-31 14:19 ` Nishanth Menon
2013-10-31 14:56 ` Tero Kristo
2013-10-31 15:25 ` Nishanth Menon [this message]
2013-10-25 15:56 ` [PATCHv9 05/43] CLK: TI: add DT alias clock registration mechanism Tero Kristo
2013-10-29 17:50 ` Matt Sealey
2013-10-30 8:29 ` Tero Kristo
2013-10-30 17:38 ` Matt Sealey
2013-10-31 9:18 ` Tero Kristo
2013-11-02 13:49 ` Tomasz Figa
2013-11-04 22:45 ` Matt Sealey
2013-10-25 15:57 ` [PATCHv9 06/43] CLK: ti: add init support for clock IP blocks Tero Kristo
2013-10-31 15:42 ` Nishanth Menon
2013-11-01 9:12 ` Tero Kristo
2013-11-01 19:13 ` Nishanth Menon
2013-11-04 7:23 ` Tero Kristo
2013-10-25 15:57 ` [PATCHv9 07/43] CLK: TI: add autoidle support Tero Kristo
2013-10-31 16:05 ` Nishanth Menon
2013-11-01 9:18 ` Tero Kristo
2013-11-01 19:16 ` Nishanth Menon
2013-11-04 10:00 ` Tero Kristo
2013-11-04 14:59 ` Nishanth Menon
2013-11-05 8:10 ` Tero Kristo
2013-10-25 15:57 ` [PATCHv9 08/43] clk: ti: add composite clock support Tero Kristo
2013-10-31 16:27 ` Nishanth Menon
2013-10-31 16:32 ` Nishanth Menon
2013-11-01 9:40 ` Tero Kristo
2013-11-01 9:35 ` Tero Kristo
2013-11-01 19:24 ` Nishanth Menon
2013-10-25 15:57 ` [PATCHv9 09/43] CLK: ti: add support for ti divider-clock Tero Kristo
2013-10-31 18:02 ` Nishanth Menon
2013-11-01 9:48 ` Tero Kristo
2013-11-01 9:54 ` Tero Kristo
2013-11-01 19:35 ` Nishanth Menon
2013-11-04 10:54 ` Tero Kristo
2013-10-25 15:57 ` [PATCHv9 10/43] clk: ti: add support for TI fixed factor clock Tero Kristo
2013-10-31 18:12 ` Nishanth Menon
2013-11-01 9:52 ` Tero Kristo
2013-10-25 15:57 ` [PATCHv9 11/43] CLK: TI: add support for gate clock Tero Kristo
2013-11-01 20:11 ` Nishanth Menon
2013-11-04 12:23 ` Tero Kristo
2013-10-25 15:57 ` [PATCHv9 12/43] CLK: TI: add support for clockdomain binding Tero Kristo
2013-11-01 20:22 ` Nishanth Menon
2013-11-04 14:30 ` Tero Kristo
2013-10-25 15:57 ` [PATCHv9 13/43] clk: ti: add support for basic mux clock Tero Kristo
2013-11-01 21:01 ` Nishanth Menon
2013-11-05 8:09 ` Tero Kristo
2013-10-25 15:57 ` [PATCHv9 14/43] CLK: TI: add omap4 clock init file Tero Kristo
2013-10-25 15:57 ` [PATCHv9 15/43] CLK: TI: add omap5 " Tero Kristo
2013-10-25 15:57 ` [PATCHv9 16/43] CLK: TI: omap5: Initialize USB_DPLL at boot Tero Kristo
2013-10-25 15:57 ` [PATCHv9 17/43] CLK: TI: DRA7: Add APLL support Tero Kristo
2013-10-25 15:57 ` [PATCHv9 18/43] CLK: TI: add dra7 clock init file Tero Kristo
2013-10-25 15:57 ` [PATCHv9 19/43] CLK: TI: add am33xx " Tero Kristo
2013-10-25 15:57 ` [PATCHv9 20/43] CLK: TI: add interface clock support for OMAP3 Tero Kristo
2013-10-25 15:57 ` [PATCHv9 21/43] CLK: TI: add omap3 clock init file Tero Kristo
2013-10-25 15:57 ` [PATCHv9 22/43] CLK: TI: add am43xx " Tero Kristo
2013-10-25 15:57 ` [PATCHv9 23/43] ARM: dts: omap4 clock data Tero Kristo
2013-10-25 15:57 ` [PATCHv9 24/43] ARM: dts: omap5 " Tero Kristo
2013-10-25 15:57 ` [PATCHv9 25/43] ARM: dts: dra7 " Tero Kristo
2013-10-25 15:57 ` [PATCHv9 26/43] ARM: dts: clk: Add apll related clocks Tero Kristo
2013-10-25 15:57 ` [PATCHv9 27/43] ARM: dts: DRA7: Change apll_pcie_m2_ck to fixed factor clock Tero Kristo
2013-10-25 15:57 ` [PATCHv9 28/43] ARM: dts: DRA7: Add PCIe related clock nodes Tero Kristo
2013-10-25 15:57 ` [PATCHv9 29/43] ARM: dts: DRA7: link in clock DT data Tero Kristo
2013-10-25 15:57 ` [PATCHv9 30/43] ARM: dts: am33xx clock data Tero Kristo
2013-10-26 0:36 ` Jan Lübbe
2013-10-26 12:46 ` Tero Kristo
2013-10-28 9:59 ` Jan Lübbe
2013-10-28 10:12 ` Tero Kristo
2013-10-25 15:57 ` [PATCHv9 31/43] ARM: dts: omap3 " Tero Kristo
2013-10-25 15:57 ` [PATCHv9 32/43] ARM: dts: AM35xx: use DT " Tero Kristo
2013-11-01 21:18 ` Nishanth Menon
2013-11-05 8:12 ` Tero Kristo
2013-10-25 15:57 ` [PATCHv9 33/43] ARM: dts: am43xx " Tero Kristo
2013-11-01 21:16 ` Nishanth Menon
2013-11-04 14:15 ` Tero Kristo
2013-10-25 15:57 ` [PATCHv9 34/43] ARM: OMAP2+: clock: add support for regmap Tero Kristo
2013-10-25 15:57 ` [PATCHv9 35/43] ARM: OMAP2+: clock: use driver API instead of direct memory read/write Tero Kristo
2013-10-25 15:57 ` [PATCHv9 36/43] ARM: OMAP: hwmod: fix an incorrect clk type cast with _get_clkdm Tero Kristo
2013-10-25 15:57 ` [PATCHv9 37/43] ARM: OMAP3: hwmod: initialize clkdm from clkdm_name Tero Kristo
2013-10-25 15:57 ` [PATCHv9 38/43] ARM: OMAP2+: PRM: add support for initializing PRCM clock modules from DT Tero Kristo
2013-11-01 21:07 ` Nishanth Menon
2013-11-05 8:22 ` Tero Kristo
2013-10-25 15:57 ` [PATCHv9 39/43] ARM: OMAP2+: io: use new clock init API Tero Kristo
2013-10-25 15:57 ` [PATCHv9 40/43] ARM: OMAP4: remove old clock data and link in new clock init code Tero Kristo
2013-10-25 15:57 ` [PATCHv9 41/43] ARM: OMAP: DRA7: Enable clock init Tero Kristo
2013-10-25 15:57 ` [PATCHv9 42/43] ARM: AM33xx: remove old clock data and link in new clock init code Tero Kristo
2013-10-25 15:57 ` [PATCHv9 43/43] ARM: OMAP3: use DT clock init if DT data is available Tero Kristo
2013-10-29 16:19 ` [PATCHv9 00/43] ARM: TI SoC clock DT conversion Nishanth Menon
2013-10-30 8:23 ` Tero Kristo
2013-10-30 15:00 ` Nishanth Menon
2013-10-30 20:10 ` Nishanth Menon
2013-10-31 9:10 ` Tero Kristo
2013-10-31 13:55 ` Nishanth Menon
2013-11-01 21:25 ` Nishanth Menon
2013-11-04 7:15 ` 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=5272764E.6070707@ti.com \
--to=nm@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