2 * linux/arch/arm/mach-omap1/clock_data.c
4 * Copyright (C) 2004 - 2005, 2009 Nokia corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
6 * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/kernel.h>
14 #include <linux/clk.h>
17 #include <asm/mach-types.h> /* for machine_is_* */
19 #include <plat/clock.h>
21 #include <plat/clkdev_omap.h>
22 #include <plat/usb.h> /* for OTG_BASE */
26 /*------------------------------------------------------------------------
28 *-------------------------------------------------------------------------*/
30 /* XXX is this necessary? */
31 static struct clk dummy_ck = {
37 static struct clk ck_ref = {
43 static struct clk ck_dpll1 = {
50 * FIXME: This clock seems to be necessary but no-one has asked for its
51 * activation. [ FIX: SoSSI, SSR ]
53 static struct arm_idlect1_clk ck_dpll1out = {
55 .name = "ck_dpll1out",
56 .ops = &clkops_generic,
58 .flags = CLOCK_IDLE_CONTROL | ENABLE_REG_32BIT |
60 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
61 .enable_bit = EN_CKOUT_ARM,
62 .recalc = &followparent_recalc,
67 static struct clk sossi_ck = {
69 .ops = &clkops_generic,
70 .parent = &ck_dpll1out.clk,
71 .flags = CLOCK_NO_IDLE_PARENT | ENABLE_REG_32BIT,
72 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_1),
74 .recalc = &omap1_sossi_recalc,
75 .set_rate = &omap1_set_sossi_rate,
78 static struct clk arm_ck = {
82 .rate_offset = CKCTL_ARMDIV_OFFSET,
83 .recalc = &omap1_ckctl_recalc,
84 .round_rate = omap1_clk_round_rate_ckctl_arm,
85 .set_rate = omap1_clk_set_rate_ckctl_arm,
88 static struct arm_idlect1_clk armper_ck = {
91 .ops = &clkops_generic,
93 .flags = CLOCK_IDLE_CONTROL,
94 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
95 .enable_bit = EN_PERCK,
96 .rate_offset = CKCTL_PERDIV_OFFSET,
97 .recalc = &omap1_ckctl_recalc,
98 .round_rate = omap1_clk_round_rate_ckctl_arm,
99 .set_rate = omap1_clk_set_rate_ckctl_arm,
105 * FIXME: This clock seems to be necessary but no-one has asked for its
106 * activation. [ GPIO code for 1510 ]
108 static struct clk arm_gpio_ck = {
109 .name = "arm_gpio_ck",
110 .ops = &clkops_generic,
112 .flags = ENABLE_ON_INIT,
113 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
114 .enable_bit = EN_GPIOCK,
115 .recalc = &followparent_recalc,
118 static struct arm_idlect1_clk armxor_ck = {
121 .ops = &clkops_generic,
123 .flags = CLOCK_IDLE_CONTROL,
124 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
125 .enable_bit = EN_XORPCK,
126 .recalc = &followparent_recalc,
131 static struct arm_idlect1_clk armtim_ck = {
134 .ops = &clkops_generic,
136 .flags = CLOCK_IDLE_CONTROL,
137 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
138 .enable_bit = EN_TIMCK,
139 .recalc = &followparent_recalc,
144 static struct arm_idlect1_clk armwdt_ck = {
147 .ops = &clkops_generic,
149 .flags = CLOCK_IDLE_CONTROL,
150 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
151 .enable_bit = EN_WDTCK,
153 .recalc = &omap_fixed_divisor_recalc,
158 static struct clk arminth_ck16xx = {
159 .name = "arminth_ck",
162 .recalc = &followparent_recalc,
163 /* Note: On 16xx the frequency can be divided by 2 by programming
164 * ARM_CKCTL:ARM_INTHCK_SEL(14) to 1
166 * 1510 version is in TC clocks.
170 static struct clk dsp_ck = {
172 .ops = &clkops_generic,
174 .enable_reg = OMAP1_IO_ADDRESS(ARM_CKCTL),
175 .enable_bit = EN_DSPCK,
176 .rate_offset = CKCTL_DSPDIV_OFFSET,
177 .recalc = &omap1_ckctl_recalc,
178 .round_rate = omap1_clk_round_rate_ckctl_arm,
179 .set_rate = omap1_clk_set_rate_ckctl_arm,
182 static struct clk dspmmu_ck = {
186 .rate_offset = CKCTL_DSPMMUDIV_OFFSET,
187 .recalc = &omap1_ckctl_recalc,
188 .round_rate = omap1_clk_round_rate_ckctl_arm,
189 .set_rate = omap1_clk_set_rate_ckctl_arm,
192 static struct clk dspper_ck = {
194 .ops = &clkops_dspck,
196 .enable_reg = DSP_IDLECT2,
197 .enable_bit = EN_PERCK,
198 .rate_offset = CKCTL_PERDIV_OFFSET,
199 .recalc = &omap1_ckctl_recalc_dsp_domain,
200 .round_rate = omap1_clk_round_rate_ckctl_arm,
201 .set_rate = &omap1_clk_set_rate_dsp_domain,
204 static struct clk dspxor_ck = {
206 .ops = &clkops_dspck,
208 .enable_reg = DSP_IDLECT2,
209 .enable_bit = EN_XORPCK,
210 .recalc = &followparent_recalc,
213 static struct clk dsptim_ck = {
215 .ops = &clkops_dspck,
217 .enable_reg = DSP_IDLECT2,
218 .enable_bit = EN_DSPTIMCK,
219 .recalc = &followparent_recalc,
222 /* Tie ARM_IDLECT1:IDLIF_ARM to this logical clock structure */
223 static struct arm_idlect1_clk tc_ck = {
228 .flags = CLOCK_IDLE_CONTROL,
229 .rate_offset = CKCTL_TCDIV_OFFSET,
230 .recalc = &omap1_ckctl_recalc,
231 .round_rate = omap1_clk_round_rate_ckctl_arm,
232 .set_rate = omap1_clk_set_rate_ckctl_arm,
237 static struct clk arminth_ck1510 = {
238 .name = "arminth_ck",
240 .parent = &tc_ck.clk,
241 .recalc = &followparent_recalc,
242 /* Note: On 1510 the frequency follows TC_CK
244 * 16xx version is in MPU clocks.
248 static struct clk tipb_ck = {
249 /* No-idle controlled by "tc_ck" */
252 .parent = &tc_ck.clk,
253 .recalc = &followparent_recalc,
256 static struct clk l3_ocpi_ck = {
257 /* No-idle controlled by "tc_ck" */
258 .name = "l3_ocpi_ck",
259 .ops = &clkops_generic,
260 .parent = &tc_ck.clk,
261 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3),
262 .enable_bit = EN_OCPI_CK,
263 .recalc = &followparent_recalc,
266 static struct clk tc1_ck = {
268 .ops = &clkops_generic,
269 .parent = &tc_ck.clk,
270 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3),
271 .enable_bit = EN_TC1_CK,
272 .recalc = &followparent_recalc,
276 * FIXME: This clock seems to be necessary but no-one has asked for its
277 * activation. [ pm.c (SRAM), CCP, Camera ]
279 static struct clk tc2_ck = {
281 .ops = &clkops_generic,
282 .parent = &tc_ck.clk,
283 .flags = ENABLE_ON_INIT,
284 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3),
285 .enable_bit = EN_TC2_CK,
286 .recalc = &followparent_recalc,
289 static struct clk dma_ck = {
290 /* No-idle controlled by "tc_ck" */
293 .parent = &tc_ck.clk,
294 .recalc = &followparent_recalc,
297 static struct clk dma_lcdfree_ck = {
298 .name = "dma_lcdfree_ck",
300 .parent = &tc_ck.clk,
301 .recalc = &followparent_recalc,
304 static struct arm_idlect1_clk api_ck = {
307 .ops = &clkops_generic,
308 .parent = &tc_ck.clk,
309 .flags = CLOCK_IDLE_CONTROL,
310 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
311 .enable_bit = EN_APICK,
312 .recalc = &followparent_recalc,
317 static struct arm_idlect1_clk lb_ck = {
320 .ops = &clkops_generic,
321 .parent = &tc_ck.clk,
322 .flags = CLOCK_IDLE_CONTROL,
323 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
324 .enable_bit = EN_LBCK,
325 .recalc = &followparent_recalc,
330 static struct clk rhea1_ck = {
333 .parent = &tc_ck.clk,
334 .recalc = &followparent_recalc,
337 static struct clk rhea2_ck = {
340 .parent = &tc_ck.clk,
341 .recalc = &followparent_recalc,
344 static struct clk lcd_ck_16xx = {
346 .ops = &clkops_generic,
348 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
349 .enable_bit = EN_LCDCK,
350 .rate_offset = CKCTL_LCDDIV_OFFSET,
351 .recalc = &omap1_ckctl_recalc,
352 .round_rate = omap1_clk_round_rate_ckctl_arm,
353 .set_rate = omap1_clk_set_rate_ckctl_arm,
356 static struct arm_idlect1_clk lcd_ck_1510 = {
359 .ops = &clkops_generic,
361 .flags = CLOCK_IDLE_CONTROL,
362 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
363 .enable_bit = EN_LCDCK,
364 .rate_offset = CKCTL_LCDDIV_OFFSET,
365 .recalc = &omap1_ckctl_recalc,
366 .round_rate = omap1_clk_round_rate_ckctl_arm,
367 .set_rate = omap1_clk_set_rate_ckctl_arm,
372 static struct clk uart1_1510 = {
375 /* Direct from ULPD, no real parent */
376 .parent = &armper_ck.clk,
378 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
379 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
380 .enable_bit = 29, /* Chooses between 12MHz and 48MHz */
381 .set_rate = &omap1_set_uart_rate,
382 .recalc = &omap1_uart_recalc,
385 static struct uart_clk uart1_16xx = {
389 /* Direct from ULPD, no real parent */
390 .parent = &armper_ck.clk,
392 .flags = RATE_FIXED | ENABLE_REG_32BIT |
393 CLOCK_NO_IDLE_PARENT,
394 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
397 .sysc_addr = 0xfffb0054,
400 static struct clk uart2_ck = {
403 /* Direct from ULPD, no real parent */
404 .parent = &armper_ck.clk,
406 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
407 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
408 .enable_bit = 30, /* Chooses between 12MHz and 48MHz */
409 .set_rate = &omap1_set_uart_rate,
410 .recalc = &omap1_uart_recalc,
413 static struct clk uart3_1510 = {
416 /* Direct from ULPD, no real parent */
417 .parent = &armper_ck.clk,
419 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
420 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
421 .enable_bit = 31, /* Chooses between 12MHz and 48MHz */
422 .set_rate = &omap1_set_uart_rate,
423 .recalc = &omap1_uart_recalc,
426 static struct uart_clk uart3_16xx = {
430 /* Direct from ULPD, no real parent */
431 .parent = &armper_ck.clk,
433 .flags = RATE_FIXED | ENABLE_REG_32BIT |
434 CLOCK_NO_IDLE_PARENT,
435 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
438 .sysc_addr = 0xfffb9854,
441 static struct clk usb_clko = { /* 6 MHz output on W4_USB_CLKO */
443 .ops = &clkops_generic,
444 /* Direct from ULPD, no parent */
446 .flags = RATE_FIXED | ENABLE_REG_32BIT,
447 .enable_reg = OMAP1_IO_ADDRESS(ULPD_CLOCK_CTRL),
448 .enable_bit = USB_MCLK_EN_BIT,
451 static struct clk usb_hhc_ck1510 = {
452 .name = "usb_hhc_ck",
453 .ops = &clkops_generic,
454 /* Direct from ULPD, no parent */
455 .rate = 48000000, /* Actually 2 clocks, 12MHz and 48MHz */
456 .flags = RATE_FIXED | ENABLE_REG_32BIT,
457 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
458 .enable_bit = USB_HOST_HHC_UHOST_EN,
461 static struct clk usb_hhc_ck16xx = {
462 .name = "usb_hhc_ck",
463 .ops = &clkops_generic,
464 /* Direct from ULPD, no parent */
466 /* OTG_SYSCON_2.OTG_PADEN == 0 (not 1510-compatible) */
467 .flags = RATE_FIXED | ENABLE_REG_32BIT,
468 .enable_reg = OMAP1_IO_ADDRESS(OTG_BASE + 0x08), /* OTG_SYSCON_2 */
469 .enable_bit = 8 /* UHOST_EN */,
472 static struct clk usb_dc_ck = {
474 .ops = &clkops_generic,
475 /* Direct from ULPD, no parent */
478 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
482 static struct clk usb_dc_ck7xx = {
484 .ops = &clkops_generic,
485 /* Direct from ULPD, no parent */
488 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
492 static struct clk mclk_1510 = {
494 .ops = &clkops_generic,
495 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
498 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
502 static struct clk mclk_16xx = {
504 .ops = &clkops_generic,
505 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
506 .enable_reg = OMAP1_IO_ADDRESS(COM_CLK_DIV_CTRL_SEL),
507 .enable_bit = COM_ULPD_PLL_CLK_REQ,
508 .set_rate = &omap1_set_ext_clk_rate,
509 .round_rate = &omap1_round_ext_clk_rate,
510 .init = &omap1_init_ext_clk,
513 static struct clk bclk_1510 = {
515 .ops = &clkops_generic,
516 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
521 static struct clk bclk_16xx = {
523 .ops = &clkops_generic,
524 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
525 .enable_reg = OMAP1_IO_ADDRESS(SWD_CLK_DIV_CTRL_SEL),
526 .enable_bit = SWD_ULPD_PLL_CLK_REQ,
527 .set_rate = &omap1_set_ext_clk_rate,
528 .round_rate = &omap1_round_ext_clk_rate,
529 .init = &omap1_init_ext_clk,
532 static struct clk mmc1_ck = {
534 .ops = &clkops_generic,
535 /* Functional clock is direct from ULPD, interface clock is ARMPER */
536 .parent = &armper_ck.clk,
538 .flags = RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
539 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
543 static struct clk mmc2_ck = {
546 .ops = &clkops_generic,
547 /* Functional clock is direct from ULPD, interface clock is ARMPER */
548 .parent = &armper_ck.clk,
550 .flags = RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
551 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
555 static struct clk mmc3_ck = {
558 .ops = &clkops_generic,
559 /* Functional clock is direct from ULPD, interface clock is ARMPER */
560 .parent = &armper_ck.clk,
562 .flags = RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
563 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
567 static struct clk virtual_ck_mpu = {
570 .parent = &arm_ck, /* Is smarter alias for */
571 .recalc = &followparent_recalc,
572 .set_rate = &omap1_select_table_rate,
573 .round_rate = &omap1_round_to_table_rate,
576 /* virtual functional clock domain for I2C. Just for making sure that ARMXOR_CK
577 remains active during MPU idle whenever this is enabled */
578 static struct clk i2c_fck = {
582 .flags = CLOCK_NO_IDLE_PARENT,
583 .parent = &armxor_ck.clk,
584 .recalc = &followparent_recalc,
587 static struct clk i2c_ick = {
591 .flags = CLOCK_NO_IDLE_PARENT,
592 .parent = &armper_ck.clk,
593 .recalc = &followparent_recalc,
600 static struct omap_clk omap_clks[] = {
601 /* non-ULPD clocks */
602 CLK(NULL, "ck_ref", &ck_ref, CK_16XX | CK_1510 | CK_310 | CK_7XX),
603 CLK(NULL, "ck_dpll1", &ck_dpll1, CK_16XX | CK_1510 | CK_310 | CK_7XX),
605 CLK(NULL, "ck_dpll1out", &ck_dpll1out.clk, CK_16XX),
606 CLK(NULL, "ck_sossi", &sossi_ck, CK_16XX),
607 CLK(NULL, "arm_ck", &arm_ck, CK_16XX | CK_1510 | CK_310),
608 CLK(NULL, "armper_ck", &armper_ck.clk, CK_16XX | CK_1510 | CK_310),
609 CLK(NULL, "arm_gpio_ck", &arm_gpio_ck, CK_1510 | CK_310),
610 CLK(NULL, "armxor_ck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX),
611 CLK(NULL, "armtim_ck", &armtim_ck.clk, CK_16XX | CK_1510 | CK_310),
612 CLK("omap_wdt", "fck", &armwdt_ck.clk, CK_16XX | CK_1510 | CK_310),
613 CLK("omap_wdt", "ick", &armper_ck.clk, CK_16XX),
614 CLK("omap_wdt", "ick", &dummy_ck, CK_1510 | CK_310),
615 CLK(NULL, "arminth_ck", &arminth_ck1510, CK_1510 | CK_310),
616 CLK(NULL, "arminth_ck", &arminth_ck16xx, CK_16XX),
618 CLK(NULL, "dsp_ck", &dsp_ck, CK_16XX | CK_1510 | CK_310),
619 CLK(NULL, "dspmmu_ck", &dspmmu_ck, CK_16XX | CK_1510 | CK_310),
620 CLK(NULL, "dspper_ck", &dspper_ck, CK_16XX | CK_1510 | CK_310),
621 CLK(NULL, "dspxor_ck", &dspxor_ck, CK_16XX | CK_1510 | CK_310),
622 CLK(NULL, "dsptim_ck", &dsptim_ck, CK_16XX | CK_1510 | CK_310),
624 CLK(NULL, "tc_ck", &tc_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX),
625 CLK(NULL, "tipb_ck", &tipb_ck, CK_1510 | CK_310),
626 CLK(NULL, "l3_ocpi_ck", &l3_ocpi_ck, CK_16XX | CK_7XX),
627 CLK(NULL, "tc1_ck", &tc1_ck, CK_16XX),
628 CLK(NULL, "tc2_ck", &tc2_ck, CK_16XX),
629 CLK(NULL, "dma_ck", &dma_ck, CK_16XX | CK_1510 | CK_310),
630 CLK(NULL, "dma_lcdfree_ck", &dma_lcdfree_ck, CK_16XX),
631 CLK(NULL, "api_ck", &api_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX),
632 CLK(NULL, "lb_ck", &lb_ck.clk, CK_1510 | CK_310),
633 CLK(NULL, "rhea1_ck", &rhea1_ck, CK_16XX),
634 CLK(NULL, "rhea2_ck", &rhea2_ck, CK_16XX),
635 CLK(NULL, "lcd_ck", &lcd_ck_16xx, CK_16XX | CK_7XX),
636 CLK(NULL, "lcd_ck", &lcd_ck_1510.clk, CK_1510 | CK_310),
638 CLK(NULL, "uart1_ck", &uart1_1510, CK_1510 | CK_310),
639 CLK(NULL, "uart1_ck", &uart1_16xx.clk, CK_16XX),
640 CLK(NULL, "uart2_ck", &uart2_ck, CK_16XX | CK_1510 | CK_310),
641 CLK(NULL, "uart3_ck", &uart3_1510, CK_1510 | CK_310),
642 CLK(NULL, "uart3_ck", &uart3_16xx.clk, CK_16XX),
643 CLK(NULL, "usb_clko", &usb_clko, CK_16XX | CK_1510 | CK_310),
644 CLK(NULL, "usb_hhc_ck", &usb_hhc_ck1510, CK_1510 | CK_310),
645 CLK(NULL, "usb_hhc_ck", &usb_hhc_ck16xx, CK_16XX),
646 CLK(NULL, "usb_dc_ck", &usb_dc_ck, CK_16XX),
647 CLK(NULL, "usb_dc_ck", &usb_dc_ck7xx, CK_7XX),
648 CLK(NULL, "mclk", &mclk_1510, CK_1510 | CK_310),
649 CLK(NULL, "mclk", &mclk_16xx, CK_16XX),
650 CLK(NULL, "bclk", &bclk_1510, CK_1510 | CK_310),
651 CLK(NULL, "bclk", &bclk_16xx, CK_16XX),
652 CLK("mmci-omap.0", "fck", &mmc1_ck, CK_16XX | CK_1510 | CK_310),
653 CLK("mmci-omap.0", "fck", &mmc3_ck, CK_7XX),
654 CLK("mmci-omap.0", "ick", &armper_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX),
655 CLK("mmci-omap.1", "fck", &mmc2_ck, CK_16XX),
656 CLK("mmci-omap.1", "ick", &armper_ck.clk, CK_16XX),
658 CLK(NULL, "mpu", &virtual_ck_mpu, CK_16XX | CK_1510 | CK_310),
659 CLK("i2c_omap.1", "fck", &i2c_fck, CK_16XX | CK_1510 | CK_310 | CK_7XX),
660 CLK("i2c_omap.1", "ick", &i2c_ick, CK_16XX),
661 CLK("i2c_omap.1", "ick", &dummy_ck, CK_1510 | CK_310 | CK_7XX),
662 CLK("omap1_spi100k.1", "fck", &dummy_ck, CK_7XX),
663 CLK("omap1_spi100k.1", "ick", &dummy_ck, CK_7XX),
664 CLK("omap1_spi100k.2", "fck", &dummy_ck, CK_7XX),
665 CLK("omap1_spi100k.2", "ick", &dummy_ck, CK_7XX),
666 CLK("omap_uwire", "fck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310),
667 CLK("omap-mcbsp.1", "ick", &dspper_ck, CK_16XX),
668 CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_1510 | CK_310),
669 CLK("omap-mcbsp.2", "ick", &armper_ck.clk, CK_16XX),
670 CLK("omap-mcbsp.2", "ick", &dummy_ck, CK_1510 | CK_310),
671 CLK("omap-mcbsp.3", "ick", &dspper_ck, CK_16XX),
672 CLK("omap-mcbsp.3", "ick", &dummy_ck, CK_1510 | CK_310),
673 CLK("omap-mcbsp.1", "fck", &dspxor_ck, CK_16XX | CK_1510 | CK_310),
674 CLK("omap-mcbsp.2", "fck", &armper_ck.clk, CK_16XX | CK_1510 | CK_310),
675 CLK("omap-mcbsp.3", "fck", &dspxor_ck, CK_16XX | CK_1510 | CK_310),
682 static struct clk_functions omap1_clk_functions = {
683 .clk_enable = omap1_clk_enable,
684 .clk_disable = omap1_clk_disable,
685 .clk_round_rate = omap1_clk_round_rate,
686 .clk_set_rate = omap1_clk_set_rate,
687 .clk_disable_unused = omap1_clk_disable_unused,
690 int __init omap1_clk_init(void)
693 const struct omap_clock_config *info;
694 int crystal_type = 0; /* Default 12 MHz */
697 #ifdef CONFIG_DEBUG_LL
699 * Resets some clocks that may be left on from bootloader,
700 * but leaves serial clocks on.
702 omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
705 /* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */
706 reg = omap_readw(SOFT_REQ_REG) & (1 << 4);
707 omap_writew(reg, SOFT_REQ_REG);
708 if (!cpu_is_omap15xx())
709 omap_writew(0, SOFT_REQ_REG2);
711 clk_init(&omap1_clk_functions);
713 /* By default all idlect1 clocks are allowed to idle */
714 arm_idlect1_mask = ~0;
716 for (c = omap_clks; c < omap_clks + ARRAY_SIZE(omap_clks); c++)
717 clk_preinit(c->lk.clk);
720 if (cpu_is_omap16xx())
722 if (cpu_is_omap1510())
724 if (cpu_is_omap7xx())
726 if (cpu_is_omap310())
729 for (c = omap_clks; c < omap_clks + ARRAY_SIZE(omap_clks); c++)
730 if (c->cpu & cpu_mask) {
732 clk_register(c->lk.clk);
735 /* Pointers to these clocks are needed by code in clock.c */
736 api_ck_p = clk_get(NULL, "api_ck");
737 ck_dpll1_p = clk_get(NULL, "ck_dpll1");
738 ck_ref_p = clk_get(NULL, "ck_ref");
740 info = omap_get_config(OMAP_TAG_CLOCK, struct omap_clock_config);
742 if (!cpu_is_omap15xx())
743 crystal_type = info->system_clock_type;
746 #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
747 ck_ref.rate = 13000000;
748 #elif defined(CONFIG_ARCH_OMAP16XX)
749 if (crystal_type == 2)
750 ck_ref.rate = 19200000;
753 pr_info("Clocks: ARM_SYSST: 0x%04x DPLL_CTL: 0x%04x ARM_CKCTL: "
754 "0x%04x\n", omap_readw(ARM_SYSST), omap_readw(DPLL_CTL),
755 omap_readw(ARM_CKCTL));
757 /* We want to be in syncronous scalable mode */
758 omap_writew(0x1000, ARM_SYSST);
760 #ifdef CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER
761 /* Use values set by bootloader. Determine PLL rate and recalculate
762 * dependent clocks as if kernel had changed PLL or divisors.
765 unsigned pll_ctl_val = omap_readw(DPLL_CTL);
767 ck_dpll1.rate = ck_ref.rate; /* Base xtal rate */
768 if (pll_ctl_val & 0x10) {
769 /* PLL enabled, apply multiplier and divisor */
770 if (pll_ctl_val & 0xf80)
771 ck_dpll1.rate *= (pll_ctl_val & 0xf80) >> 7;
772 ck_dpll1.rate /= ((pll_ctl_val & 0x60) >> 5) + 1;
774 /* PLL disabled, apply bypass divisor */
775 switch (pll_ctl_val & 0xc) {
788 /* Find the highest supported frequency and enable it */
789 if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) {
790 printk(KERN_ERR "System frequencies not set. Check your config.\n");
791 /* Guess sane values (60MHz) */
792 omap_writew(0x2290, DPLL_CTL);
793 omap_writew(cpu_is_omap7xx() ? 0x3005 : 0x1005, ARM_CKCTL);
794 ck_dpll1.rate = 60000000;
797 propagate_rate(&ck_dpll1);
798 /* Cache rates for clocks connected to ck_ref (not dpll1) */
799 propagate_rate(&ck_ref);
800 printk(KERN_INFO "Clocking rate (xtal/DPLL1/MPU): "
801 "%ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n",
802 ck_ref.rate / 1000000, (ck_ref.rate / 100000) % 10,
803 ck_dpll1.rate / 1000000, (ck_dpll1.rate / 100000) % 10,
804 arm_ck.rate / 1000000, (arm_ck.rate / 100000) % 10);
806 #if defined(CONFIG_MACH_OMAP_PERSEUS2) || defined(CONFIG_MACH_OMAP_FSAMPLE)
807 /* Select slicer output as OMAP input clock */
808 omap_writew(omap_readw(OMAP7XX_PCC_UPLD_CTRL) & ~0x1, OMAP7XX_PCC_UPLD_CTRL);
811 /* Amstrad Delta wants BCLK high when inactive */
812 if (machine_is_ams_delta())
813 omap_writel(omap_readl(ULPD_CLOCK_CTRL) |
814 (1 << SDW_MCLK_INV_BIT),
817 /* Turn off DSP and ARM_TIMXO. Make sure ARM_INTHCK is not divided */
818 /* (on 730, bit 13 must not be cleared) */
819 if (cpu_is_omap7xx())
820 omap_writew(omap_readw(ARM_CKCTL) & 0x2fff, ARM_CKCTL);
822 omap_writew(omap_readw(ARM_CKCTL) & 0x0fff, ARM_CKCTL);
824 /* Put DSP/MPUI into reset until needed */
825 omap_writew(0, ARM_RSTCT1);
826 omap_writew(1, ARM_RSTCT2);
827 omap_writew(0x400, ARM_IDLECT1);
830 * According to OMAP5910 Erratum SYS_DMA_1, bit DMACK_REQ (bit 8)
831 * of the ARM_IDLECT2 register must be set to zero. The power-on
832 * default value of this bit is one.
834 omap_writew(0x0000, ARM_IDLECT2); /* Turn LCD clock off also */
837 * Only enable those clocks we will need, let the drivers
838 * enable other clocks as necessary
840 clk_enable(&armper_ck.clk);
841 clk_enable(&armxor_ck.clk);
842 clk_enable(&armtim_ck.clk); /* This should be done by timer code */
844 if (cpu_is_omap15xx())
845 clk_enable(&arm_gpio_ck);