aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMichael Turquette <mturquette@linaro.org>2015-01-29 17:22:50 -0500
committerMichael Turquette <mturquette@linaro.org>2015-02-02 17:23:41 -0500
commitb09d6d99102504a929cfaba4cd0e07658d7f01d1 (patch)
tree57bf5300cd8920152daaa79875b3910700eb5170 /include
parentc87ea8a8a0af8b76c1e4d1bd67ed7859c04477a7 (diff)
clk: remove clk-private.h
Private clock framework data structures should be private, surprisingly. Now that all platforms and drivers have been updated to remove static initializations of struct clk and struct clk_core objects and all references to clk-private.h have been removed we can move the definitions of these structures into drivers/clk/clk.c and delete the header. Additionally the ugly DEFINE_CLK macros have been removed. Those were used for static definitions of struct clk objects. That practice is no longer allowed. Finally __clk_init is staticized as it is no longer declared in any header. Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Michael Turquette <mturquette@linaro.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/clk-private.h237
1 files changed, 0 insertions, 237 deletions
diff --git a/include/linux/clk-private.h b/include/linux/clk-private.h
deleted file mode 100644
index ae55d99a2313..000000000000
--- a/include/linux/clk-private.h
+++ /dev/null
@@ -1,237 +0,0 @@
1/*
2 * linux/include/linux/clk-private.h
3 *
4 * Copyright (c) 2010-2011 Jeremy Kerr <jeremy.kerr@canonical.com>
5 * Copyright (C) 2011-2012 Linaro Ltd <mturquette@linaro.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#ifndef __LINUX_CLK_PRIVATE_H
12#define __LINUX_CLK_PRIVATE_H
13
14#include <linux/clk-provider.h>
15#include <linux/kref.h>
16#include <linux/list.h>
17
18/*
19 * WARNING: Do not include clk-private.h from any file that implements struct
20 * clk_ops. Doing so is a layering violation!
21 *
22 * This header exists only to allow for statically initialized clock data. Any
23 * static clock data must be defined in a separate file from the logic that
24 * implements the clock operations for that same data.
25 */
26
27#ifdef CONFIG_COMMON_CLK
28
29struct module;
30
31struct clk_core {
32 const char *name;
33 const struct clk_ops *ops;
34 struct clk_hw *hw;
35 struct module *owner;
36 struct clk_core *parent;
37 const char **parent_names;
38 struct clk_core **parents;
39 u8 num_parents;
40 u8 new_parent_index;
41 unsigned long rate;
42 unsigned long new_rate;
43 struct clk_core *new_parent;
44 struct clk_core *new_child;
45 unsigned long flags;
46 unsigned int enable_count;
47 unsigned int prepare_count;
48 unsigned long accuracy;
49 int phase;
50 struct hlist_head children;
51 struct hlist_node child_node;
52 struct hlist_node debug_node;
53 unsigned int notifier_count;
54#ifdef CONFIG_DEBUG_FS
55 struct dentry *dentry;
56#endif
57 struct kref ref;
58};
59
60struct clk {
61 struct clk_core *core;
62 const char *dev_id;
63 const char *con_id;
64};
65
66/*
67 * DOC: Basic clock implementations common to many platforms
68 *
69 * Each basic clock hardware type is comprised of a structure describing the
70 * clock hardware, implementations of the relevant callbacks in struct clk_ops,
71 * unique flags for that hardware type, a registration function and an
72 * alternative macro for static initialization
73 */
74
75#define DEFINE_CLK(_name, _ops, _flags, _parent_names, \
76 _parents) \
77 static struct clk _name = { \
78 .core = &_name##_core \
79 }; \
80 static struct clk_core _name##_core = { \
81 .name = #_name, \
82 .ops = &_ops, \
83 .hw = &_name##_hw.hw, \
84 .parent_names = _parent_names, \
85 .num_parents = ARRAY_SIZE(_parent_names), \
86 .parents = _parents, \
87 .flags = _flags | CLK_IS_BASIC, \
88 }
89
90#define DEFINE_CLK_FIXED_RATE(_name, _flags, _rate, \
91 _fixed_rate_flags) \
92 static struct clk _name; \
93 static struct clk_core _name##_core; \
94 static const char *_name##_parent_names[] = {}; \
95 static struct clk_fixed_rate _name##_hw = { \
96 .hw = { \
97 .core = &_name##_core, \
98 .clk = &_name, \
99 }, \
100 .fixed_rate = _rate, \
101 .flags = _fixed_rate_flags, \
102 }; \
103 DEFINE_CLK(_name, clk_fixed_rate_ops, _flags, \
104 _name##_parent_names, NULL);
105
106#define DEFINE_CLK_GATE(_name, _parent_name, _parent_ptr, \
107 _flags, _reg, _bit_idx, \
108 _gate_flags, _lock) \
109 static struct clk _name; \
110 static struct clk_core _name##_core; \
111 static const char *_name##_parent_names[] = { \
112 _parent_name, \
113 }; \
114 static struct clk_core *_name##_parents[] = { \
115 _parent_ptr, \
116 }; \
117 static struct clk_gate _name##_hw = { \
118 .hw = { \
119 .core = &_name##_core, \
120 .clk = &_name, \
121 }, \
122 .reg = _reg, \
123 .bit_idx = _bit_idx, \
124 .flags = _gate_flags, \
125 .lock = _lock, \
126 }; \
127 DEFINE_CLK(_name, clk_gate_ops, _flags, \
128 _name##_parent_names, _name##_parents);
129
130#define _DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \
131 _flags, _reg, _shift, _width, \
132 _divider_flags, _table, _lock) \
133 static struct clk _name; \
134 static struct clk_core _name##_core; \
135 static const char *_name##_parent_names[] = { \
136 _parent_name, \
137 }; \
138 static struct clk_core *_name##_parents[] = { \
139 _parent_ptr, \
140 }; \
141 static struct clk_divider _name##_hw = { \
142 .hw = { \
143 .core = &_name##_core, \
144 .clk = &_name, \
145 }, \
146 .reg = _reg, \
147 .shift = _shift, \
148 .width = _width, \
149 .flags = _divider_flags, \
150 .table = _table, \
151 .lock = _lock, \
152 }; \
153 DEFINE_CLK(_name, clk_divider_ops, _flags, \
154 _name##_parent_names, _name##_parents);
155
156#define DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \
157 _flags, _reg, _shift, _width, \
158 _divider_flags, _lock) \
159 _DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \
160 _flags, _reg, _shift, _width, \
161 _divider_flags, NULL, _lock)
162
163#define DEFINE_CLK_DIVIDER_TABLE(_name, _parent_name, \
164 _parent_ptr, _flags, _reg, \
165 _shift, _width, _divider_flags, \
166 _table, _lock) \
167 _DEFINE_CLK_DIVIDER(_name, _parent_name, _parent_ptr, \
168 _flags, _reg, _shift, _width, \
169 _divider_flags, _table, _lock) \
170
171#define DEFINE_CLK_MUX(_name, _parent_names, _parents, _flags, \
172 _reg, _shift, _width, \
173 _mux_flags, _lock) \
174 static struct clk _name; \
175 static struct clk_core _name##_core; \
176 static struct clk_mux _name##_hw = { \
177 .hw = { \
178 .core = &_name##_core, \
179 .clk = &_name, \
180 }, \
181 .reg = _reg, \
182 .shift = _shift, \
183 .mask = BIT(_width) - 1, \
184 .flags = _mux_flags, \
185 .lock = _lock, \
186 }; \
187 DEFINE_CLK(_name, clk_mux_ops, _flags, _parent_names, \
188 _parents);
189
190#define DEFINE_CLK_FIXED_FACTOR(_name, _parent_name, \
191 _parent_ptr, _flags, \
192 _mult, _div) \
193 static struct clk _name; \
194 static struct clk_core _name##_core; \
195 static const char *_name##_parent_names[] = { \
196 _parent_name, \
197 }; \
198 static struct clk_core *_name##_parents[] = { \
199 _parent_ptr, \
200 }; \
201 static struct clk_fixed_factor _name##_hw = { \
202 .hw = { \
203 .core = &_name##_core, \
204 .clk = &_name, \
205 }, \
206 .mult = _mult, \
207 .div = _div, \
208 }; \
209 DEFINE_CLK(_name, clk_fixed_factor_ops, _flags, \
210 _name##_parent_names, _name##_parents);
211
212/**
213 * __clk_init - initialize the data structures in a struct clk
214 * @dev: device initializing this clk, placeholder for now
215 * @clk: clk being initialized
216 *
217 * Initializes the lists in struct clk, queries the hardware for the
218 * parent and rate and sets them both.
219 *
220 * Any struct clk passed into __clk_init must have the following members
221 * populated:
222 * .name
223 * .ops
224 * .hw
225 * .parent_names
226 * .num_parents
227 * .flags
228 *
229 * It is not necessary to call clk_register if __clk_init is used directly with
230 * statically initialized clock data.
231 *
232 * Returns 0 on success, otherwise an error code.
233 */
234int __clk_init(struct device *dev, struct clk *clk);
235
236#endif /* CONFIG_COMMON_CLK */
237#endif /* CLK_PRIVATE_H */