From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Mike Turquette <mturquette-l0cyMroinI0@public.gmane.org>
Cc: Peter De Schrijver
<pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: moving Tegra30 to the common clock framework
Date: Mon, 07 May 2012 09:39:22 -0600 [thread overview]
Message-ID: <4FA7ECAA.1040104@wwwdotorg.org> (raw)
In-Reply-To: <20120507000329.GB14559-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
On 05/06/2012 06:03 PM, Mike Turquette wrote:
> On 20120503-19:13, Peter De Schrijver wrote:
>> Hi,
>>
>> I started looking into what would be needed to move our tegra30 clock code
>> to the common clock framework. The tegra30 clocktree is rather flat. Basically
>> there are a bunch of sources (13 PLLs, external audio clocks, osc and 32Khz)
>> and peripheral clocks which have a mux (with 4 or more inputs), a divider and
>> a gate. So almost every peripheral clock can have multiple parents.
>>
>> Some questions:
>>
>> 1) should these peripheral clocks be modelled as 3 different clocks
>> (mux -> divider -> gate) or would it be better to make a new clock type for
>> this?
>>
>
> That is really for you to decide. If the semantics of the existing mux,
> divider and gate in drivers/clk/clk-*.c work well for you then I think
> the answer is "yes". There is infrastructure for register-access
> locking in those common types which might help your complex clocks.
>
> Thanks to the parent rate propagation stuff in clk_set_rate it should be
> possible for your drivers to only be aware of the gate and call
> clk_set_rate on only that clock, which propagates up to the divider and,
> if necessary, again propagates up to the mux.
>
> I encourage you to try that first. But if you find the semantics of
> those basic clock types aren't cutting it for you then you must create a
> type which is platform-specific.
A lot of these mux/divider/gate clocks go out to peripherals, whose
drivers want to call both clk_set_rate() and clk_en/disable() on the clock.
There's only 1 clock reaching the peripheral in HW, so the driver should
only call clk_get() once, and similarly the DT should only provide a
single clock to the driver.
Given the mux->divider->gate clock construction, that clock would
presumably be the gate object. clk_en/disable() clearly work there, but
is clk_set_rate() intended to propagate up the chain until it can be
satisfied, i.e. does the gate clock object's set_rate() op simply call
the parent's set_rate() op?
If the order were instead mux->gate->divider, would it be correct for
enable/disable to propagate from the divider to the gate?
>> 2) how to define the default parent? in many cases the hw reset value isn't
>> a very sensible choice, so the kernel probably needs to set a parent of
>> many of them if we don't want to rely on bootloader configuration.
>
> The only related thing handled at the framework level is _discovery_ of
> the parent during clock registration/initialization. If you don't trust
> the bootloader and want to set things up as soon as possible (a wise
> move) then I suggest you do so from your platform clock code at the same
> time that you register your clocks with the framework. Something like:
>
> struct clk *c;
> c = clk_register(...);
> if (IS_ERR(c))
> omg_fail();
> clk_set_parent(c, b);
>
> Where 'b' is a parent of 'c'. Register your clock tree top-down and you
> can re-parent as you go.
I'm hoping we can represent this in device tree somehow, so that
individual boards can set the clock tree up differently depending on
their needs (e.g. Tegra20 doesn't have quite enough PLLs, so sometimes a
particular PLL will be used to generate the 2nd display's pixel clock,
whereas on other boards it may be used for some peripherals). So, we'd
like to describe this in DT.
It seems like it'd be pretty common to want the kernel to fully
initialize the clock tree, and to do this from device tree, so perhaps
this might evolve into a common (part of) a cross-SoC clock binding, or
some kind of utility function that parsed a clock-tree-init-table from DT?
WARNING: multiple messages have this Message-ID (diff)
From: swarren@wwwdotorg.org (Stephen Warren)
To: linux-arm-kernel@lists.infradead.org
Subject: moving Tegra30 to the common clock framework
Date: Mon, 07 May 2012 09:39:22 -0600 [thread overview]
Message-ID: <4FA7ECAA.1040104@wwwdotorg.org> (raw)
In-Reply-To: <20120507000329.GB14559@gmail.com>
On 05/06/2012 06:03 PM, Mike Turquette wrote:
> On 20120503-19:13, Peter De Schrijver wrote:
>> Hi,
>>
>> I started looking into what would be needed to move our tegra30 clock code
>> to the common clock framework. The tegra30 clocktree is rather flat. Basically
>> there are a bunch of sources (13 PLLs, external audio clocks, osc and 32Khz)
>> and peripheral clocks which have a mux (with 4 or more inputs), a divider and
>> a gate. So almost every peripheral clock can have multiple parents.
>>
>> Some questions:
>>
>> 1) should these peripheral clocks be modelled as 3 different clocks
>> (mux -> divider -> gate) or would it be better to make a new clock type for
>> this?
>>
>
> That is really for you to decide. If the semantics of the existing mux,
> divider and gate in drivers/clk/clk-*.c work well for you then I think
> the answer is "yes". There is infrastructure for register-access
> locking in those common types which might help your complex clocks.
>
> Thanks to the parent rate propagation stuff in clk_set_rate it should be
> possible for your drivers to only be aware of the gate and call
> clk_set_rate on only that clock, which propagates up to the divider and,
> if necessary, again propagates up to the mux.
>
> I encourage you to try that first. But if you find the semantics of
> those basic clock types aren't cutting it for you then you must create a
> type which is platform-specific.
A lot of these mux/divider/gate clocks go out to peripherals, whose
drivers want to call both clk_set_rate() and clk_en/disable() on the clock.
There's only 1 clock reaching the peripheral in HW, so the driver should
only call clk_get() once, and similarly the DT should only provide a
single clock to the driver.
Given the mux->divider->gate clock construction, that clock would
presumably be the gate object. clk_en/disable() clearly work there, but
is clk_set_rate() intended to propagate up the chain until it can be
satisfied, i.e. does the gate clock object's set_rate() op simply call
the parent's set_rate() op?
If the order were instead mux->gate->divider, would it be correct for
enable/disable to propagate from the divider to the gate?
>> 2) how to define the default parent? in many cases the hw reset value isn't
>> a very sensible choice, so the kernel probably needs to set a parent of
>> many of them if we don't want to rely on bootloader configuration.
>
> The only related thing handled at the framework level is _discovery_ of
> the parent during clock registration/initialization. If you don't trust
> the bootloader and want to set things up as soon as possible (a wise
> move) then I suggest you do so from your platform clock code at the same
> time that you register your clocks with the framework. Something like:
>
> struct clk *c;
> c = clk_register(...);
> if (IS_ERR(c))
> omg_fail();
> clk_set_parent(c, b);
>
> Where 'b' is a parent of 'c'. Register your clock tree top-down and you
> can re-parent as you go.
I'm hoping we can represent this in device tree somehow, so that
individual boards can set the clock tree up differently depending on
their needs (e.g. Tegra20 doesn't have quite enough PLLs, so sometimes a
particular PLL will be used to generate the 2nd display's pixel clock,
whereas on other boards it may be used for some peripherals). So, we'd
like to describe this in DT.
It seems like it'd be pretty common to want the kernel to fully
initialize the clock tree, and to do this from device tree, so perhaps
this might evolve into a common (part of) a cross-SoC clock binding, or
some kind of utility function that parsed a clock-tree-init-table from DT?
next prev parent reply other threads:[~2012-05-07 15:39 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-03 16:13 moving Tegra30 to the common clock framework Peter De Schrijver
2012-05-03 16:13 ` Peter De Schrijver
[not found] ` <20120503161311.GG20304-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>
2012-05-07 0:03 ` Mike Turquette
2012-05-07 0:03 ` Mike Turquette
[not found] ` <20120507000329.GB14559-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-05-07 15:39 ` Stephen Warren [this message]
2012-05-07 15:39 ` Stephen Warren
[not found] ` <4FA7ECAA.1040104-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-05-07 16:12 ` Turquette, Mike
2012-05-07 16:12 ` Turquette, Mike
[not found] ` <CAJOA=zNKDFPOQ9-0EuEy=dtq=g-CKFBq94enTuoB7wVPskbkMg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-05-08 5:07 ` zhoujie wu
2012-05-08 5:07 ` zhoujie wu
[not found] ` <CAAXpJNsJiT7s87p6jS5bdi-83n4bwSaagdSK0w3SbrVz+k+O0g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-05-08 17:15 ` Turquette, Mike
2012-05-08 17:15 ` Turquette, Mike
[not found] ` <CAJOA=zP4iEZ+CFfCjT1rgU6shOt_PUf2BRB76NEQCoUPZJ9hVg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-05-09 0:41 ` Saravana Kannan
2012-05-09 0:41 ` Saravana Kannan
[not found] ` <4FA9BD41.2090701-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2012-05-09 2:20 ` skannan-sgV2jX0FEOL9JmXXK+q4OQ
2012-05-09 2:20 ` skannan at codeaurora.org
[not found] ` <d460deebb832d7f62b4298c78ad2b791.squirrel-mMfbam+mt9083fI46fginR2eb7JE58TQ@public.gmane.org>
2012-05-09 6:21 ` Turquette, Mike
2012-05-09 6:21 ` Turquette, Mike
[not found] ` <CAJOA=zPtTTLc9GyPj_xnS6+J-+79mKjKhPgubmiH6Hq9B=tg1Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-05-10 0:02 ` Saravana Kannan
2012-05-10 0:02 ` Saravana Kannan
2012-05-09 10:36 ` Peter De Schrijver
2012-05-09 10:36 ` Peter De Schrijver
[not found] ` <20120509103606.GY20304-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>
2012-05-12 2:58 ` Saravana Kannan
2012-05-12 2:58 ` Saravana Kannan
2012-05-13 4:31 ` Stephen Warren
2012-05-13 4:31 ` Stephen Warren
[not found] ` <4FAF392E.7050205-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-05-14 11:08 ` Peter De Schrijver
2012-05-14 11:08 ` Peter De Schrijver
2012-05-15 0:10 ` Saravana Kannan
2012-05-15 0:10 ` Saravana Kannan
[not found] ` <4FADD1EA.8090606-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2012-05-14 21:36 ` Turquette, Mike
2012-05-14 21:36 ` Turquette, Mike
[not found] ` <20120514213634.GA3075-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-05-14 23:48 ` Saravana Kannan
2012-05-14 23:48 ` Saravana Kannan
[not found] ` <4FB199B5.5010607-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2012-05-15 2:00 ` Mike Turquette
2012-05-15 2:00 ` Mike Turquette
[not found] ` <20120515020033.GD3075-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-05-15 4:20 ` Saravana Kannan
2012-05-15 4:20 ` Saravana Kannan
[not found] ` <4FB1D992.9050102-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2012-05-16 5:36 ` Turquette, Mike
2012-05-16 5:36 ` Turquette, Mike
2012-05-09 11:13 ` Peter De Schrijver
2012-05-09 11:13 ` Peter De Schrijver
[not found] ` <20120509111335.GC20304-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>
2012-05-09 16:49 ` Mike Turquette
2012-05-09 16:49 ` Mike Turquette
[not found] ` <20120509164915.GA19219-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-05-10 11:36 ` Peter De Schrijver
2012-05-10 11:36 ` Peter De Schrijver
2012-05-12 18:04 ` Mark Brown
2012-05-12 18:04 ` Mark Brown
[not found] ` <20120512180441.GA11435-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2012-05-14 12:29 ` Peter De Schrijver
2012-05-14 12:29 ` Peter De Schrijver
2012-05-14 12:36 ` Peter De Schrijver
2012-05-14 12:36 ` Peter De Schrijver
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=4FA7ECAA.1040104@wwwdotorg.org \
--to=swarren-3lzwwm7+weoh9zmkesr00q@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mturquette-l0cyMroinI0@public.gmane.org \
--cc=paul-DWxLp4Yu+b8AvxtiuMwx3w@public.gmane.org \
--cc=pdeschrijver-DDmLM1+adcrQT0dZR+AlfA@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.