* [PATCH 0/1] clk: add DT fixed-factor-clock binding support @ 2012-08-28 22:53 Gregory CLEMENT 2012-08-28 22:53 ` [PATCH] " Gregory CLEMENT [not found] ` <1346194382-11405-1-git-send-email-gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 0 siblings, 2 replies; 4+ messages in thread From: Gregory CLEMENT @ 2012-08-28 22:53 UTC (permalink / raw) To: Mike Turquette, Rob Herring, linux-arm-kernel Cc: Grant Likely, Gregory CLEMENT, devicetree-discuss, Thomas Petazzoni, Shawn Guo Hi, During the port of the clock common framework for the armada 370/XP, I need to get "fixed-factor-clock" using the device tree. For this need I add support DT for "fixed-factor-clock" in the same way that the existing support for "fixed-rate-clock". It turned out that finally I didn't need it anymore, but as the code was written and tested, here it is. Gregory Clement ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] clk: add DT fixed-factor-clock binding support 2012-08-28 22:53 [PATCH 0/1] clk: add DT fixed-factor-clock binding support Gregory CLEMENT @ 2012-08-28 22:53 ` Gregory CLEMENT [not found] ` <1346194382-11405-1-git-send-email-gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 1 sibling, 0 replies; 4+ messages in thread From: Gregory CLEMENT @ 2012-08-28 22:53 UTC (permalink / raw) To: Mike Turquette, Rob Herring, linux-arm-kernel Cc: Grant Likely, Gregory CLEMENT, devicetree-discuss, Thomas Petazzoni, Shawn Guo Add support for DT "fixed-factor-clock" binding to the common fixed factor clock support. Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Cc: Grant Likely <grant.likely@secretlab.ca> Cc: Rob Herring <rob.herring@calxeda.com> Cc: Mike Turquette <mturquette@ti.com> Cc: Shawn Guo <shawn.guo@freescale.com> --- .../bindings/clock/fixed-factor-clock.txt | 24 ++++++++++++++ drivers/clk/clk-fixed-factor.c | 34 ++++++++++++++++++++ include/linux/clk-provider.h | 2 ++ 3 files changed, 60 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/fixed-factor-clock.txt diff --git a/Documentation/devicetree/bindings/clock/fixed-factor-clock.txt b/Documentation/devicetree/bindings/clock/fixed-factor-clock.txt new file mode 100644 index 0000000..7ed236f --- /dev/null +++ b/Documentation/devicetree/bindings/clock/fixed-factor-clock.txt @@ -0,0 +1,24 @@ +Binding for simple fixed factor rate clock sources. + +This binding uses the common clock binding[1]. + +[1] Documentation/devicetree/bindings/clock/clock-bindings.txt + +Required properties: +- compatible : shall be "fixed-factor-clock". +- #clock-cells : from common clock binding; shall be set to 0. +- div: fixed divider. +- mult: fixed multiplier. +- clocks: parent clock. + +Optional properties: +- clock-output-names : From common clock binding. + +Example: + clock { + compatible = "fixed-factor-clock"; + clocks = <&parentclk>; + #clock-cells = <0>; + div = <2>; + mult = <1>; + }; diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c index a489985..8fdf5e9 100644 --- a/drivers/clk/clk-fixed-factor.c +++ b/drivers/clk/clk-fixed-factor.c @@ -11,6 +11,7 @@ #include <linux/clk-provider.h> #include <linux/slab.h> #include <linux/err.h> +#include <linux/of.h> /* * DOC: basic fixed multiplier and divider clock that cannot gate @@ -93,3 +94,36 @@ struct clk *clk_register_fixed_factor(struct device *dev, const char *name, return clk; } +#ifdef CONFIG_OF +/** + * of_fixed_factor_clk_setup() - Setup function for simple fixed factor clock + */ +void __init of_fixed_factor_clk_setup(struct device_node *node) +{ + struct clk *clk; + const char *clk_name = node->name; + const char *parent_name; + u32 div, mult; + + if (of_property_read_u32(node, "div", &div)) { + pr_err("%s Fixed factor clock <%s> must have a div property\n", + __func__, node->name); + return; + } + + if (of_property_read_u32(node, "mult", &mult)) { + pr_err("%s Fixed factor clock <%s> must have a mult property\n", + __func__, node->name); + return; + } + + of_property_read_string(node, "clock-output-names", &clk_name); + parent_name = of_clk_get_parent_name(node, 0); + + clk = clk_register_fixed_factor(NULL, clk_name, parent_name, 0, + mult, div); + if (clk) + of_clk_add_provider(node, of_clk_src_simple_get, clk); +} +EXPORT_SYMBOL_GPL(of_fixed_factor_clk_setup); +#endif diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 77335fa..796e68b 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -314,6 +314,8 @@ struct clk *clk_register_fixed_factor(struct device *dev, const char *name, const char *parent_name, unsigned long flags, unsigned int mult, unsigned int div); +void of_fixed_factor_clk_setup(struct device_node *node); + /** * clk_register - allocate a new clock, register it and return an opaque cookie * @dev: device that is registering this clock -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 4+ messages in thread
[parent not found: <1346194382-11405-1-git-send-email-gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>]
* Re: [PATCH 0/1] clk: add DT fixed-factor-clock binding support [not found] ` <1346194382-11405-1-git-send-email-gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> @ 2012-09-06 16:15 ` Rob Herring [not found] ` <5048CC37.6060509-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Rob Herring @ 2012-09-06 16:15 UTC (permalink / raw) To: Gregory CLEMENT Cc: Thomas Petazzoni, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Mike Turquette On 08/28/2012 05:53 PM, Gregory CLEMENT wrote: > Hi, > > During the port of the clock common framework for the armada 370/XP, I > need to get "fixed-factor-clock" using the device tree. For this need > I add support DT for "fixed-factor-clock" in the same way that the > existing support for "fixed-rate-clock". It turned out that finally I > didn't need it anymore, but as the code was written and tested, here > it is. > It looks fine to me, but I'd like to see a user of it. Rob ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <5048CC37.6060509-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH 0/1] clk: add DT fixed-factor-clock binding support [not found] ` <5048CC37.6060509-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2012-09-07 0:08 ` Mike Turquette 0 siblings, 0 replies; 4+ messages in thread From: Mike Turquette @ 2012-09-07 0:08 UTC (permalink / raw) To: Rob Herring, Gregory CLEMENT Cc: Thomas Petazzoni, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r Quoting Rob Herring (2012-09-06 09:15:51) > On 08/28/2012 05:53 PM, Gregory CLEMENT wrote: > > Hi, > > > > During the port of the clock common framework for the armada 370/XP, I > > need to get "fixed-factor-clock" using the device tree. For this need > > I add support DT for "fixed-factor-clock" in the same way that the > > existing support for "fixed-rate-clock". It turned out that finally I > > didn't need it anymore, but as the code was written and tested, here > > it is. > > > > It looks fine to me, but I'd like to see a user of it. > Agreed. I'll hold off on merging it until someone else depends on it. Thanks for submitting this Gregory. Regards, Mike > Rob ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-09-07 0:08 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-08-28 22:53 [PATCH 0/1] clk: add DT fixed-factor-clock binding support Gregory CLEMENT 2012-08-28 22:53 ` [PATCH] " Gregory CLEMENT [not found] ` <1346194382-11405-1-git-send-email-gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> 2012-09-06 16:15 ` [PATCH 0/1] " Rob Herring [not found] ` <5048CC37.6060509-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2012-09-07 0:08 ` Mike Turquette
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).