blob: 34707b867760832fe791e0436bc501c1902d4a18 [file] [log] [blame]
Paul Mundt36ddf312006-01-16 22:14:17 -08001/*
2 * arch/sh/kernel/cpu/clock.c - SuperH clock framework
3 *
Paul Mundtb1f6cfe2009-05-12 04:27:43 +09004 * Copyright (C) 2005 - 2009 Paul Mundt
Paul Mundt36ddf312006-01-16 22:14:17 -08005 *
6 * This clock framework is derived from the OMAP version by:
7 *
Paul Mundtb1f6cfe2009-05-12 04:27:43 +09008 * Copyright (C) 2004 - 2008 Nokia Corporation
Paul Mundt36ddf312006-01-16 22:14:17 -08009 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
10 *
Paul Mundt1d118562006-12-01 13:15:14 +090011 * Modified for omap shared clock framework by Tony Lindgren <tony@atomide.com>
12 *
Paul Mundt0dae8952009-05-12 06:18:09 +090013 * With clkdev bits:
14 *
15 * Copyright (C) 2008 Russell King.
16 *
Paul Mundt36ddf312006-01-16 22:14:17 -080017 * This file is subject to the terms and conditions of the GNU General Public
18 * License. See the file "COPYING" in the main directory of this archive
19 * for more details.
20 */
21#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/module.h>
Paul Mundt237b98f2006-09-27 17:28:20 +090024#include <linux/mutex.h>
Paul Mundt36ddf312006-01-16 22:14:17 -080025#include <linux/list.h>
Francesco VIRLINZI4a550262009-03-11 07:42:05 +000026#include <linux/kobject.h>
27#include <linux/sysdev.h>
Paul Mundt36ddf312006-01-16 22:14:17 -080028#include <linux/seq_file.h>
29#include <linux/err.h>
Paul Mundt1d118562006-12-01 13:15:14 +090030#include <linux/platform_device.h>
Paul Mundtdb62e5b2007-04-26 12:17:20 +090031#include <linux/proc_fs.h>
Paul Mundt36ddf312006-01-16 22:14:17 -080032#include <asm/clock.h>
33#include <asm/timer.h>
34
35static LIST_HEAD(clock_list);
36static DEFINE_SPINLOCK(clock_lock);
Paul Mundt237b98f2006-09-27 17:28:20 +090037static DEFINE_MUTEX(clock_list_sem);
Paul Mundt36ddf312006-01-16 22:14:17 -080038
39/*
40 * Each subtype is expected to define the init routines for these clocks,
41 * as each subtype (or processor family) will have these clocks at the
42 * very least. These are all provided through the CPG, which even some of
43 * the more quirky parts (such as ST40, SH4-202, etc.) still have.
44 *
45 * The processor-specific code is expected to register any additional
46 * clock sources that are of interest.
47 */
48static struct clk master_clk = {
49 .name = "master_clk",
Paul Mundt4ff29ff2009-05-12 05:14:53 +090050 .flags = CLK_ENABLE_ON_INIT,
Paul Mundt36ddf312006-01-16 22:14:17 -080051 .rate = CONFIG_SH_PCLK_FREQ,
Paul Mundt36ddf312006-01-16 22:14:17 -080052};
53
54static struct clk module_clk = {
55 .name = "module_clk",
56 .parent = &master_clk,
Paul Mundt4ff29ff2009-05-12 05:14:53 +090057 .flags = CLK_ENABLE_ON_INIT,
Paul Mundt36ddf312006-01-16 22:14:17 -080058};
59
60static struct clk bus_clk = {
61 .name = "bus_clk",
62 .parent = &master_clk,
Paul Mundt4ff29ff2009-05-12 05:14:53 +090063 .flags = CLK_ENABLE_ON_INIT,
Paul Mundt36ddf312006-01-16 22:14:17 -080064};
65
66static struct clk cpu_clk = {
67 .name = "cpu_clk",
68 .parent = &master_clk,
Paul Mundt4ff29ff2009-05-12 05:14:53 +090069 .flags = CLK_ENABLE_ON_INIT,
Paul Mundt36ddf312006-01-16 22:14:17 -080070};
71
72/*
73 * The ordering of these clocks matters, do not change it.
74 */
75static struct clk *onchip_clocks[] = {
76 &master_clk,
77 &module_clk,
78 &bus_clk,
79 &cpu_clk,
80};
81
Paul Mundta02cb232009-05-12 03:50:44 +090082/* Used for clocks that always have same value as the parent clock */
83unsigned long followparent_recalc(struct clk *clk)
84{
85 return clk->parent->rate;
86}
87
Paul Mundtaa87aa32009-05-12 05:51:05 +090088int clk_reparent(struct clk *child, struct clk *parent)
89{
90 list_del_init(&child->sibling);
91 if (parent)
92 list_add(&child->sibling, &parent->children);
93 child->parent = parent;
94
95 /* now do the debugfs renaming to reattach the child
96 to the proper parent */
97
98 return 0;
99}
100
Paul Mundtb1f6cfe2009-05-12 04:27:43 +0900101/* Propagate rate to children */
102void propagate_rate(struct clk *tclk)
103{
104 struct clk *clkp;
105
106 list_for_each_entry(clkp, &tclk->children, sibling) {
107 if (clkp->ops->recalc)
108 clkp->rate = clkp->ops->recalc(clkp);
109 propagate_rate(clkp);
110 }
111}
112
Adrian Bunk4c1cfab2008-06-18 03:36:50 +0300113static void __clk_disable(struct clk *clk)
Paul Mundt36ddf312006-01-16 22:14:17 -0800114{
Paul Mundtae891a42009-05-12 05:30:10 +0900115 if (clk->usecount == 0) {
116 printk(KERN_ERR "Trying disable clock %s with 0 usecount\n",
117 clk->name);
118 WARN_ON(1);
119 return;
120 }
121
122 if (!(--clk->usecount)) {
dmitry pervushin1929cb32007-04-24 13:39:09 +0900123 if (likely(clk->ops && clk->ops->disable))
124 clk->ops->disable(clk);
Paul Mundt4ff29ff2009-05-12 05:14:53 +0900125 if (likely(clk->parent))
126 __clk_disable(clk->parent);
dmitry pervushin1929cb32007-04-24 13:39:09 +0900127 }
Paul Mundt36ddf312006-01-16 22:14:17 -0800128}
129
130void clk_disable(struct clk *clk)
131{
132 unsigned long flags;
133
Paul Mundt4ff29ff2009-05-12 05:14:53 +0900134 if (!clk)
135 return;
136
Paul Mundt36ddf312006-01-16 22:14:17 -0800137 spin_lock_irqsave(&clock_lock, flags);
138 __clk_disable(clk);
139 spin_unlock_irqrestore(&clock_lock, flags);
140}
Paul Mundtdb62e5b2007-04-26 12:17:20 +0900141EXPORT_SYMBOL_GPL(clk_disable);
Paul Mundt36ddf312006-01-16 22:14:17 -0800142
Paul Mundtae891a42009-05-12 05:30:10 +0900143static int __clk_enable(struct clk *clk)
144{
145 int ret = 0;
146
147 if (clk->usecount++ == 0) {
148 if (clk->parent) {
149 ret = __clk_enable(clk->parent);
150 if (unlikely(ret))
151 goto err;
152 }
153
154 if (clk->ops && clk->ops->enable) {
155 ret = clk->ops->enable(clk);
156 if (ret) {
157 if (clk->parent)
158 __clk_disable(clk->parent);
159 goto err;
160 }
161 }
162 }
163
164 return ret;
165err:
166 clk->usecount--;
167 return ret;
168}
169
170int clk_enable(struct clk *clk)
171{
172 unsigned long flags;
173 int ret;
174
175 if (!clk)
176 return -EINVAL;
177
178 spin_lock_irqsave(&clock_lock, flags);
179 ret = __clk_enable(clk);
180 spin_unlock_irqrestore(&clock_lock, flags);
181
182 return ret;
183}
184EXPORT_SYMBOL_GPL(clk_enable);
185
Paul Mundtb1f6cfe2009-05-12 04:27:43 +0900186static LIST_HEAD(root_clks);
187
188/**
189 * recalculate_root_clocks - recalculate and propagate all root clocks
190 *
191 * Recalculates all root clocks (clocks with no parent), which if the
192 * clock's .recalc is set correctly, should also propagate their rates.
193 * Called at init.
194 */
195void recalculate_root_clocks(void)
196{
197 struct clk *clkp;
198
199 list_for_each_entry(clkp, &root_clks, sibling) {
200 if (clkp->ops->recalc)
201 clkp->rate = clkp->ops->recalc(clkp);
202 propagate_rate(clkp);
203 }
204}
205
Paul Mundt36ddf312006-01-16 22:14:17 -0800206int clk_register(struct clk *clk)
207{
Paul Mundtb1f6cfe2009-05-12 04:27:43 +0900208 if (clk == NULL || IS_ERR(clk))
209 return -EINVAL;
210
211 /*
212 * trap out already registered clocks
213 */
214 if (clk->node.next || clk->node.prev)
215 return 0;
216
Paul Mundt237b98f2006-09-27 17:28:20 +0900217 mutex_lock(&clock_list_sem);
Paul Mundt36ddf312006-01-16 22:14:17 -0800218
Paul Mundtb1f6cfe2009-05-12 04:27:43 +0900219 INIT_LIST_HEAD(&clk->children);
Paul Mundt4ff29ff2009-05-12 05:14:53 +0900220 clk->usecount = 0;
Paul Mundtb1f6cfe2009-05-12 04:27:43 +0900221
222 if (clk->parent)
223 list_add(&clk->sibling, &clk->parent->children);
224 else
225 list_add(&clk->sibling, &root_clks);
226
Paul Mundt36ddf312006-01-16 22:14:17 -0800227 list_add(&clk->node, &clock_list);
Paul Mundt4ff29ff2009-05-12 05:14:53 +0900228 if (clk->ops->init)
229 clk->ops->init(clk);
Paul Mundt237b98f2006-09-27 17:28:20 +0900230 mutex_unlock(&clock_list_sem);
Paul Mundt36ddf312006-01-16 22:14:17 -0800231
232 return 0;
233}
Paul Mundtdb62e5b2007-04-26 12:17:20 +0900234EXPORT_SYMBOL_GPL(clk_register);
Paul Mundt36ddf312006-01-16 22:14:17 -0800235
236void clk_unregister(struct clk *clk)
237{
Paul Mundt237b98f2006-09-27 17:28:20 +0900238 mutex_lock(&clock_list_sem);
Paul Mundtb1f6cfe2009-05-12 04:27:43 +0900239 list_del(&clk->sibling);
Paul Mundt36ddf312006-01-16 22:14:17 -0800240 list_del(&clk->node);
Paul Mundt237b98f2006-09-27 17:28:20 +0900241 mutex_unlock(&clock_list_sem);
Paul Mundt36ddf312006-01-16 22:14:17 -0800242}
Paul Mundtdb62e5b2007-04-26 12:17:20 +0900243EXPORT_SYMBOL_GPL(clk_unregister);
Paul Mundt36ddf312006-01-16 22:14:17 -0800244
Paul Mundt4ff29ff2009-05-12 05:14:53 +0900245static void clk_enable_init_clocks(void)
246{
247 struct clk *clkp;
248
249 list_for_each_entry(clkp, &clock_list, node)
250 if (clkp->flags & CLK_ENABLE_ON_INIT)
251 clk_enable(clkp);
252}
253
Paul Mundtdb62e5b2007-04-26 12:17:20 +0900254unsigned long clk_get_rate(struct clk *clk)
Paul Mundt36ddf312006-01-16 22:14:17 -0800255{
256 return clk->rate;
257}
Paul Mundtdb62e5b2007-04-26 12:17:20 +0900258EXPORT_SYMBOL_GPL(clk_get_rate);
Paul Mundt36ddf312006-01-16 22:14:17 -0800259
260int clk_set_rate(struct clk *clk, unsigned long rate)
261{
dmitry pervushin1929cb32007-04-24 13:39:09 +0900262 return clk_set_rate_ex(clk, rate, 0);
263}
Paul Mundtdb62e5b2007-04-26 12:17:20 +0900264EXPORT_SYMBOL_GPL(clk_set_rate);
dmitry pervushin1929cb32007-04-24 13:39:09 +0900265
266int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id)
267{
Paul Mundt36ddf312006-01-16 22:14:17 -0800268 int ret = -EOPNOTSUPP;
269
270 if (likely(clk->ops && clk->ops->set_rate)) {
271 unsigned long flags;
272
273 spin_lock_irqsave(&clock_lock, flags);
dmitry pervushin1929cb32007-04-24 13:39:09 +0900274 ret = clk->ops->set_rate(clk, rate, algo_id);
Paul Mundtb1f6cfe2009-05-12 04:27:43 +0900275 if (ret == 0) {
276 if (clk->ops->recalc)
277 clk->rate = clk->ops->recalc(clk);
278 propagate_rate(clk);
279 }
Paul Mundt36ddf312006-01-16 22:14:17 -0800280 spin_unlock_irqrestore(&clock_lock, flags);
281 }
282
Paul Mundt36ddf312006-01-16 22:14:17 -0800283 return ret;
284}
Paul Mundtdb62e5b2007-04-26 12:17:20 +0900285EXPORT_SYMBOL_GPL(clk_set_rate_ex);
Paul Mundt36ddf312006-01-16 22:14:17 -0800286
Francesco VIRLINZId680c762009-03-11 07:40:54 +0000287int clk_set_parent(struct clk *clk, struct clk *parent)
288{
Paul Mundtb1f6cfe2009-05-12 04:27:43 +0900289 unsigned long flags;
Francesco VIRLINZId680c762009-03-11 07:40:54 +0000290 int ret = -EINVAL;
Francesco VIRLINZId680c762009-03-11 07:40:54 +0000291
292 if (!parent || !clk)
293 return ret;
Paul Mundtaa87aa32009-05-12 05:51:05 +0900294 if (clk->parent == parent)
295 return 0;
Francesco VIRLINZId680c762009-03-11 07:40:54 +0000296
Paul Mundtb1f6cfe2009-05-12 04:27:43 +0900297 spin_lock_irqsave(&clock_lock, flags);
298 if (clk->usecount == 0) {
299 if (clk->ops->set_parent)
300 ret = clk->ops->set_parent(clk, parent);
Paul Mundtaa87aa32009-05-12 05:51:05 +0900301 else
302 ret = clk_reparent(clk, parent);
303
Paul Mundtb1f6cfe2009-05-12 04:27:43 +0900304 if (ret == 0) {
Paul Mundtaa87aa32009-05-12 05:51:05 +0900305 pr_debug("clock: set parent of %s to %s (new rate %ld)\n",
306 clk->name, clk->parent->name, clk->rate);
Paul Mundtb1f6cfe2009-05-12 04:27:43 +0900307 if (clk->ops->recalc)
308 clk->rate = clk->ops->recalc(clk);
309 propagate_rate(clk);
310 }
311 } else
312 ret = -EBUSY;
313 spin_unlock_irqrestore(&clock_lock, flags);
Francesco VIRLINZId680c762009-03-11 07:40:54 +0000314
Francesco VIRLINZId680c762009-03-11 07:40:54 +0000315 return ret;
316}
317EXPORT_SYMBOL_GPL(clk_set_parent);
318
319struct clk *clk_get_parent(struct clk *clk)
320{
321 return clk->parent;
322}
323EXPORT_SYMBOL_GPL(clk_get_parent);
324
Paul Mundtf6991b02007-07-20 13:29:09 +0900325long clk_round_rate(struct clk *clk, unsigned long rate)
326{
327 if (likely(clk->ops && clk->ops->round_rate)) {
328 unsigned long flags, rounded;
329
330 spin_lock_irqsave(&clock_lock, flags);
331 rounded = clk->ops->round_rate(clk, rate);
332 spin_unlock_irqrestore(&clock_lock, flags);
333
334 return rounded;
335 }
336
337 return clk_get_rate(clk);
338}
339EXPORT_SYMBOL_GPL(clk_round_rate);
340
Paul Mundt1d118562006-12-01 13:15:14 +0900341/*
Paul Mundt0dae8952009-05-12 06:18:09 +0900342 * Find the correct struct clk for the device and connection ID.
343 * We do slightly fuzzy matching here:
344 * An entry with a NULL ID is assumed to be a wildcard.
345 * If an entry has a device ID, it must match
346 * If an entry has a connection ID, it must match
347 * Then we take the most specific entry - with the following
348 * order of precidence: dev+con > dev only > con only.
349 */
350static struct clk *clk_find(const char *dev_id, const char *con_id)
351{
352 struct clk_lookup *p;
353 struct clk *clk = NULL;
354 int match, best = 0;
355
356 list_for_each_entry(p, &clock_list, node) {
357 match = 0;
358 if (p->dev_id) {
359 if (!dev_id || strcmp(p->dev_id, dev_id))
360 continue;
361 match += 2;
362 }
363 if (p->con_id) {
364 if (!con_id || strcmp(p->con_id, con_id))
365 continue;
366 match += 1;
367 }
368 if (match == 0)
369 continue;
370
371 if (match > best) {
372 clk = p->clk;
373 best = match;
374 }
375 }
376 return clk;
377}
378
379struct clk *clk_get_sys(const char *dev_id, const char *con_id)
380{
381 struct clk *clk;
382
383 mutex_lock(&clock_list_sem);
384 clk = clk_find(dev_id, con_id);
385 mutex_unlock(&clock_list_sem);
386
387 return clk ? clk : ERR_PTR(-ENOENT);
388}
389EXPORT_SYMBOL_GPL(clk_get_sys);
390
391/*
Paul Mundt1d118562006-12-01 13:15:14 +0900392 * Returns a clock. Note that we first try to use device id on the bus
393 * and clock name. If this fails, we try to use clock name only.
394 */
395struct clk *clk_get(struct device *dev, const char *id)
Paul Mundt36ddf312006-01-16 22:14:17 -0800396{
Paul Mundt0dae8952009-05-12 06:18:09 +0900397 const char *dev_id = dev ? dev_name(dev) : NULL;
Paul Mundt36ddf312006-01-16 22:14:17 -0800398 struct clk *p, *clk = ERR_PTR(-ENOENT);
Paul Mundt1d118562006-12-01 13:15:14 +0900399 int idno;
400
Paul Mundt0dae8952009-05-12 06:18:09 +0900401 clk = clk_get_sys(dev_id, id);
402 if (clk)
403 return clk;
404
Paul Mundt1d118562006-12-01 13:15:14 +0900405 if (dev == NULL || dev->bus != &platform_bus_type)
406 idno = -1;
407 else
408 idno = to_platform_device(dev)->id;
Paul Mundt36ddf312006-01-16 22:14:17 -0800409
Paul Mundt237b98f2006-09-27 17:28:20 +0900410 mutex_lock(&clock_list_sem);
Paul Mundt36ddf312006-01-16 22:14:17 -0800411 list_for_each_entry(p, &clock_list, node) {
Paul Mundt1d118562006-12-01 13:15:14 +0900412 if (p->id == idno &&
413 strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
414 clk = p;
415 goto found;
416 }
417 }
418
419 list_for_each_entry(p, &clock_list, node) {
Paul Mundt36ddf312006-01-16 22:14:17 -0800420 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
421 clk = p;
422 break;
423 }
424 }
Paul Mundt1d118562006-12-01 13:15:14 +0900425
426found:
Paul Mundt237b98f2006-09-27 17:28:20 +0900427 mutex_unlock(&clock_list_sem);
Paul Mundt36ddf312006-01-16 22:14:17 -0800428
429 return clk;
430}
Paul Mundtdb62e5b2007-04-26 12:17:20 +0900431EXPORT_SYMBOL_GPL(clk_get);
Paul Mundt36ddf312006-01-16 22:14:17 -0800432
433void clk_put(struct clk *clk)
434{
435 if (clk && !IS_ERR(clk))
436 module_put(clk->owner);
437}
Paul Mundtdb62e5b2007-04-26 12:17:20 +0900438EXPORT_SYMBOL_GPL(clk_put);
Paul Mundt36ddf312006-01-16 22:14:17 -0800439
440void __init __attribute__ ((weak))
441arch_init_clk_ops(struct clk_ops **ops, int type)
442{
443}
444
Paul Mundtfa439722008-09-04 18:53:58 +0900445int __init __attribute__ ((weak))
dmitry pervushindfbbbe92007-05-15 08:42:22 +0900446arch_clk_init(void)
447{
Paul Mundtfa439722008-09-04 18:53:58 +0900448 return 0;
dmitry pervushindfbbbe92007-05-15 08:42:22 +0900449}
450
Paul Mundtdb62e5b2007-04-26 12:17:20 +0900451static int show_clocks(char *buf, char **start, off_t off,
452 int len, int *eof, void *data)
453{
454 struct clk *clk;
455 char *p = buf;
456
457 list_for_each_entry_reverse(clk, &clock_list, node) {
458 unsigned long rate = clk_get_rate(clk);
459
Magnus Damm152fe362008-07-17 19:05:54 +0900460 p += sprintf(p, "%-12s\t: %ld.%02ldMHz\t%s\n", clk->name,
461 rate / 1000000, (rate % 1000000) / 10000,
Paul Mundt4ff29ff2009-05-12 05:14:53 +0900462 (clk->usecount > 0) ? "enabled" : "disabled");
Paul Mundtdb62e5b2007-04-26 12:17:20 +0900463 }
464
465 return p - buf;
466}
467
Francesco VIRLINZI4a550262009-03-11 07:42:05 +0000468#ifdef CONFIG_PM
469static int clks_sysdev_suspend(struct sys_device *dev, pm_message_t state)
470{
471 static pm_message_t prev_state;
472 struct clk *clkp;
473
474 switch (state.event) {
475 case PM_EVENT_ON:
476 /* Resumeing from hibernation */
Paul Mundtb68d8202009-05-12 03:45:08 +0900477 if (prev_state.event != PM_EVENT_FREEZE)
478 break;
Francesco VIRLINZI50cca712009-03-13 08:08:01 +0000479
Paul Mundtb68d8202009-05-12 03:45:08 +0900480 list_for_each_entry(clkp, &clock_list, node) {
481 if (likely(clkp->ops)) {
482 unsigned long rate = clkp->rate;
483
484 if (likely(clkp->ops->set_parent))
485 clkp->ops->set_parent(clkp,
486 clkp->parent);
487 if (likely(clkp->ops->set_rate))
488 clkp->ops->set_rate(clkp,
489 rate, NO_CHANGE);
490 else if (likely(clkp->ops->recalc))
491 clkp->rate = clkp->ops->recalc(clkp);
492 }
Francesco VIRLINZI4a550262009-03-11 07:42:05 +0000493 }
494 break;
495 case PM_EVENT_FREEZE:
496 break;
497 case PM_EVENT_SUSPEND:
498 break;
499 }
500
501 prev_state = state;
502 return 0;
503}
504
505static int clks_sysdev_resume(struct sys_device *dev)
506{
507 return clks_sysdev_suspend(dev, PMSG_ON);
508}
509
510static struct sysdev_class clks_sysdev_class = {
511 .name = "clks",
512};
513
514static struct sysdev_driver clks_sysdev_driver = {
515 .suspend = clks_sysdev_suspend,
516 .resume = clks_sysdev_resume,
517};
518
519static struct sys_device clks_sysdev_dev = {
520 .cls = &clks_sysdev_class,
521};
522
523static int __init clk_sysdev_init(void)
524{
525 sysdev_class_register(&clks_sysdev_class);
526 sysdev_driver_register(&clks_sysdev_class, &clks_sysdev_driver);
527 sysdev_register(&clks_sysdev_dev);
528
529 return 0;
530}
531subsys_initcall(clk_sysdev_init);
532#endif
533
Paul Mundt36ddf312006-01-16 22:14:17 -0800534int __init clk_init(void)
535{
536 int i, ret = 0;
537
Paul Mundte4c2cfe2006-09-27 12:31:01 +0900538 BUG_ON(!master_clk.rate);
Paul Mundt36ddf312006-01-16 22:14:17 -0800539
540 for (i = 0; i < ARRAY_SIZE(onchip_clocks); i++) {
541 struct clk *clk = onchip_clocks[i];
542
543 arch_init_clk_ops(&clk->ops, i);
544 ret |= clk_register(clk);
Paul Mundt36ddf312006-01-16 22:14:17 -0800545 }
546
Paul Mundtfa439722008-09-04 18:53:58 +0900547 ret |= arch_clk_init();
dmitry pervushindfbbbe92007-05-15 08:42:22 +0900548
Paul Mundt36ddf312006-01-16 22:14:17 -0800549 /* Kick the child clocks.. */
Paul Mundtb1f6cfe2009-05-12 04:27:43 +0900550 recalculate_root_clocks();
Paul Mundt36ddf312006-01-16 22:14:17 -0800551
Paul Mundt4ff29ff2009-05-12 05:14:53 +0900552 /* Enable the necessary init clocks */
553 clk_enable_init_clocks();
554
Paul Mundt36ddf312006-01-16 22:14:17 -0800555 return ret;
556}
557
Paul Mundtdb62e5b2007-04-26 12:17:20 +0900558static int __init clk_proc_init(void)
Paul Mundt36ddf312006-01-16 22:14:17 -0800559{
Paul Mundtdb62e5b2007-04-26 12:17:20 +0900560 struct proc_dir_entry *p;
561 p = create_proc_read_entry("clocks", S_IRUSR, NULL,
562 show_clocks, NULL);
563 if (unlikely(!p))
564 return -EINVAL;
Paul Mundt36ddf312006-01-16 22:14:17 -0800565
566 return 0;
567}
Paul Mundtdb62e5b2007-04-26 12:17:20 +0900568subsys_initcall(clk_proc_init);