diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2012-04-07 22:39:39 -0400 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2012-07-11 20:58:46 -0400 |
commit | 015ba40246497ae02a5f644d4c8adfec76d9b75c (patch) | |
tree | bc14e32c38c79ca9e1b0d822042730aa21aac1d9 /drivers/clk | |
parent | 766e6a4ec602d0c107553b91b3434fe9c03474f4 (diff) |
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 <grant.likely@secretlab.ca>
[Rob Herring] Rework and move into common clock infrastructure
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk')
-rw-r--r-- | drivers/clk/clk-fixed-rate.c | 23 |
1 files changed, 23 insertions, 0 deletions
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 @@ | |||
14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
15 | #include <linux/io.h> | 15 | #include <linux/io.h> |
16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
17 | #include <linux/of.h> | ||
17 | 18 | ||
18 | /* | 19 | /* |
19 | * DOC: basic fixed-rate clock that cannot gate | 20 | * DOC: basic fixed-rate clock that cannot gate |
@@ -79,3 +80,25 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name, | |||
79 | 80 | ||
80 | return clk; | 81 | return clk; |
81 | } | 82 | } |
83 | |||
84 | #ifdef CONFIG_OF | ||
85 | /** | ||
86 | * of_fixed_clk_setup() - Setup function for simple fixed rate clock | ||
87 | */ | ||
88 | void __init of_fixed_clk_setup(struct device_node *node) | ||
89 | { | ||
90 | struct clk *clk; | ||
91 | const char *clk_name = node->name; | ||
92 | u32 rate; | ||
93 | |||
94 | if (of_property_read_u32(node, "clock-frequency", &rate)) | ||
95 | return; | ||
96 | |||
97 | of_property_read_string(node, "clock-output-names", &clk_name); | ||
98 | |||
99 | clk = clk_register_fixed_rate(NULL, clk_name, NULL, CLK_IS_ROOT, rate); | ||
100 | if (clk) | ||
101 | of_clk_add_provider(node, of_clk_src_simple_get, clk); | ||
102 | } | ||
103 | EXPORT_SYMBOL_GPL(of_fixed_clk_setup); | ||
104 | #endif | ||