diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/clk-private.h | 8 | ||||
-rw-r--r-- | include/linux/clk-provider.h | 30 | ||||
-rw-r--r-- | include/linux/clk.h | 17 | ||||
-rw-r--r-- | include/linux/clkdev.h | 5 | ||||
-rw-r--r-- | include/linux/reset-controller.h | 1 |
5 files changed, 60 insertions, 1 deletions
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h index 8138c94409f3..efbf70b9fd84 100644 --- a/include/linux/clk-private.h +++ b/include/linux/clk-private.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #define __LINUX_CLK_PRIVATE_H | 12 | #define __LINUX_CLK_PRIVATE_H |
13 | 13 | ||
14 | #include <linux/clk-provider.h> | 14 | #include <linux/clk-provider.h> |
15 | #include <linux/kref.h> | ||
15 | #include <linux/list.h> | 16 | #include <linux/list.h> |
16 | 17 | ||
17 | /* | 18 | /* |
@@ -25,10 +26,13 @@ | |||
25 | 26 | ||
26 | #ifdef CONFIG_COMMON_CLK | 27 | #ifdef CONFIG_COMMON_CLK |
27 | 28 | ||
29 | struct module; | ||
30 | |||
28 | struct clk { | 31 | struct clk { |
29 | const char *name; | 32 | const char *name; |
30 | const struct clk_ops *ops; | 33 | const struct clk_ops *ops; |
31 | struct clk_hw *hw; | 34 | struct clk_hw *hw; |
35 | struct module *owner; | ||
32 | struct clk *parent; | 36 | struct clk *parent; |
33 | const char **parent_names; | 37 | const char **parent_names; |
34 | struct clk **parents; | 38 | struct clk **parents; |
@@ -41,12 +45,14 @@ struct clk { | |||
41 | unsigned long flags; | 45 | unsigned long flags; |
42 | unsigned int enable_count; | 46 | unsigned int enable_count; |
43 | unsigned int prepare_count; | 47 | unsigned int prepare_count; |
48 | unsigned long accuracy; | ||
44 | struct hlist_head children; | 49 | struct hlist_head children; |
45 | struct hlist_node child_node; | 50 | struct hlist_node child_node; |
46 | unsigned int notifier_count; | 51 | unsigned int notifier_count; |
47 | #ifdef CONFIG_COMMON_CLK_DEBUG | 52 | #ifdef CONFIG_DEBUG_FS |
48 | struct dentry *dentry; | 53 | struct dentry *dentry; |
49 | #endif | 54 | #endif |
55 | struct kref ref; | ||
50 | }; | 56 | }; |
51 | 57 | ||
52 | /* | 58 | /* |
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 7e59253b8603..999b28ba38f7 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #define CLK_IS_BASIC BIT(5) /* Basic clk, can't do a to_clk_foo() */ | 29 | #define CLK_IS_BASIC BIT(5) /* Basic clk, can't do a to_clk_foo() */ |
30 | #define CLK_GET_RATE_NOCACHE BIT(6) /* do not use the cached clk rate */ | 30 | #define CLK_GET_RATE_NOCACHE BIT(6) /* do not use the cached clk rate */ |
31 | #define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate change */ | 31 | #define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate change */ |
32 | #define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy */ | ||
32 | 33 | ||
33 | struct clk_hw; | 34 | struct clk_hw; |
34 | 35 | ||
@@ -108,6 +109,25 @@ struct clk_hw; | |||
108 | * which is likely helpful for most .set_rate implementation. | 109 | * which is likely helpful for most .set_rate implementation. |
109 | * Returns 0 on success, -EERROR otherwise. | 110 | * Returns 0 on success, -EERROR otherwise. |
110 | * | 111 | * |
112 | * @recalc_accuracy: Recalculate the accuracy of this clock. The clock accuracy | ||
113 | * is expressed in ppb (parts per billion). The parent accuracy is | ||
114 | * an input parameter. | ||
115 | * Returns the calculated accuracy. Optional - if this op is not | ||
116 | * set then clock accuracy will be initialized to parent accuracy | ||
117 | * or 0 (perfect clock) if clock has no parent. | ||
118 | * | ||
119 | * @set_rate_and_parent: Change the rate and the parent of this clock. The | ||
120 | * requested rate is specified by the second argument, which | ||
121 | * should typically be the return of .round_rate call. The | ||
122 | * third argument gives the parent rate which is likely helpful | ||
123 | * for most .set_rate_and_parent implementation. The fourth | ||
124 | * argument gives the parent index. This callback is optional (and | ||
125 | * unnecessary) for clocks with 0 or 1 parents as well as | ||
126 | * for clocks that can tolerate switching the rate and the parent | ||
127 | * separately via calls to .set_parent and .set_rate. | ||
128 | * Returns 0 on success, -EERROR otherwise. | ||
129 | * | ||
130 | * | ||
111 | * The clk_enable/clk_disable and clk_prepare/clk_unprepare pairs allow | 131 | * The clk_enable/clk_disable and clk_prepare/clk_unprepare pairs allow |
112 | * implementations to split any work between atomic (enable) and sleepable | 132 | * implementations to split any work between atomic (enable) and sleepable |
113 | * (prepare) contexts. If enabling a clock requires code that might sleep, | 133 | * (prepare) contexts. If enabling a clock requires code that might sleep, |
@@ -139,6 +159,11 @@ struct clk_ops { | |||
139 | u8 (*get_parent)(struct clk_hw *hw); | 159 | u8 (*get_parent)(struct clk_hw *hw); |
140 | int (*set_rate)(struct clk_hw *hw, unsigned long, | 160 | int (*set_rate)(struct clk_hw *hw, unsigned long, |
141 | unsigned long); | 161 | unsigned long); |
162 | int (*set_rate_and_parent)(struct clk_hw *hw, | ||
163 | unsigned long rate, | ||
164 | unsigned long parent_rate, u8 index); | ||
165 | unsigned long (*recalc_accuracy)(struct clk_hw *hw, | ||
166 | unsigned long parent_accuracy); | ||
142 | void (*init)(struct clk_hw *hw); | 167 | void (*init)(struct clk_hw *hw); |
143 | }; | 168 | }; |
144 | 169 | ||
@@ -194,6 +219,7 @@ struct clk_hw { | |||
194 | struct clk_fixed_rate { | 219 | struct clk_fixed_rate { |
195 | struct clk_hw hw; | 220 | struct clk_hw hw; |
196 | unsigned long fixed_rate; | 221 | unsigned long fixed_rate; |
222 | unsigned long fixed_accuracy; | ||
197 | u8 flags; | 223 | u8 flags; |
198 | }; | 224 | }; |
199 | 225 | ||
@@ -201,6 +227,9 @@ extern const struct clk_ops clk_fixed_rate_ops; | |||
201 | struct clk *clk_register_fixed_rate(struct device *dev, const char *name, | 227 | struct clk *clk_register_fixed_rate(struct device *dev, const char *name, |
202 | const char *parent_name, unsigned long flags, | 228 | const char *parent_name, unsigned long flags, |
203 | unsigned long fixed_rate); | 229 | unsigned long fixed_rate); |
230 | struct clk *clk_register_fixed_rate_with_accuracy(struct device *dev, | ||
231 | const char *name, const char *parent_name, unsigned long flags, | ||
232 | unsigned long fixed_rate, unsigned long fixed_accuracy); | ||
204 | 233 | ||
205 | void of_fixed_clk_setup(struct device_node *np); | 234 | void of_fixed_clk_setup(struct device_node *np); |
206 | 235 | ||
@@ -433,6 +462,7 @@ struct clk *clk_get_parent_by_index(struct clk *clk, u8 index); | |||
433 | unsigned int __clk_get_enable_count(struct clk *clk); | 462 | unsigned int __clk_get_enable_count(struct clk *clk); |
434 | unsigned int __clk_get_prepare_count(struct clk *clk); | 463 | unsigned int __clk_get_prepare_count(struct clk *clk); |
435 | unsigned long __clk_get_rate(struct clk *clk); | 464 | unsigned long __clk_get_rate(struct clk *clk); |
465 | unsigned long __clk_get_accuracy(struct clk *clk); | ||
436 | unsigned long __clk_get_flags(struct clk *clk); | 466 | unsigned long __clk_get_flags(struct clk *clk); |
437 | bool __clk_is_prepared(struct clk *clk); | 467 | bool __clk_is_prepared(struct clk *clk); |
438 | bool __clk_is_enabled(struct clk *clk); | 468 | bool __clk_is_enabled(struct clk *clk); |
diff --git a/include/linux/clk.h b/include/linux/clk.h index 9a6d04524b1a..0dd91148165e 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h | |||
@@ -82,6 +82,23 @@ int clk_notifier_register(struct clk *clk, struct notifier_block *nb); | |||
82 | 82 | ||
83 | int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb); | 83 | int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb); |
84 | 84 | ||
85 | /** | ||
86 | * clk_get_accuracy - obtain the clock accuracy in ppb (parts per billion) | ||
87 | * for a clock source. | ||
88 | * @clk: clock source | ||
89 | * | ||
90 | * This gets the clock source accuracy expressed in ppb. | ||
91 | * A perfect clock returns 0. | ||
92 | */ | ||
93 | long clk_get_accuracy(struct clk *clk); | ||
94 | |||
95 | #else | ||
96 | |||
97 | static inline long clk_get_accuracy(struct clk *clk) | ||
98 | { | ||
99 | return -ENOTSUPP; | ||
100 | } | ||
101 | |||
85 | #endif | 102 | #endif |
86 | 103 | ||
87 | /** | 104 | /** |
diff --git a/include/linux/clkdev.h b/include/linux/clkdev.h index a6a6f603103b..94bad77eeb4a 100644 --- a/include/linux/clkdev.h +++ b/include/linux/clkdev.h | |||
@@ -43,4 +43,9 @@ int clk_add_alias(const char *, const char *, char *, struct device *); | |||
43 | int clk_register_clkdev(struct clk *, const char *, const char *, ...); | 43 | int clk_register_clkdev(struct clk *, const char *, const char *, ...); |
44 | int clk_register_clkdevs(struct clk *, struct clk_lookup *, size_t); | 44 | int clk_register_clkdevs(struct clk *, struct clk_lookup *, size_t); |
45 | 45 | ||
46 | #ifdef CONFIG_COMMON_CLK | ||
47 | int __clk_get(struct clk *clk); | ||
48 | void __clk_put(struct clk *clk); | ||
49 | #endif | ||
50 | |||
46 | #endif | 51 | #endif |
diff --git a/include/linux/reset-controller.h b/include/linux/reset-controller.h index 2f61311ae3e0..41a4695fde08 100644 --- a/include/linux/reset-controller.h +++ b/include/linux/reset-controller.h | |||
@@ -21,6 +21,7 @@ struct reset_control_ops { | |||
21 | 21 | ||
22 | struct module; | 22 | struct module; |
23 | struct device_node; | 23 | struct device_node; |
24 | struct of_phandle_args; | ||
24 | 25 | ||
25 | /** | 26 | /** |
26 | * struct reset_controller_dev - reset controller entity that might | 27 | * struct reset_controller_dev - reset controller entity that might |