* Query: clk: Defining new struct clk_foo types @ 2012-04-05 7:05 Viresh Kumar 2012-04-05 9:58 ` Sascha Hauer 0 siblings, 1 reply; 6+ messages in thread From: Viresh Kumar @ 2012-04-05 7:05 UTC (permalink / raw) To: linux-arm-kernel Hi Mike, I am doing SPEAr SoCs clock port with common clock framework. Currently there are following type of clk_foo implementations present: - clk_gate - clk_divider - clk_fixed_rate - clk_mux I have few more in my SoC: clk with: - gate + divider - gate + fixed_rate - gate + mux ... How should i go ahead in my implementation for these? Should i create SPEAr specific structures or enhance drivers/clk for this? -- viresh ^ permalink raw reply [flat|nested] 6+ messages in thread
* Query: clk: Defining new struct clk_foo types 2012-04-05 7:05 Query: clk: Defining new struct clk_foo types Viresh Kumar @ 2012-04-05 9:58 ` Sascha Hauer 2012-04-05 10:13 ` Viresh Kumar 0 siblings, 1 reply; 6+ messages in thread From: Sascha Hauer @ 2012-04-05 9:58 UTC (permalink / raw) To: linux-arm-kernel On Thu, Apr 05, 2012 at 12:35:34PM +0530, Viresh Kumar wrote: > Hi Mike, > > I am doing SPEAr SoCs clock port with common clock framework. > > Currently there are following type of clk_foo implementations present: > - clk_gate > - clk_divider > - clk_fixed_rate > - clk_mux > > I have few more in my SoC: > clk with: > - gate + divider > - gate + fixed_rate > - gate + mux > ... > > How should i go ahead in my implementation for these? > Should i create SPEAr specific structures or enhance drivers/clk for this? If you have a gate and a divider then register a gate and a divider. We don't need clk providers for combination of these, the clock framework will handle it just fine. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 6+ messages in thread
* Query: clk: Defining new struct clk_foo types 2012-04-05 9:58 ` Sascha Hauer @ 2012-04-05 10:13 ` Viresh Kumar 2012-04-05 10:30 ` Sascha Hauer 0 siblings, 1 reply; 6+ messages in thread From: Viresh Kumar @ 2012-04-05 10:13 UTC (permalink / raw) To: linux-arm-kernel On 4/5/2012 3:28 PM, Sascha Hauer wrote: > If you have a gate and a divider then register a gate and a divider. > We don't need clk providers for combination of these, the clock > framework will handle it just fine. Thanks Sashca, but i didn't get your reply completely. Lets see if i can understand it with help of an example: I have uart's clock that can be gated and its rate derived as a divider. So to define static clock structures, i do following: DEFINE_CLK_GATE(uart_gate_clk, "uart_parent", &uart_parent_clk, 0, 0xd0000000, 5, 0, NULL); DEFINE_CLK_DIVIDER(uart_divider_clk, "uart_parent", &uart_parent_clk, 0, 0xd0000080, 4, 2, 0, NULL); You are suggesting this? If yes, I don't know how it will work. How will clk get work with dev_id: "uart0". Which one will it pick? Confused. :( -- viresh ^ permalink raw reply [flat|nested] 6+ messages in thread
* Query: clk: Defining new struct clk_foo types 2012-04-05 10:13 ` Viresh Kumar @ 2012-04-05 10:30 ` Sascha Hauer 2012-04-05 10:40 ` Viresh Kumar 0 siblings, 1 reply; 6+ messages in thread From: Sascha Hauer @ 2012-04-05 10:30 UTC (permalink / raw) To: linux-arm-kernel On Thu, Apr 05, 2012 at 03:43:49PM +0530, Viresh Kumar wrote: > On 4/5/2012 3:28 PM, Sascha Hauer wrote: > > If you have a gate and a divider then register a gate and a divider. > > We don't need clk providers for combination of these, the clock > > framework will handle it just fine. > > Thanks Sashca, but i didn't get your reply completely. > Lets see if i can understand it with help of an example: > > I have uart's clock that can be gated and its rate derived as a divider. > So to define static clock structures, i do following: > > DEFINE_CLK_GATE(uart_gate_clk, "uart_parent", &uart_parent_clk, 0, > 0xd0000000, 5, 0, NULL); > DEFINE_CLK_DIVIDER(uart_divider_clk, "uart_parent", &uart_parent_clk, > 0, 0xd0000080, 4, 2, 0, NULL); > > You are suggesting this? No, more like this: DEFINE_CLK_DIVIDER(uart_divider_clk, "uart_parent", &uart_parent_clk, 0, 0xd0000080, 4, 2, 0, NULL); DEFINE_CLK_GATE(uart_gate_clk, "uart_divider_clk", &uart_divider_clk, CLK_SET_RATE_PARENT, 0xd0000000, 5, 0, NULL); So the divider is the parent of the gate and a set_rate call to the gate will propagate up to the divider. You could make the gate the parent of the divider if that's how your hardware really is built, but for the software it makes no difference in this case. Besides, I don't recommend using the DEFINE_CLK_* macros. You should really consider using clk_register_* instead. Grmpf. These DEFINE_CLK_* macros are so omnipresent and huge in clk-private.h that people *must* think they are the way to go. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 6+ messages in thread
* Query: clk: Defining new struct clk_foo types 2012-04-05 10:30 ` Sascha Hauer @ 2012-04-05 10:40 ` Viresh Kumar 2012-04-05 13:12 ` Sascha Hauer 0 siblings, 1 reply; 6+ messages in thread From: Viresh Kumar @ 2012-04-05 10:40 UTC (permalink / raw) To: linux-arm-kernel On 4/5/2012 4:00 PM, Sascha Hauer wrote: > Besides, I don't recommend using the DEFINE_CLK_* macros. You should > really consider using clk_register_* instead. Can you point me to some users of this clock framework, with such runtime stuff? That would be really helpful. -- viresh ^ permalink raw reply [flat|nested] 6+ messages in thread
* Query: clk: Defining new struct clk_foo types 2012-04-05 10:40 ` Viresh Kumar @ 2012-04-05 13:12 ` Sascha Hauer 0 siblings, 0 replies; 6+ messages in thread From: Sascha Hauer @ 2012-04-05 13:12 UTC (permalink / raw) To: linux-arm-kernel On Thu, Apr 05, 2012 at 04:10:40PM +0530, Viresh Kumar wrote: > On 4/5/2012 4:00 PM, Sascha Hauer wrote: > > Besides, I don't recommend using the DEFINE_CLK_* macros. You should > > really consider using clk_register_* instead. > > Can you point me to some users of this clock framework, with such > runtime stuff? That would be really helpful. See this branch: git://git.pengutronix.de/git/imx/linux-2.6.git work/v3.4-rc1-imx-clk Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-04-05 13:12 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-04-05 7:05 Query: clk: Defining new struct clk_foo types Viresh Kumar 2012-04-05 9:58 ` Sascha Hauer 2012-04-05 10:13 ` Viresh Kumar 2012-04-05 10:30 ` Sascha Hauer 2012-04-05 10:40 ` Viresh Kumar 2012-04-05 13:12 ` Sascha Hauer
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).