From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 7/7] clk: add highbank clock support
Date: Tue, 10 Apr 2012 08:17:18 -0500 [thread overview]
Message-ID: <4F8432DE.9070308@gmail.com> (raw)
In-Reply-To: <20120410020638.GG18692@S2101-09.ap.freescale.net>
On 04/09/2012 09:06 PM, Shawn Guo wrote:
> On Tue, Mar 13, 2012 at 06:22:27PM -0500, Rob Herring wrote:
>> From: Rob Herring <rob.herring@calxeda.com>
>>
>> This adds real clock support to Calxeda Highbank SOC using the common
>> clock infrastructure.
>>
>> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
>> ---
[snip]
>> +
>> + osc: oscillator {
>> + #clock-cells = <0>;
>> + compatible = "fixed-clock";
>> + clock-frequency = <33333000>;
>> + };
>> +
>> + ddrpll: ddrpll {
>> + #clock-cells = <0>;
>> + compatible = "calxeda,hb-pll-clock";
>
> Where are all these "calxeda,*-clock' compatible documented?
Right. Need to add that.
>
>> + clocks = <&osc>;
>> + reg = <0x108>;
>> + };
>> +
>> + a9pll: a9pll {
>> + #clock-cells = <0>;
>> + compatible = "calxeda,hb-pll-clock";
>> + clocks = <&osc>;
>> + reg = <0x100>;
>> + };
>> +
>> + a9periphclk: a9periphclk {
>> + #clock-cells = <0>;
>> + compatible = "calxeda,hb-a9periph-clock";
>> + clocks = <&a9pll>;
>> + reg = <0x104>;
>> + clock-divider = <4>;
>
> Where is this "clock-divider" binding documented?
This should be deleted.
>> +static unsigned long clk_cpu_periphclk_recalc_rate(struct clk_hw *clk,
>> + unsigned long parent_rate)
>> +{
>> + return parent_rate / 2;
>> +}
>> +
>> +static const struct clk_ops a9periphclk_ops = {
>> + .recalc_rate = clk_cpu_periphclk_recalc_rate,
>> +};
>> +
>
> This basically is a clk-fixed-factor added by Sascha.
>
Well that didn't exist when I sent this out based on v6 of Mike's patches.
Anyway, it is not really fixed divider either. I need to add reading the
register value.
>> +static unsigned long clk_cpu_a9bclk_recalc_rate(struct clk_hw *clk,
>> + unsigned long parent_rate)
>> +{
>> + struct hb_clk *hbclk = to_hb_clk(clk);
>> + u32 div = (readl(hbclk->reg) & HB_A9_BCLK_DIV_MASK) >> HB_A9_BCLK_DIV_SHIFT;
>> +
>> + return parent_rate / (div + 2);
>> +}
>> +
>> +static const struct clk_ops a9bclk_ops = {
>> + .recalc_rate = clk_cpu_a9bclk_recalc_rate,
>
> Since there is a divider for the clock, the ops should have .round_rate
> and .set_rate, no?
>
Except I have no need or desire to support changing it. When and if
there is a need I will add that.
>> +};
>> +
>> +static unsigned long clk_periclk_recalc_rate(struct clk_hw *clk,
>> + unsigned long parent_rate)
>> +{
>> + struct hb_clk *hbclk = to_hb_clk(clk);
>> + u32 div;
>> +
>> + div = readl(hbclk->reg);
>> + div++;
>> + div *= 2;
>> +
>> + return parent_rate / div;
>> +}
>> +
>> +static const __initconst struct of_device_id clk_match[] = {
>> + { .compatible = "fixed-clock", .data = of_fixed_clk_setup, },
>> + { .compatible = "calxeda,hb-pll-clock", .data = hb_pll_init, },
>> + { .compatible = "calxeda,hb-a9periph-clock", .data = hb_a9periph_init, },
>> + { .compatible = "calxeda,hb-a9bus-clock", .data = hb_a9bus_init, },
>> + { .compatible = "calxeda,hb-emmc-clock", .data = hb_emmc_init, },
>
> So that's the difference between your clock and mine. You do not reuse
> any basic clk, except clk_fixed_rate, while my clocks are all about
> basic clk except pll. That's why you need a long list of SoC specific
> binding, while I do not. All I need is the binding for those basic
> clks.
Because there are not any I can use. I don't have any muxes or clk
gates. The only one that exists in mainline is divider, but our divider
is not n, n+1, or n^2. It is 2(n+1).
Rob
>
> Regards,
> Shawn
>
>> + {}
>> +};
>> +
>> +void __init highbank_clocks_init(void)
>> +{
>> + of_clk_init(clk_match);
>> +}
prev parent reply other threads:[~2012-04-10 13:17 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-13 23:22 [PATCH 0/7] Highbank clock support using DT Rob Herring
2012-03-13 23:22 ` [PATCH 1/7] clk: fix orphan list iterator to be safe Rob Herring
2012-03-14 2:10 ` Turquette, Mike
2012-03-13 23:22 ` [PATCH 2/7] of: add clock providers Rob Herring
2012-03-14 7:07 ` Thierry Reding
2012-03-14 7:55 ` Shawn Guo
2012-04-07 4:18 ` Grant Likely
2012-04-07 19:04 ` Rob Herring
2012-04-09 11:55 ` Shawn Guo
2012-04-09 13:52 ` Rob Herring
2012-04-09 14:13 ` Shawn Guo
2012-04-09 14:34 ` Rob Herring
2012-04-09 23:42 ` Shawn Guo
2012-03-13 23:22 ` [PATCH 3/7] of: Add of_property_match_string() to find index into a string list Rob Herring
2012-04-07 4:22 ` Grant Likely
2012-03-13 23:22 ` [PATCH 4/7] dt/clock: Add handling for fixed clocks and a clock node setup iterator Rob Herring
2012-03-14 7:59 ` Shawn Guo
2012-03-14 13:26 ` Rob Herring
2012-03-14 13:45 ` Shawn Guo
2012-04-08 14:48 ` Rob Herring
2012-04-09 8:49 ` Shawn Guo
2012-04-09 14:18 ` Rob Herring
2012-04-09 23:27 ` Shawn Guo
2012-04-15 3:04 ` Rob Herring
2012-04-15 7:01 ` Shawn Guo
2012-03-13 23:22 ` [PATCH 5/7] dt/clock: add a simple provider get function Rob Herring
2012-04-07 4:26 ` Grant Likely
2012-03-13 23:22 ` [PATCH 6/7] dt/clock: add function to get parent clock name Rob Herring
2012-03-13 23:22 ` [PATCH 7/7] clk: add highbank clock support Rob Herring
2012-04-10 2:06 ` Shawn Guo
2012-04-10 13:17 ` Rob Herring [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=4F8432DE.9070308@gmail.com \
--to=robherring2@gmail.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).