From 015ba40246497ae02a5f644d4c8adfec76d9b75c Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Sat, 7 Apr 2012 21:39:39 -0500 Subject: clk: add DT fixed-clock binding support Add support for DT "fixed-clock" binding to the common fixed rate clock support. Signed-off-by: Grant Likely [Rob Herring] Rework and move into common clock infrastructure Signed-off-by: Rob Herring Signed-off-by: Mike Turquette --- drivers/clk/clk-fixed-rate.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'drivers/clk') diff --git a/drivers/clk/clk-fixed-rate.c b/drivers/clk/clk-fixed-rate.c index 7e1464569727..f5ec0eebd4d7 100644 --- a/drivers/clk/clk-fixed-rate.c +++ b/drivers/clk/clk-fixed-rate.c @@ -14,6 +14,7 @@ #include #include #include +#include /* * DOC: basic fixed-rate clock that cannot gate @@ -79,3 +80,25 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name, return clk; } + +#ifdef CONFIG_OF +/** + * of_fixed_clk_setup() - Setup function for simple fixed rate clock + */ +void __init of_fixed_clk_setup(struct device_node *node) +{ + struct clk *clk; + const char *clk_name = node->name; + u32 rate; + + if (of_property_read_u32(node, "clock-frequency", &rate)) + return; + + of_property_read_string(node, "clock-output-names", &clk_name); + + clk = clk_register_fixed_rate(NULL, clk_name, NULL, CLK_IS_ROOT, rate); + if (clk) + of_clk_add_provider(node, of_clk_src_simple_get, clk); +} +EXPORT_SYMBOL_GPL(of_fixed_clk_setup); +#endif -- cgit v1.2.2