diff options
author | Tero Kristo <t-kristo@ti.com> | 2013-07-15 06:14:20 -0400 |
---|---|---|
committer | Mike Turquette <mturquette@linaro.org> | 2014-01-17 15:35:45 -0500 |
commit | 24582b3407775d57f06becfccd8cd202bc01eda6 (patch) | |
tree | d365fb760c6433fcc2dcc6a3dd0c53078445ad58 | |
parent | 45622e2162b6d5907006f4595f2ac862afe1dfb5 (diff) |
CLK: TI: add interface clock support for OMAP3
OMAP3 has interface clocks in addition to functional clocks, which
require special handling for the autoidle and idle status register
offsets mainly.
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
-rw-r--r-- | Documentation/devicetree/bindings/clock/ti/interface.txt | 54 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clock.h | 5 | ||||
-rw-r--r-- | drivers/clk/ti/Makefile | 1 | ||||
-rw-r--r-- | drivers/clk/ti/interface.c | 125 | ||||
-rw-r--r-- | include/linux/clk/ti.h | 5 |
5 files changed, 185 insertions, 5 deletions
diff --git a/Documentation/devicetree/bindings/clock/ti/interface.txt b/Documentation/devicetree/bindings/clock/ti/interface.txt new file mode 100644 index 000000000000..064e8caccac3 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/ti/interface.txt | |||
@@ -0,0 +1,54 @@ | |||
1 | Binding for Texas Instruments interface clock. | ||
2 | |||
3 | Binding status: Unstable - ABI compatibility may be broken in the future | ||
4 | |||
5 | This binding uses the common clock binding[1]. This clock is | ||
6 | quite much similar to the basic gate-clock [2], however, | ||
7 | it supports a number of additional features, including | ||
8 | companion clock finding (match corresponding functional gate | ||
9 | clock) and hardware autoidle enable / disable. | ||
10 | |||
11 | [1] Documentation/devicetree/bindings/clock/clock-bindings.txt | ||
12 | [2] Documentation/devicetree/bindings/clock/gate-clock.txt | ||
13 | |||
14 | Required properties: | ||
15 | - compatible : shall be one of: | ||
16 | "ti,omap3-interface-clock" - basic OMAP3 interface clock | ||
17 | "ti,omap3-no-wait-interface-clock" - interface clock which has no hardware | ||
18 | capability for waiting clock to be ready | ||
19 | "ti,omap3-hsotgusb-interface-clock" - interface clock with USB specific HW | ||
20 | handling | ||
21 | "ti,omap3-dss-interface-clock" - interface clock with DSS specific HW handling | ||
22 | "ti,omap3-ssi-interface-clock" - interface clock with SSI specific HW handling | ||
23 | "ti,am35xx-interface-clock" - interface clock with AM35xx specific HW handling | ||
24 | - #clock-cells : from common clock binding; shall be set to 0 | ||
25 | - clocks : link to phandle of parent clock | ||
26 | - reg : base address for the control register | ||
27 | |||
28 | Optional properties: | ||
29 | - ti,bit-shift : bit shift for the bit enabling/disabling the clock (default 0) | ||
30 | |||
31 | Examples: | ||
32 | aes1_ick: aes1_ick@48004a14 { | ||
33 | #clock-cells = <0>; | ||
34 | compatible = "ti,omap3-interface-clock"; | ||
35 | clocks = <&security_l4_ick2>; | ||
36 | reg = <0x48004a14 0x4>; | ||
37 | ti,bit-shift = <3>; | ||
38 | }; | ||
39 | |||
40 | cam_ick: cam_ick@48004f10 { | ||
41 | #clock-cells = <0>; | ||
42 | compatible = "ti,omap3-no-wait-interface-clock"; | ||
43 | clocks = <&l4_ick>; | ||
44 | reg = <0x48004f10 0x4>; | ||
45 | ti,bit-shift = <0>; | ||
46 | }; | ||
47 | |||
48 | ssi_ick_3430es2: ssi_ick_3430es2@48004a10 { | ||
49 | #clock-cells = <0>; | ||
50 | compatible = "ti,omap3-ssi-interface-clock"; | ||
51 | clocks = <&ssi_l4_ick>; | ||
52 | reg = <0x48004a10 0x4>; | ||
53 | ti,bit-shift = <0>; | ||
54 | }; | ||
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h index 1da9dc32fa4e..cbe5ff770ec4 100644 --- a/arch/arm/mach-omap2/clock.h +++ b/arch/arm/mach-omap2/clock.h | |||
@@ -270,15 +270,10 @@ extern struct clk dummy_ck; | |||
270 | 270 | ||
271 | extern const struct clk_hw_omap_ops clkhwops_iclk_wait; | 271 | extern const struct clk_hw_omap_ops clkhwops_iclk_wait; |
272 | extern const struct clk_hw_omap_ops clkhwops_wait; | 272 | extern const struct clk_hw_omap_ops clkhwops_wait; |
273 | extern const struct clk_hw_omap_ops clkhwops_iclk; | ||
274 | extern const struct clk_hw_omap_ops clkhwops_omap3430es2_ssi_wait; | 273 | extern const struct clk_hw_omap_ops clkhwops_omap3430es2_ssi_wait; |
275 | extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait; | ||
276 | extern const struct clk_hw_omap_ops clkhwops_omap3430es2_dss_usbhost_wait; | 274 | extern const struct clk_hw_omap_ops clkhwops_omap3430es2_dss_usbhost_wait; |
277 | extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_dss_usbhost_wait; | ||
278 | extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait; | ||
279 | extern const struct clk_hw_omap_ops clkhwops_omap3430es2_hsotgusb_wait; | 275 | extern const struct clk_hw_omap_ops clkhwops_omap3430es2_hsotgusb_wait; |
280 | extern const struct clk_hw_omap_ops clkhwops_am35xx_ipss_module_wait; | 276 | extern const struct clk_hw_omap_ops clkhwops_am35xx_ipss_module_wait; |
281 | extern const struct clk_hw_omap_ops clkhwops_am35xx_ipss_wait; | ||
282 | extern const struct clk_hw_omap_ops clkhwops_apll54; | 277 | extern const struct clk_hw_omap_ops clkhwops_apll54; |
283 | extern const struct clk_hw_omap_ops clkhwops_apll96; | 278 | extern const struct clk_hw_omap_ops clkhwops_apll96; |
284 | extern const struct clk_hw_omap_ops clkhwops_omap2xxx_dpll; | 279 | extern const struct clk_hw_omap_ops clkhwops_omap2xxx_dpll; |
diff --git a/drivers/clk/ti/Makefile b/drivers/clk/ti/Makefile index 51b00f80cc14..fff97f6aa8cb 100644 --- a/drivers/clk/ti/Makefile +++ b/drivers/clk/ti/Makefile | |||
@@ -3,6 +3,7 @@ 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 mux.o apll.o | 4 | fixed-factor.o mux.o apll.o |
5 | obj-$(CONFIG_SOC_AM33XX) += $(clk-common) clk-33xx.o | 5 | obj-$(CONFIG_SOC_AM33XX) += $(clk-common) clk-33xx.o |
6 | obj-$(CONFIG_ARCH_OMAP3) += $(clk-common) interface.o | ||
6 | obj-$(CONFIG_ARCH_OMAP4) += $(clk-common) clk-44xx.o | 7 | obj-$(CONFIG_ARCH_OMAP4) += $(clk-common) clk-44xx.o |
7 | obj-$(CONFIG_SOC_OMAP5) += $(clk-common) clk-54xx.o | 8 | obj-$(CONFIG_SOC_OMAP5) += $(clk-common) clk-54xx.o |
8 | obj-$(CONFIG_SOC_DRA7XX) += $(clk-common) clk-7xx.o | 9 | obj-$(CONFIG_SOC_DRA7XX) += $(clk-common) clk-7xx.o |
diff --git a/drivers/clk/ti/interface.c b/drivers/clk/ti/interface.c new file mode 100644 index 000000000000..320a2b168bb2 --- /dev/null +++ b/drivers/clk/ti/interface.c | |||
@@ -0,0 +1,125 @@ | |||
1 | /* | ||
2 | * OMAP interface clock 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 const struct clk_ops ti_interface_clk_ops = { | ||
28 | .init = &omap2_init_clk_clkdm, | ||
29 | .enable = &omap2_dflt_clk_enable, | ||
30 | .disable = &omap2_dflt_clk_disable, | ||
31 | .is_enabled = &omap2_dflt_clk_is_enabled, | ||
32 | }; | ||
33 | |||
34 | static void __init _of_ti_interface_clk_setup(struct device_node *node, | ||
35 | const struct clk_hw_omap_ops *ops) | ||
36 | { | ||
37 | struct clk *clk; | ||
38 | struct clk_init_data init = { NULL }; | ||
39 | struct clk_hw_omap *clk_hw; | ||
40 | const char *parent_name; | ||
41 | u32 val; | ||
42 | |||
43 | clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL); | ||
44 | if (!clk_hw) | ||
45 | return; | ||
46 | |||
47 | clk_hw->hw.init = &init; | ||
48 | clk_hw->ops = ops; | ||
49 | clk_hw->flags = MEMMAP_ADDRESSING; | ||
50 | |||
51 | clk_hw->enable_reg = ti_clk_get_reg_addr(node, 0); | ||
52 | if (!clk_hw->enable_reg) | ||
53 | goto cleanup; | ||
54 | |||
55 | if (!of_property_read_u32(node, "ti,bit-shift", &val)) | ||
56 | clk_hw->enable_bit = val; | ||
57 | |||
58 | init.name = node->name; | ||
59 | init.ops = &ti_interface_clk_ops; | ||
60 | init.flags = 0; | ||
61 | |||
62 | parent_name = of_clk_get_parent_name(node, 0); | ||
63 | if (!parent_name) { | ||
64 | pr_err("%s must have a parent\n", node->name); | ||
65 | goto cleanup; | ||
66 | } | ||
67 | |||
68 | init.num_parents = 1; | ||
69 | init.parent_names = &parent_name; | ||
70 | |||
71 | clk = clk_register(NULL, &clk_hw->hw); | ||
72 | |||
73 | if (!IS_ERR(clk)) { | ||
74 | of_clk_add_provider(node, of_clk_src_simple_get, clk); | ||
75 | omap2_init_clk_hw_omap_clocks(clk); | ||
76 | return; | ||
77 | } | ||
78 | |||
79 | cleanup: | ||
80 | kfree(clk_hw); | ||
81 | } | ||
82 | |||
83 | static void __init of_ti_interface_clk_setup(struct device_node *node) | ||
84 | { | ||
85 | _of_ti_interface_clk_setup(node, &clkhwops_iclk_wait); | ||
86 | } | ||
87 | CLK_OF_DECLARE(ti_interface_clk, "ti,omap3-interface-clock", | ||
88 | of_ti_interface_clk_setup); | ||
89 | |||
90 | static void __init of_ti_no_wait_interface_clk_setup(struct device_node *node) | ||
91 | { | ||
92 | _of_ti_interface_clk_setup(node, &clkhwops_iclk); | ||
93 | } | ||
94 | CLK_OF_DECLARE(ti_no_wait_interface_clk, "ti,omap3-no-wait-interface-clock", | ||
95 | of_ti_no_wait_interface_clk_setup); | ||
96 | |||
97 | static void __init of_ti_hsotgusb_interface_clk_setup(struct device_node *node) | ||
98 | { | ||
99 | _of_ti_interface_clk_setup(node, | ||
100 | &clkhwops_omap3430es2_iclk_hsotgusb_wait); | ||
101 | } | ||
102 | CLK_OF_DECLARE(ti_hsotgusb_interface_clk, "ti,omap3-hsotgusb-interface-clock", | ||
103 | of_ti_hsotgusb_interface_clk_setup); | ||
104 | |||
105 | static void __init of_ti_dss_interface_clk_setup(struct device_node *node) | ||
106 | { | ||
107 | _of_ti_interface_clk_setup(node, | ||
108 | &clkhwops_omap3430es2_iclk_dss_usbhost_wait); | ||
109 | } | ||
110 | CLK_OF_DECLARE(ti_dss_interface_clk, "ti,omap3-dss-interface-clock", | ||
111 | of_ti_dss_interface_clk_setup); | ||
112 | |||
113 | static void __init of_ti_ssi_interface_clk_setup(struct device_node *node) | ||
114 | { | ||
115 | _of_ti_interface_clk_setup(node, &clkhwops_omap3430es2_iclk_ssi_wait); | ||
116 | } | ||
117 | CLK_OF_DECLARE(ti_ssi_interface_clk, "ti,omap3-ssi-interface-clock", | ||
118 | of_ti_ssi_interface_clk_setup); | ||
119 | |||
120 | static void __init of_ti_am35xx_interface_clk_setup(struct device_node *node) | ||
121 | { | ||
122 | _of_ti_interface_clk_setup(node, &clkhwops_am35xx_ipss_wait); | ||
123 | } | ||
124 | CLK_OF_DECLARE(ti_am35xx_interface_clk, "ti,am35xx-interface-clock", | ||
125 | of_ti_am35xx_interface_clk_setup); | ||
diff --git a/include/linux/clk/ti.h b/include/linux/clk/ti.h index 0e7c8d956f2b..17c034ea03ad 100644 --- a/include/linux/clk/ti.h +++ b/include/linux/clk/ti.h | |||
@@ -282,6 +282,11 @@ extern const struct clk_hw_omap_ops clkhwops_omap4_dpllmx; | |||
282 | extern const struct clk_hw_omap_ops clkhwops_wait; | 282 | extern const struct clk_hw_omap_ops clkhwops_wait; |
283 | extern const struct clk_hw_omap_ops clkhwops_omap3430es2_dss_usbhost_wait; | 283 | extern const struct clk_hw_omap_ops clkhwops_omap3430es2_dss_usbhost_wait; |
284 | extern const struct clk_hw_omap_ops clkhwops_am35xx_ipss_module_wait; | 284 | extern const struct clk_hw_omap_ops clkhwops_am35xx_ipss_module_wait; |
285 | extern const struct clk_hw_omap_ops clkhwops_am35xx_ipss_wait; | ||
286 | extern const struct clk_hw_omap_ops clkhwops_iclk; | ||
285 | extern const struct clk_hw_omap_ops clkhwops_iclk_wait; | 287 | extern const struct clk_hw_omap_ops clkhwops_iclk_wait; |
288 | extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait; | ||
289 | extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_dss_usbhost_wait; | ||
290 | extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait; | ||
286 | 291 | ||
287 | #endif | 292 | #endif |