From: Thomas Abraham <thomas.abraham@linaro.org>
To: Mike Turquette <mturquette@ti.com>
Cc: linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org,
devicetree-discuss@lists.ozlabs.org, kgene.kim@samsung.com,
t.figa@samsung.com, sylvester.nawrocki@gmail.com
Subject: Re: [PATCH v2 1/5] clk: samsung: add common clock framework support for Samsung platforms
Date: Mon, 5 Nov 2012 12:52:00 +0530 [thread overview]
Message-ID: <CAJuYYwScWunaVsg=4whrt4gRZYOVBbvAwFhYmN2PCQS723B3og@mail.gmail.com> (raw)
In-Reply-To: <20121030163012.18780.19304@nucleus>
Hi Mike,
Thanks for your review.
On 30 October 2012 22:00, Mike Turquette <mturquette@ti.com> wrote:
> Hi Thomas,
>
> Quoting Thomas Abraham (2012-10-07 10:10:51)
>> +/* determine the output clock speed of the pll */
>> +static unsigned long samsung_pll_clock_recalc_rate(struct clk_hw *hw,
>> + unsigned long parent_rate)
>> +{
>> + struct samsung_pll_clock *clk_pll = to_clk_pll(hw);
>> +
>> + if (clk_pll->get_rate)
>> + return to_clk_pll(hw)->get_rate(parent_rate);
>
> Why the extra indirection? Does your samsung_pll_clock abstract several
> different PLL implementations (with separate clock ops)? If so, why not
> make a unique struct for each PLL type?
Yes, it abstracts several PLL types. There are multiple PLL types used
by Samsung SoC's and this clock type was supposed to abstract all the
types of PLL's. But yes, you are right. It is better to have a unique
implementation for each type of PLL. That way, multiple user's of a
PLL type need not be worried about setting up runtime callbacks for
clock operations.
>
>> +
>> + return 0;
>> +}
>> +
>> +/* round operation not supported */
>> +static long samsung_pll_clock_round_rate(struct clk_hw *hw, unsigned long drate,
>> + unsigned long *prate)
>> +{
>> + return samsung_pll_clock_recalc_rate(hw, *prate);
>
> Why is round_rate not supported? How is returning the recalculated rate
> the right thing here?
The PLL does not include a divider for the rounding operation. So the
output of the PLL clock type is not something that can be divided
down. The parent clock of the PLL clock type is usually a low
frequency oscillator. Hence, the round rate operation has not been
implemented for the PLL clock type.
>
>> +/*
>> + * Allow platform specific implementations to attach set_rate and get_rate
>> + * callbacks for the pll type clock. Typical calling sequence..
>> + *
>> + * struct clk *clk = clk_get(NULL, "pll-clk-name");
>> + * samsung_pll_clk_set_cb(clk, pll_set_rate, pll_get_rate);
>> + */
>> +void __init samsung_pll_clk_set_cb(struct clk *clk,
>> + int (*set_rate)(unsigned long rate),
>> + unsigned long (*get_rate)(unsigned long rate))
>> +{
>> + struct samsung_pll_clock *clk_pll;
>> + struct clk_hw *hw = __clk_get_hw(clk);
>> +
>> + clk_pll = to_clk_pll(hw);
>> + clk_pll->set_rate = set_rate;
>> + clk_pll->get_rate = get_rate;
>> +}
>
> This answers my questions above having different PLL types. Why not
> just make seprate clk_hw structs for each PLL type instead of the extra
> layer of abstraction + runtime assignment of clk ops?
Ok. I will redo this in the next version of this patch.
Thanks,
Thomas.
>
> Regards,
> Mike
next prev parent reply other threads:[~2012-11-05 7:22 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-07 17:10 [PATCH v2 0/5] clk: exynos4: migrate to common clock framework Thomas Abraham
2012-10-07 17:10 ` [PATCH v2 1/5] clk: samsung: add common clock framework support for Samsung platforms Thomas Abraham
2012-10-22 15:55 ` Sylwester Nawrocki
2012-10-29 10:09 ` Thomas Abraham
2012-10-30 23:10 ` Sylwester Nawrocki
2012-10-30 23:32 ` Tomasz Figa
2012-11-05 7:41 ` Thomas Abraham
2012-11-05 7:36 ` Thomas Abraham
2012-10-30 16:30 ` Mike Turquette
2012-11-05 7:22 ` Thomas Abraham [this message]
2012-10-07 17:10 ` [PATCH v2 2/5] clk: exynos4: register clocks using common clock framework Thomas Abraham
2012-10-08 7:54 ` Tomasz Figa
2012-11-14 5:14 ` Kukjin Kim
2012-10-07 17:10 ` [PATCH v2 3/5] ARM: dts: Add Exynos4210 clock nodes Thomas Abraham
2012-10-07 17:10 ` [PATCH v2 4/5] ARM: dts: list the clock providers for serial ports Thomas Abraham
2012-10-07 17:10 ` [PATCH v2 5/5] ARM: Exynos4: Migrate clock support to common clock framework Thomas Abraham
2012-11-14 5:25 ` Kukjin Kim
2012-11-14 5:26 ` Kukjin Kim
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='CAJuYYwScWunaVsg=4whrt4gRZYOVBbvAwFhYmN2PCQS723B3og@mail.gmail.com' \
--to=thomas.abraham@linaro.org \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=kgene.kim@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=mturquette@ti.com \
--cc=sylvester.nawrocki@gmail.com \
--cc=t.figa@samsung.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).