aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/plat-mxc/clock.c154
1 files changed, 0 insertions, 154 deletions
diff --git a/arch/arm/plat-mxc/clock.c b/arch/arm/plat-mxc/clock.c
index f653213b7416..9e8fbd57495c 100644
--- a/arch/arm/plat-mxc/clock.c
+++ b/arch/arm/plat-mxc/clock.c
@@ -48,76 +48,6 @@ static DEFINE_MUTEX(clocks_mutex);
48 * Standard clock functions defined in include/linux/clk.h 48 * Standard clock functions defined in include/linux/clk.h
49 *-------------------------------------------------------------------------*/ 49 *-------------------------------------------------------------------------*/
50 50
51/*
52 * All the code inside #ifndef CONFIG_COMMON_CLKDEV can be removed once all
53 * MXC architectures have switched to using clkdev.
54 */
55#ifndef CONFIG_COMMON_CLKDEV
56/*
57 * Retrieve a clock by name.
58 *
59 * Note that we first try to use device id on the bus
60 * and clock name. If this fails, we try to use "<name>.<id>". If this fails,
61 * we try to use clock name only.
62 * The reference count to the clock's module owner ref count is incremented.
63 */
64struct clk *clk_get(struct device *dev, const char *id)
65{
66 struct clk *p, *clk = ERR_PTR(-ENOENT);
67 int idno;
68 const char *str;
69
70 if (id == NULL)
71 return clk;
72
73 if (dev == NULL || dev->bus != &platform_bus_type)
74 idno = -1;
75 else
76 idno = to_platform_device(dev)->id;
77
78 mutex_lock(&clocks_mutex);
79
80 list_for_each_entry(p, &clocks, node) {
81 if (p->id == idno &&
82 strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
83 clk = p;
84 goto found;
85 }
86 }
87
88 str = strrchr(id, '.');
89 if (str) {
90 int cnt = str - id;
91 str++;
92 idno = simple_strtol(str, NULL, 10);
93 list_for_each_entry(p, &clocks, node) {
94 if (p->id == idno &&
95 strlen(p->name) == cnt &&
96 strncmp(id, p->name, cnt) == 0 &&
97 try_module_get(p->owner)) {
98 clk = p;
99 goto found;
100 }
101 }
102 }
103
104 list_for_each_entry(p, &clocks, node) {
105 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
106 clk = p;
107 goto found;
108 }
109 }
110
111 printk(KERN_WARNING "clk: Unable to get requested clock: %s\n", id);
112
113found:
114 mutex_unlock(&clocks_mutex);
115
116 return clk;
117}
118EXPORT_SYMBOL(clk_get);
119#endif
120
121static void __clk_disable(struct clk *clk) 51static void __clk_disable(struct clk *clk)
122{ 52{
123 if (clk == NULL || IS_ERR(clk)) 53 if (clk == NULL || IS_ERR(clk))
@@ -194,16 +124,6 @@ unsigned long clk_get_rate(struct clk *clk)
194} 124}
195EXPORT_SYMBOL(clk_get_rate); 125EXPORT_SYMBOL(clk_get_rate);
196 126
197#ifndef CONFIG_COMMON_CLKDEV
198/* Decrement the clock's module reference count */
199void clk_put(struct clk *clk)
200{
201 if (clk && !IS_ERR(clk))
202 module_put(clk->owner);
203}
204EXPORT_SYMBOL(clk_put);
205#endif
206
207/* Round the requested clock rate to the nearest supported 127/* Round the requested clock rate to the nearest supported
208 * rate that is less than or equal to the requested rate. 128 * rate that is less than or equal to the requested rate.
209 * This is dependent on the clock's current parent. 129 * This is dependent on the clock's current parent.
@@ -266,80 +186,6 @@ struct clk *clk_get_parent(struct clk *clk)
266} 186}
267EXPORT_SYMBOL(clk_get_parent); 187EXPORT_SYMBOL(clk_get_parent);
268 188
269#ifndef CONFIG_COMMON_CLKDEV
270/*
271 * Add a new clock to the clock tree.
272 */
273int clk_register(struct clk *clk)
274{
275 if (clk == NULL || IS_ERR(clk))
276 return -EINVAL;
277
278 mutex_lock(&clocks_mutex);
279 list_add(&clk->node, &clocks);
280 mutex_unlock(&clocks_mutex);
281
282 return 0;
283}
284EXPORT_SYMBOL(clk_register);
285
286/* Remove a clock from the clock tree */
287void clk_unregister(struct clk *clk)
288{
289 if (clk == NULL || IS_ERR(clk))
290 return;
291
292 mutex_lock(&clocks_mutex);
293 list_del(&clk->node);
294 mutex_unlock(&clocks_mutex);
295}
296EXPORT_SYMBOL(clk_unregister);
297
298#ifdef CONFIG_PROC_FS
299static int mxc_clock_read_proc(char *page, char **start, off_t off,
300 int count, int *eof, void *data)
301{
302 struct clk *clkp;
303 char *p = page;
304 int len;
305
306 list_for_each_entry(clkp, &clocks, node) {
307 p += sprintf(p, "%s-%d:\t\t%lu, %d", clkp->name, clkp->id,
308 clk_get_rate(clkp), clkp->usecount);
309 if (clkp->parent)
310 p += sprintf(p, ", %s-%d\n", clkp->parent->name,
311 clkp->parent->id);
312 else
313 p += sprintf(p, "\n");
314 }
315
316 len = (p - page) - off;
317 if (len < 0)
318 len = 0;
319
320 *eof = (len <= count) ? 1 : 0;
321 *start = page + off;
322
323 return len;
324}
325
326static int __init mxc_setup_proc_entry(void)
327{
328 struct proc_dir_entry *res;
329
330 res = create_proc_read_entry("cpu/clocks", 0, NULL,
331 mxc_clock_read_proc, NULL);
332 if (!res) {
333 printk(KERN_ERR "Failed to create proc/cpu/clocks\n");
334 return -ENOMEM;
335 }
336 return 0;
337}
338
339late_initcall(mxc_setup_proc_entry);
340#endif /* CONFIG_PROC_FS */
341#endif
342
343/* 189/*
344 * Get the resulting clock rate from a PLL register value and the input 190 * Get the resulting clock rate from a PLL register value and the input
345 * frequency. PLLs with this register layout can at least be found on 191 * frequency. PLLs with this register layout can at least be found on