diff options
author | Tero Kristo <t-kristo@ti.com> | 2013-08-21 12:39:15 -0400 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2014-01-17 15:35:13 -0500 |
commit | 3cd4a596224565cff00b69a02d4b5fa7432ea6d3 (patch) | |
tree | 66ec0ab2c879ccb9715f335af51897376148b2a6 /drivers/clk | |
parent | f60b1ea5ea7ab1aee34a5ba55520b84b6e6d482e (diff) |
CLK: TI: add support for clockdomain binding
Some OMAP clocks require knowledge about their parent clockdomain for
book keeping purposes. This patch creates a new DT binding for TI
clockdomains, which act as a collection of device clocks. Clockdomain
itself is rather misleading name for the hardware functionality, as at
least on OMAP4 / OMAP5 / DRA7 the clockdomains can be collections of either
clocks and/or IP blocks, thus idle-domain or such might be more appropriate.
For most cases on these SoCs, the kernel doesn't even need the information
and the mappings can be ignored.
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
Diffstat (limited to 'drivers/clk')
-rw-r--r-- | drivers/clk/ti/Makefile | 2 | ||||
-rw-r--r-- | drivers/clk/ti/clockdomain.c | 70 |
2 files changed, 71 insertions, 1 deletions
diff --git a/drivers/clk/ti/Makefile b/drivers/clk/ti/Makefile index eaa6dc0aeb75..ae7cd1e91cd2 100644 --- a/drivers/clk/ti/Makefile +++ b/drivers/clk/ti/Makefile | |||
@@ -1,5 +1,5 @@ | |||
1 | ifneq ($(CONFIG_OF),) | 1 | ifneq ($(CONFIG_OF),) |
2 | obj-y += clk.o autoidle.o | 2 | obj-y += clk.o autoidle.o clockdomain.o |
3 | clk-common = dpll.o composite.o divider.o gate.o \ | 3 | clk-common = dpll.o composite.o divider.o gate.o \ |
4 | fixed-factor.o | 4 | fixed-factor.o |
5 | endif | 5 | endif |
diff --git a/drivers/clk/ti/clockdomain.c b/drivers/clk/ti/clockdomain.c new file mode 100644 index 000000000000..f1e0038d76ac --- /dev/null +++ b/drivers/clk/ti/clockdomain.c | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * OMAP clockdomain support | ||
3 | * | ||
4 | * Copyright (C) 2013 Texas Instruments, Inc. | ||
5 | * | ||
6 | * Tero Kristo <t-kristo@ti.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
13 | * kind, whether express or implied; without even the implied warranty | ||
14 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | */ | ||
17 | |||
18 | #include <linux/clk-provider.h> | ||
19 | #include <linux/slab.h> | ||
20 | #include <linux/of.h> | ||
21 | #include <linux/of_address.h> | ||
22 | #include <linux/clk/ti.h> | ||
23 | |||
24 | #undef pr_fmt | ||
25 | #define pr_fmt(fmt) "%s: " fmt, __func__ | ||
26 | |||
27 | static void __init of_ti_clockdomain_setup(struct device_node *node) | ||
28 | { | ||
29 | struct clk *clk; | ||
30 | struct clk_hw *clk_hw; | ||
31 | const char *clkdm_name = node->name; | ||
32 | int i; | ||
33 | int num_clks; | ||
34 | |||
35 | num_clks = of_count_phandle_with_args(node, "clocks", "#clock-cells"); | ||
36 | |||
37 | for (i = 0; i < num_clks; i++) { | ||
38 | clk = of_clk_get(node, i); | ||
39 | if (__clk_get_flags(clk) & CLK_IS_BASIC) { | ||
40 | pr_warn("can't setup clkdm for basic clk %s\n", | ||
41 | __clk_get_name(clk)); | ||
42 | continue; | ||
43 | } | ||
44 | clk_hw = __clk_get_hw(clk); | ||
45 | to_clk_hw_omap(clk_hw)->clkdm_name = clkdm_name; | ||
46 | omap2_init_clk_clkdm(clk_hw); | ||
47 | } | ||
48 | } | ||
49 | |||
50 | static struct of_device_id ti_clkdm_match_table[] __initdata = { | ||
51 | { .compatible = "ti,clockdomain" }, | ||
52 | { } | ||
53 | }; | ||
54 | |||
55 | /** | ||
56 | * ti_dt_clockdomains_setup - setup device tree clockdomains | ||
57 | * | ||
58 | * Initializes clockdomain nodes for a SoC. This parses through all the | ||
59 | * nodes with compatible = "ti,clockdomain", and add the clockdomain | ||
60 | * info for all the clocks listed under these. This function shall be | ||
61 | * called after rest of the DT clock init has completed and all | ||
62 | * clock nodes have been registered. | ||
63 | */ | ||
64 | void __init ti_dt_clockdomains_setup(void) | ||
65 | { | ||
66 | struct device_node *np; | ||
67 | for_each_matching_node(np, ti_clkdm_match_table) { | ||
68 | of_ti_clockdomain_setup(np); | ||
69 | } | ||
70 | } | ||