]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/clock34xx.c
Merge current mainline tree into linux-omap tree
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / clock34xx.c
1 /*
2  * OMAP3-specific clock framework functions
3  *
4  * Copyright (C) 2007-2008 Texas Instruments, Inc.
5  * Copyright (C) 2007-2008 Nokia Corporation
6  *
7  * Written by Paul Walmsley
8  * Testing and integration fixes by Jouni Högander
9  *
10  * Parts of this code are based on code written by
11  * Richard Woodruff, Tony Lindgren, Tuukka Tikkanen, Karthik Dasu
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License version 2 as
15  * published by the Free Software Foundation.
16  */
17 #undef DEBUG
18
19 #include <linux/module.h>
20 #include <linux/kernel.h>
21 #include <linux/device.h>
22 #include <linux/list.h>
23 #include <linux/errno.h>
24 #include <linux/delay.h>
25 #include <linux/clk.h>
26 #include <linux/io.h>
27 #include <linux/limits.h>
28
29 #include <mach/clock.h>
30 #include <mach/sram.h>
31 #include <asm/div64.h>
32 #include <asm/bitops.h>
33
34 #include <mach/sdrc.h>
35 #include "clock.h"
36 #include "clock34xx.h"
37 #include "prm.h"
38 #include "prm-regbits-34xx.h"
39 #include "cm.h"
40 #include "cm-regbits-34xx.h"
41
42 /* CM_AUTOIDLE_PLL*.AUTO_* bit values */
43 #define DPLL_AUTOIDLE_DISABLE                   0x0
44 #define DPLL_AUTOIDLE_LOW_POWER_STOP            0x1
45
46 #define MAX_DPLL_WAIT_TRIES             1000000
47
48 /**
49  * omap3_dpll_recalc - recalculate DPLL rate
50  * @clk: DPLL struct clk
51  *
52  * Recalculate and propagate the DPLL rate.
53  */
54 static void omap3_dpll_recalc(struct clk *clk)
55 {
56         clk->rate = omap2_get_dpll_rate(clk);
57
58         propagate_rate(clk);
59 }
60
61 /* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */
62 static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits)
63 {
64         const struct dpll_data *dd;
65         u32 v;
66
67         dd = clk->dpll_data;
68
69         v = __raw_readl(dd->control_reg);
70         v &= ~dd->enable_mask;
71         v |= clken_bits << __ffs(dd->enable_mask);
72         __raw_writel(v, dd->control_reg);
73 }
74
75 /* _omap3_wait_dpll_status: wait for a DPLL to enter a specific state */
76 static int _omap3_wait_dpll_status(struct clk *clk, u8 state)
77 {
78         const struct dpll_data *dd;
79         int i = 0;
80         int ret = -EINVAL;
81         u32 idlest_mask;
82
83         dd = clk->dpll_data;
84
85         state <<= dd->idlest_bit;
86         idlest_mask = 1 << dd->idlest_bit;
87
88         while (((__raw_readl(dd->idlest_reg) & idlest_mask) != state) &&
89                i < MAX_DPLL_WAIT_TRIES) {
90                 i++;
91                 udelay(1);
92         }
93
94         if (i == MAX_DPLL_WAIT_TRIES) {
95                 printk(KERN_ERR "clock: %s failed transition to '%s'\n",
96                        clk->name, (state) ? "locked" : "bypassed");
97         } else {
98                 pr_debug("clock: %s transition to '%s' in %d loops\n",
99                          clk->name, (state) ? "locked" : "bypassed", i);
100
101                 ret = 0;
102         }
103
104         return ret;
105 }
106
107 /* From 3430 TRM ES2 4.7.6.2 */
108 static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n)
109 {
110         unsigned long fint;
111         u16 f = 0;
112
113         fint = clk->parent->rate / (n + 1);
114
115         pr_debug("clock: fint is %lu\n", fint);
116
117         if (fint >= 750000 && fint <= 1000000)
118                 f = 0x3;
119         else if (fint > 1000000 && fint <= 1250000)
120                 f = 0x4;
121         else if (fint > 1250000 && fint <= 1500000)
122                 f = 0x5;
123         else if (fint > 1500000 && fint <= 1750000)
124                 f = 0x6;
125         else if (fint > 1750000 && fint <= 2100000)
126                 f = 0x7;
127         else if (fint > 7500000 && fint <= 10000000)
128                 f = 0xB;
129         else if (fint > 10000000 && fint <= 12500000)
130                 f = 0xC;
131         else if (fint > 12500000 && fint <= 15000000)
132                 f = 0xD;
133         else if (fint > 15000000 && fint <= 17500000)
134                 f = 0xE;
135         else if (fint > 17500000 && fint <= 21000000)
136                 f = 0xF;
137         else
138                 pr_debug("clock: unknown freqsel setting for %d\n", n);
139
140         return f;
141 }
142
143 /* Non-CORE DPLL (e.g., DPLLs that do not control SDRC) clock functions */
144
145 /*
146  * _omap3_noncore_dpll_lock - instruct a DPLL to lock and wait for readiness
147  * @clk: pointer to a DPLL struct clk
148  *
149  * Instructs a non-CORE DPLL to lock.  Waits for the DPLL to report
150  * readiness before returning.  Will save and restore the DPLL's
151  * autoidle state across the enable, per the CDP code.  If the DPLL
152  * locked successfully, return 0; if the DPLL did not lock in the time
153  * allotted, or DPLL3 was passed in, return -EINVAL.
154  */
155 static int _omap3_noncore_dpll_lock(struct clk *clk)
156 {
157         u8 ai;
158         int r;
159
160         if (clk == &dpll3_ck)
161                 return -EINVAL;
162
163         pr_debug("clock: locking DPLL %s\n", clk->name);
164
165         ai = omap3_dpll_autoidle_read(clk);
166
167         _omap3_dpll_write_clken(clk, DPLL_LOCKED);
168
169         if (ai) {
170                 /*
171                  * If no downstream clocks are enabled, CM_IDLEST bit
172                  * may never become active, so don't wait for DPLL to lock.
173                  */
174                 r = 0;
175                 omap3_dpll_allow_idle(clk);
176         } else {
177                 r = _omap3_wait_dpll_status(clk, 1);
178                 omap3_dpll_deny_idle(clk);
179         };
180
181         return r;
182 }
183
184 /*
185  * omap3_noncore_dpll_bypass - instruct a DPLL to bypass and wait for readiness
186  * @clk: pointer to a DPLL struct clk
187  *
188  * Instructs a non-CORE DPLL to enter low-power bypass mode.  In
189  * bypass mode, the DPLL's rate is set equal to its parent clock's
190  * rate.  Waits for the DPLL to report readiness before returning.
191  * Will save and restore the DPLL's autoidle state across the enable,
192  * per the CDP code.  If the DPLL entered bypass mode successfully,
193  * return 0; if the DPLL did not enter bypass in the time allotted, or
194  * DPLL3 was passed in, or the DPLL does not support low-power bypass,
195  * return -EINVAL.
196  */
197 static int _omap3_noncore_dpll_bypass(struct clk *clk)
198 {
199         int r;
200         u8 ai;
201
202         if (clk == &dpll3_ck)
203                 return -EINVAL;
204
205         if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_BYPASS)))
206                 return -EINVAL;
207
208         pr_debug("clock: configuring DPLL %s for low-power bypass\n",
209                  clk->name);
210
211         ai = omap3_dpll_autoidle_read(clk);
212
213         _omap3_dpll_write_clken(clk, DPLL_LOW_POWER_BYPASS);
214
215         r = _omap3_wait_dpll_status(clk, 0);
216
217         if (ai)
218                 omap3_dpll_allow_idle(clk);
219         else
220                 omap3_dpll_deny_idle(clk);
221
222         return r;
223 }
224
225 /*
226  * _omap3_noncore_dpll_stop - instruct a DPLL to stop
227  * @clk: pointer to a DPLL struct clk
228  *
229  * Instructs a non-CORE DPLL to enter low-power stop. Will save and
230  * restore the DPLL's autoidle state across the stop, per the CDP
231  * code.  If DPLL3 was passed in, or the DPLL does not support
232  * low-power stop, return -EINVAL; otherwise, return 0.
233  */
234 static int _omap3_noncore_dpll_stop(struct clk *clk)
235 {
236         u8 ai;
237
238         if (clk == &dpll3_ck)
239                 return -EINVAL;
240
241         if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP)))
242                 return -EINVAL;
243
244         pr_debug("clock: stopping DPLL %s\n", clk->name);
245
246         ai = omap3_dpll_autoidle_read(clk);
247
248         _omap3_dpll_write_clken(clk, DPLL_LOW_POWER_STOP);
249
250         if (ai)
251                 omap3_dpll_allow_idle(clk);
252         else
253                 omap3_dpll_deny_idle(clk);
254
255         return 0;
256 }
257
258 /**
259  * omap3_noncore_dpll_enable - instruct a DPLL to enter bypass or lock mode
260  * @clk: pointer to a DPLL struct clk
261  *
262  * Instructs a non-CORE DPLL to enable, e.g., to enter bypass or lock.
263  * The choice of modes depends on the DPLL's programmed rate: if it is
264  * the same as the DPLL's parent clock, it will enter bypass;
265  * otherwise, it will enter lock.  This code will wait for the DPLL to
266  * indicate readiness before returning, unless the DPLL takes too long
267  * to enter the target state.  Intended to be used as the struct clk's
268  * enable function.  If DPLL3 was passed in, or the DPLL does not
269  * support low-power stop, or if the DPLL took too long to enter
270  * bypass or lock, return -EINVAL; otherwise, return 0.
271  */
272 static int omap3_noncore_dpll_enable(struct clk *clk)
273 {
274         int r;
275
276         if (clk == &dpll3_ck)
277                 return -EINVAL;
278
279         if (clk->parent->rate == omap2_get_dpll_rate(clk))
280                 r = _omap3_noncore_dpll_bypass(clk);
281         else
282                 r = _omap3_noncore_dpll_lock(clk);
283
284         return r;
285 }
286
287 /**
288  * omap3_noncore_dpll_enable - instruct a DPLL to enter bypass or lock mode
289  * @clk: pointer to a DPLL struct clk
290  *
291  * Instructs a non-CORE DPLL to enable, e.g., to enter bypass or lock.
292  * The choice of modes depends on the DPLL's programmed rate: if it is
293  * the same as the DPLL's parent clock, it will enter bypass;
294  * otherwise, it will enter lock.  This code will wait for the DPLL to
295  * indicate readiness before returning, unless the DPLL takes too long
296  * to enter the target state.  Intended to be used as the struct clk's
297  * enable function.  If DPLL3 was passed in, or the DPLL does not
298  * support low-power stop, or if the DPLL took too long to enter
299  * bypass or lock, return -EINVAL; otherwise, return 0.
300  */
301 static void omap3_noncore_dpll_disable(struct clk *clk)
302 {
303         if (clk == &dpll3_ck)
304                 return;
305
306         _omap3_noncore_dpll_stop(clk);
307 }
308
309
310 /* Non-CORE DPLL rate set code */
311
312 /*
313  * omap3_noncore_dpll_program - set non-core DPLL M,N values directly
314  * @clk: struct clk * of DPLL to set
315  * @m: DPLL multiplier to set
316  * @n: DPLL divider to set
317  * @freqsel: FREQSEL value to set
318  *
319  * Program the DPLL with the supplied M, N values, and wait for the DPLL to
320  * lock..  Returns -EINVAL upon error, or 0 upon success.
321  */
322 static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel)
323 {
324         struct dpll_data *dd;
325         u32 v;
326
327         if (!clk)
328                 return -EINVAL;
329
330         dd = clk->dpll_data;
331         if (!dd)
332                 return -EINVAL;
333
334         /*
335          * According to the 12-5 CDP code from TI, "Limitation 2.5"
336          * on 3430ES1 prevents us from changing DPLL multipliers or dividers
337          * on DPLL4.
338          */
339         if (is_sil_rev_equal_to(OMAP3430_REV_ES1_0) &&
340             !strcmp("dpll4_ck", clk->name)) {
341                 printk(KERN_ERR "clock: DPLL4 cannot change rate due to "
342                        "silicon 'Limitation 2.5' on 3430ES1.\n");
343                 return -EINVAL;
344         }
345
346         /* 3430 ES2 TRM: 4.7.6.9 DPLL Programming Sequence */
347         _omap3_noncore_dpll_bypass(clk);
348
349         /* Set jitter correction */
350         v = __raw_readl(dd->control_reg);
351         v &= ~dd->freqsel_mask;
352         v |= freqsel << __ffs(dd->freqsel_mask);
353         __raw_writel(v, dd->control_reg);
354
355         /* Set DPLL multiplier, divider */
356         v = __raw_readl(dd->mult_div1_reg);
357         v &= ~(dd->mult_mask | dd->div1_mask);
358         v |= m << __ffs(dd->mult_mask);
359         v |= (n - 1) << __ffs(dd->div1_mask);
360         __raw_writel(v, dd->mult_div1_reg);
361
362         /* We let the clock framework set the other output dividers later */
363
364         /* REVISIT: Set ramp-up delay? */
365
366         _omap3_noncore_dpll_lock(clk);
367
368         return 0;
369 }
370
371 /**
372  * omap3_noncore_dpll_set_rate - set non-core DPLL rate
373  * @clk: struct clk * of DPLL to set
374  * @rate: rounded target rate
375  *
376  * Program the DPLL with the rounded target rate.  Returns -EINVAL upon
377  * error, or 0 upon success.
378  */
379 static int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate)
380 {
381         u16 freqsel;
382         struct dpll_data *dd;
383
384         if (!clk || !rate)
385                 return -EINVAL;
386
387         dd = clk->dpll_data;
388         if (!dd)
389                 return -EINVAL;
390
391         if (rate == omap2_get_dpll_rate(clk))
392                 return 0;
393
394         if (dd->last_rounded_rate != rate)
395                 omap2_dpll_round_rate(clk, rate);
396
397         if (dd->last_rounded_rate == 0)
398                 return -EINVAL;
399
400         freqsel = _omap3_dpll_compute_freqsel(clk, dd->last_rounded_n);
401         if (!freqsel)
402                 WARN_ON(1);
403
404         omap3_noncore_dpll_program(clk, dd->last_rounded_m, dd->last_rounded_n,
405                                    freqsel);
406
407         omap3_dpll_recalc(clk);
408
409         return 0;
410 }
411
412
413 /*
414  * CORE DPLL (DPLL3) rate programming functions
415  *
416  * These call into SRAM code to do the actual CM writes, since the SDRAM
417  * is clocked from DPLL3.
418  */
419
420 /**
421  * omap3_core_dpll_m2_set_rate - set CORE DPLL M2 divider
422  * @clk: struct clk * of DPLL to set
423  * @rate: rounded target rate
424  *
425  * Program the DPLL M2 divider with the rounded target rate.  Returns
426  * -EINVAL upon error, or 0 upon success.
427  */
428 static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
429 {
430         u32 new_div = 0;
431         unsigned long validrate, sdrcrate;
432         struct omap_sdrc_params *sp;
433
434         if (!clk || !rate)
435                 return -EINVAL;
436
437         if (clk != &dpll3_m2_ck)
438                 return -EINVAL;
439
440         if (rate == clk->rate)
441                 return 0;
442
443         validrate = omap2_clksel_round_rate_div(clk, rate, &new_div);
444         if (validrate != rate)
445                 return -EINVAL;
446
447         sdrcrate = sdrc_ick.rate;
448         if (rate > clk->rate)
449                 sdrcrate <<= ((rate / clk->rate) - 1);
450         else
451                 sdrcrate >>= ((clk->rate / rate) - 1);
452
453         sp = omap2_sdrc_get_params(sdrcrate);
454         if (!sp)
455                 return -EINVAL;
456
457         pr_info("clock: changing CORE DPLL rate from %lu to %lu\n", clk->rate,
458                 validrate);
459         pr_info("clock: SDRC timing params used: %08x %08x %08x\n",
460                 sp->rfr_ctrl, sp->actim_ctrla, sp->actim_ctrlb);
461
462         /* REVISIT: SRAM code doesn't support other M2 divisors yet */
463         WARN_ON(new_div != 1 && new_div != 2);
464
465         /* REVISIT: Add SDRC_MR changing to this code also */
466         local_irq_disable();
467         omap3_configure_core_dpll(sp->rfr_ctrl, sp->actim_ctrla,
468                                   sp->actim_ctrlb, new_div);
469         local_irq_enable();
470
471         omap2_clksel_recalc(clk);
472
473         return 0;
474 }
475
476
477 /* DPLL autoidle read/set code */
478
479
480 /**
481  * omap3_dpll_autoidle_read - read a DPLL's autoidle bits
482  * @clk: struct clk * of the DPLL to read
483  *
484  * Return the DPLL's autoidle bits, shifted down to bit 0.  Returns
485  * -EINVAL if passed a null pointer or if the struct clk does not
486  * appear to refer to a DPLL.
487  */
488 static u32 omap3_dpll_autoidle_read(struct clk *clk)
489 {
490         const struct dpll_data *dd;
491         u32 v;
492
493         if (!clk || !clk->dpll_data)
494                 return -EINVAL;
495
496         dd = clk->dpll_data;
497
498         v = __raw_readl(dd->autoidle_reg);
499         v &= dd->autoidle_mask;
500         v >>= __ffs(dd->autoidle_mask);
501
502         return v;
503 }
504
505 /**
506  * omap3_dpll_allow_idle - enable DPLL autoidle bits
507  * @clk: struct clk * of the DPLL to operate on
508  *
509  * Enable DPLL automatic idle control.  This automatic idle mode
510  * switching takes effect only when the DPLL is locked, at least on
511  * OMAP3430.  The DPLL will enter low-power stop when its downstream
512  * clocks are gated.  No return value.
513  */
514 static void omap3_dpll_allow_idle(struct clk *clk)
515 {
516         const struct dpll_data *dd;
517         u32 v;
518
519         if (!clk || !clk->dpll_data)
520                 return;
521
522         dd = clk->dpll_data;
523
524         /*
525          * REVISIT: CORE DPLL can optionally enter low-power bypass
526          * by writing 0x5 instead of 0x1.  Add some mechanism to
527          * optionally enter this mode.
528          */
529         v = __raw_readl(dd->autoidle_reg);
530         v &= ~dd->autoidle_mask;
531         v |= DPLL_AUTOIDLE_LOW_POWER_STOP << __ffs(dd->autoidle_mask);
532         __raw_writel(v, dd->autoidle_reg);
533 }
534
535 /**
536  * omap3_dpll_deny_idle - prevent DPLL from automatically idling
537  * @clk: struct clk * of the DPLL to operate on
538  *
539  * Disable DPLL automatic idle control.  No return value.
540  */
541 static void omap3_dpll_deny_idle(struct clk *clk)
542 {
543         const struct dpll_data *dd;
544         u32 v;
545
546         if (!clk || !clk->dpll_data)
547                 return;
548
549         dd = clk->dpll_data;
550
551         v = __raw_readl(dd->autoidle_reg);
552         v &= ~dd->autoidle_mask;
553         v |= DPLL_AUTOIDLE_DISABLE << __ffs(dd->autoidle_mask);
554         __raw_writel(v, dd->autoidle_reg);
555 }
556
557 /* Clock control for DPLL outputs */
558
559 /**
560  * omap3_clkoutx2_recalc - recalculate DPLL X2 output virtual clock rate
561  * @clk: DPLL output struct clk
562  *
563  * Using parent clock DPLL data, look up DPLL state.  If locked, set our
564  * rate to the dpll_clk * 2; otherwise, just use dpll_clk.
565  */
566 static void omap3_clkoutx2_recalc(struct clk *clk)
567 {
568         const struct dpll_data *dd;
569         u32 v;
570         struct clk *pclk;
571
572         /* Walk up the parents of clk, looking for a DPLL */
573         pclk = clk->parent;
574         while (pclk && !pclk->dpll_data)
575                 pclk = pclk->parent;
576
577         /* clk does not have a DPLL as a parent? */
578         WARN_ON(!pclk);
579
580         dd = pclk->dpll_data;
581
582         WARN_ON(!dd->control_reg || !dd->enable_mask);
583
584         v = __raw_readl(dd->control_reg) & dd->enable_mask;
585         v >>= __ffs(dd->enable_mask);
586         if (v != DPLL_LOCKED)
587                 clk->rate = clk->parent->rate;
588         else
589                 clk->rate = clk->parent->rate * 2;
590
591         if (clk->flags & RATE_PROPAGATES)
592                 propagate_rate(clk);
593 }
594
595 /* Common clock code */
596
597 /*
598  * As it is structured now, this will prevent an OMAP2/3 multiboot
599  * kernel from compiling.  This will need further attention.
600  */
601 #if defined(CONFIG_ARCH_OMAP3)
602
603 static struct clk_functions omap2_clk_functions = {
604         .clk_enable             = omap2_clk_enable,
605         .clk_disable            = omap2_clk_disable,
606         .clk_round_rate         = omap2_clk_round_rate,
607         .clk_set_rate           = omap2_clk_set_rate,
608         .clk_set_parent         = omap2_clk_set_parent,
609         .clk_disable_unused     = omap2_clk_disable_unused,
610 };
611
612 /*
613  * Set clocks for bypass mode for reboot to work.
614  */
615 void omap2_clk_prepare_for_reboot(void)
616 {
617         /* REVISIT: Not ready for 343x */
618 #if 0
619         u32 rate;
620
621         if (vclk == NULL || sclk == NULL)
622                 return;
623
624         rate = clk_get_rate(sclk);
625         clk_set_rate(vclk, rate);
626 #endif
627 }
628
629 /* REVISIT: Move this init stuff out into clock.c */
630
631 /*
632  * Switch the MPU rate if specified on cmdline.
633  * We cannot do this early until cmdline is parsed.
634  */
635 static int __init omap2_clk_arch_init(void)
636 {
637         if (!mpurate)
638                 return -EINVAL;
639
640         /* REVISIT: not yet ready for 343x */
641 #if 0
642         if (omap2_select_table_rate(&virt_prcm_set, mpurate))
643                 printk(KERN_ERR "Could not find matching MPU rate\n");
644 #endif
645
646         recalculate_root_clocks();
647
648         printk(KERN_INFO "Switched to new clocking rate (Crystal/DPLL3/MPU): "
649                "%ld.%01ld/%ld/%ld MHz\n",
650                (osc_sys_ck.rate / 1000000), (osc_sys_ck.rate / 100000) % 10,
651                (core_ck.rate / 1000000), (dpll1_fck.rate / 1000000)) ;
652
653         return 0;
654 }
655 arch_initcall(omap2_clk_arch_init);
656
657 int __init omap2_clk_init(void)
658 {
659         /* struct prcm_config *prcm; */
660         struct clk **clkp;
661         /* u32 clkrate; */
662         u32 cpu_clkflg;
663
664         /* REVISIT: Ultimately this will be used for multiboot */
665 #if 0
666         if (cpu_is_omap242x()) {
667                 cpu_mask = RATE_IN_242X;
668                 cpu_clkflg = CLOCK_IN_OMAP242X;
669                 clkp = onchip_24xx_clks;
670         } else if (cpu_is_omap2430()) {
671                 cpu_mask = RATE_IN_243X;
672                 cpu_clkflg = CLOCK_IN_OMAP243X;
673                 clkp = onchip_24xx_clks;
674         }
675 #endif
676         if (cpu_is_omap34xx()) {
677                 cpu_mask = RATE_IN_343X;
678                 cpu_clkflg = CLOCK_IN_OMAP343X;
679                 clkp = onchip_34xx_clks;
680
681                 /*
682                  * Update this if there are further clock changes between ES2
683                  * and production parts
684                  */
685                 if (is_sil_rev_equal_to(OMAP3430_REV_ES1_0)) {
686                         /* No 3430ES1-only rates exist, so no RATE_IN_3430ES1 */
687                         cpu_clkflg |= CLOCK_IN_OMAP3430ES1;
688                 } else {
689                         cpu_mask |= RATE_IN_3430ES2;
690                         cpu_clkflg |= CLOCK_IN_OMAP3430ES2;
691                 }
692         }
693
694         clk_init(&omap2_clk_functions);
695
696         for (clkp = onchip_34xx_clks;
697              clkp < onchip_34xx_clks + ARRAY_SIZE(onchip_34xx_clks);
698              clkp++) {
699                 if ((*clkp)->flags & cpu_clkflg) {
700                         clk_register(*clkp);
701                         omap2_init_clk_clkdm(*clkp);
702                 }
703         }
704
705         /* REVISIT: Not yet ready for OMAP3 */
706 #if 0
707         /* Check the MPU rate set by bootloader */
708         clkrate = omap2_get_dpll_rate_24xx(&dpll_ck);
709         for (prcm = rate_table; prcm->mpu_speed; prcm++) {
710                 if (!(prcm->flags & cpu_mask))
711                         continue;
712                 if (prcm->xtal_speed != sys_ck.rate)
713                         continue;
714                 if (prcm->dpll_speed <= clkrate)
715                          break;
716         }
717         curr_prcm_set = prcm;
718 #endif
719
720         recalculate_root_clocks();
721
722         printk(KERN_INFO "Clocking rate (Crystal/DPLL/ARM core): "
723                "%ld.%01ld/%ld/%ld MHz\n",
724                (osc_sys_ck.rate / 1000000), (osc_sys_ck.rate / 100000) % 10,
725                (core_ck.rate / 1000000), (arm_fck.rate / 1000000));
726
727         /*
728          * Only enable those clocks we will need, let the drivers
729          * enable other clocks as necessary
730          */
731         clk_enable_init_clocks();
732
733         /* Avoid sleeping during omap2_clk_prepare_for_reboot() */
734         /* REVISIT: not yet ready for 343x */
735 #if 0
736         vclk = clk_get(NULL, "virt_prcm_set");
737         sclk = clk_get(NULL, "sys_ck");
738 #endif
739         return 0;
740 }
741
742 #endif