1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/arch/arm/mach-omap1/clock_data.c
5 * Copyright (C) 2004 - 2005, 2009-2010 Nokia Corporation
6 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
7 * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
10 * - Clocks that are only available on some chips should be marked with the
11 * chips that they are present on.
14 #include <linux/kernel.h>
16 #include <linux/clk.h>
17 #include <linux/cpufreq.h>
18 #include <linux/delay.h>
20 #include <asm/mach-types.h> /* for machine_is_* */
24 #include <mach/hardware.h>
25 #include <mach/usb.h> /* for OTG_BASE */
31 /* Some ARM_IDLECT1 bit shifts - used in struct arm_idlect1_clk */
32 #define IDL_CLKOUT_ARM_SHIFT 12
33 #define IDLTIM_ARM_SHIFT 9
34 #define IDLAPI_ARM_SHIFT 8
35 #define IDLIF_ARM_SHIFT 6
36 #define IDLLB_ARM_SHIFT 4 /* undocumented? */
37 #define OMAP1510_IDLLCD_ARM_SHIFT 3 /* undocumented? */
38 #define IDLPER_ARM_SHIFT 2
39 #define IDLXORP_ARM_SHIFT 1
40 #define IDLWDT_ARM_SHIFT 0
42 /* Some MOD_CONF_CTRL_0 bit shifts - used in struct clk.enable_bit */
43 #define CONF_MOD_UART3_CLK_MODE_R 31
44 #define CONF_MOD_UART2_CLK_MODE_R 30
45 #define CONF_MOD_UART1_CLK_MODE_R 29
46 #define CONF_MOD_MMC_SD_CLK_REQ_R 23
47 #define CONF_MOD_MCBSP3_AUXON 20
49 /* Some MOD_CONF_CTRL_1 bit shifts - used in struct clk.enable_bit */
50 #define CONF_MOD_SOSSI_CLK_EN_R 16
52 /* Some OTG_SYSCON_2-specific bit fields */
53 #define OTG_SYSCON_2_UHOST_EN_SHIFT 8
55 /* Some SOFT_REQ_REG bit fields - used in struct clk.enable_bit */
56 #define SOFT_MMC2_DPLL_REQ_SHIFT 13
57 #define SOFT_MMC_DPLL_REQ_SHIFT 12
58 #define SOFT_UART3_DPLL_REQ_SHIFT 11
59 #define SOFT_UART2_DPLL_REQ_SHIFT 10
60 #define SOFT_UART1_DPLL_REQ_SHIFT 9
61 #define SOFT_USB_OTG_DPLL_REQ_SHIFT 8
62 #define SOFT_CAM_DPLL_REQ_SHIFT 7
63 #define SOFT_COM_MCKO_REQ_SHIFT 6
64 #define SOFT_PERIPH_REQ_SHIFT 5 /* sys_ck gate for UART2 ? */
65 #define USB_REQ_EN_SHIFT 4
66 #define SOFT_USB_REQ_SHIFT 3 /* sys_ck gate for USB host? */
67 #define SOFT_SDW_REQ_SHIFT 2 /* sys_ck gate for Bluetooth? */
68 #define SOFT_COM_REQ_SHIFT 1 /* sys_ck gate for com proc? */
69 #define SOFT_DPLL_REQ_SHIFT 0
75 static struct clk ck_ref
= {
81 static struct clk ck_dpll1
= {
88 * FIXME: This clock seems to be necessary but no-one has asked for its
89 * activation. [ FIX: SoSSI, SSR ]
91 static struct arm_idlect1_clk ck_dpll1out
= {
93 .name
= "ck_dpll1out",
94 .ops
= &clkops_generic
,
96 .flags
= CLOCK_IDLE_CONTROL
| ENABLE_REG_32BIT
|
98 .enable_reg
= OMAP1_IO_ADDRESS(ARM_IDLECT2
),
99 .enable_bit
= EN_CKOUT_ARM
,
100 .recalc
= &followparent_recalc
,
102 .idlect_shift
= IDL_CLKOUT_ARM_SHIFT
,
105 static struct clk sossi_ck
= {
107 .ops
= &clkops_generic
,
108 .parent
= &ck_dpll1out
.clk
,
109 .flags
= CLOCK_NO_IDLE_PARENT
| ENABLE_REG_32BIT
,
110 .enable_reg
= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_1
),
111 .enable_bit
= CONF_MOD_SOSSI_CLK_EN_R
,
112 .recalc
= &omap1_sossi_recalc
,
113 .set_rate
= &omap1_set_sossi_rate
,
116 static struct clk arm_ck
= {
120 .rate_offset
= CKCTL_ARMDIV_OFFSET
,
121 .recalc
= &omap1_ckctl_recalc
,
122 .round_rate
= omap1_clk_round_rate_ckctl_arm
,
123 .set_rate
= omap1_clk_set_rate_ckctl_arm
,
126 static struct arm_idlect1_clk armper_ck
= {
129 .ops
= &clkops_generic
,
131 .flags
= CLOCK_IDLE_CONTROL
,
132 .enable_reg
= OMAP1_IO_ADDRESS(ARM_IDLECT2
),
133 .enable_bit
= EN_PERCK
,
134 .rate_offset
= CKCTL_PERDIV_OFFSET
,
135 .recalc
= &omap1_ckctl_recalc
,
136 .round_rate
= omap1_clk_round_rate_ckctl_arm
,
137 .set_rate
= omap1_clk_set_rate_ckctl_arm
,
139 .idlect_shift
= IDLPER_ARM_SHIFT
,
143 * FIXME: This clock seems to be necessary but no-one has asked for its
144 * activation. [ GPIO code for 1510 ]
146 static struct clk arm_gpio_ck
= {
148 .ops
= &clkops_generic
,
150 .flags
= ENABLE_ON_INIT
,
151 .enable_reg
= OMAP1_IO_ADDRESS(ARM_IDLECT2
),
152 .enable_bit
= EN_GPIOCK
,
153 .recalc
= &followparent_recalc
,
156 static struct arm_idlect1_clk armxor_ck
= {
159 .ops
= &clkops_generic
,
161 .flags
= CLOCK_IDLE_CONTROL
,
162 .enable_reg
= OMAP1_IO_ADDRESS(ARM_IDLECT2
),
163 .enable_bit
= EN_XORPCK
,
164 .recalc
= &followparent_recalc
,
166 .idlect_shift
= IDLXORP_ARM_SHIFT
,
169 static struct arm_idlect1_clk armtim_ck
= {
172 .ops
= &clkops_generic
,
174 .flags
= CLOCK_IDLE_CONTROL
,
175 .enable_reg
= OMAP1_IO_ADDRESS(ARM_IDLECT2
),
176 .enable_bit
= EN_TIMCK
,
177 .recalc
= &followparent_recalc
,
179 .idlect_shift
= IDLTIM_ARM_SHIFT
,
182 static struct arm_idlect1_clk armwdt_ck
= {
185 .ops
= &clkops_generic
,
187 .flags
= CLOCK_IDLE_CONTROL
,
188 .enable_reg
= OMAP1_IO_ADDRESS(ARM_IDLECT2
),
189 .enable_bit
= EN_WDTCK
,
191 .recalc
= &omap_fixed_divisor_recalc
,
193 .idlect_shift
= IDLWDT_ARM_SHIFT
,
196 static struct clk arminth_ck16xx
= {
197 .name
= "arminth_ck",
200 .recalc
= &followparent_recalc
,
201 /* Note: On 16xx the frequency can be divided by 2 by programming
202 * ARM_CKCTL:ARM_INTHCK_SEL(14) to 1
204 * 1510 version is in TC clocks.
208 static struct clk dsp_ck
= {
210 .ops
= &clkops_generic
,
212 .enable_reg
= OMAP1_IO_ADDRESS(ARM_CKCTL
),
213 .enable_bit
= EN_DSPCK
,
214 .rate_offset
= CKCTL_DSPDIV_OFFSET
,
215 .recalc
= &omap1_ckctl_recalc
,
216 .round_rate
= omap1_clk_round_rate_ckctl_arm
,
217 .set_rate
= omap1_clk_set_rate_ckctl_arm
,
220 static struct clk dspmmu_ck
= {
224 .rate_offset
= CKCTL_DSPMMUDIV_OFFSET
,
225 .recalc
= &omap1_ckctl_recalc
,
226 .round_rate
= omap1_clk_round_rate_ckctl_arm
,
227 .set_rate
= omap1_clk_set_rate_ckctl_arm
,
230 static struct clk dspper_ck
= {
232 .ops
= &clkops_dspck
,
234 .enable_reg
= DSP_IDLECT2
,
235 .enable_bit
= EN_PERCK
,
236 .rate_offset
= CKCTL_PERDIV_OFFSET
,
237 .recalc
= &omap1_ckctl_recalc_dsp_domain
,
238 .round_rate
= omap1_clk_round_rate_ckctl_arm
,
239 .set_rate
= &omap1_clk_set_rate_dsp_domain
,
242 static struct clk dspxor_ck
= {
244 .ops
= &clkops_dspck
,
246 .enable_reg
= DSP_IDLECT2
,
247 .enable_bit
= EN_XORPCK
,
248 .recalc
= &followparent_recalc
,
251 static struct clk dsptim_ck
= {
253 .ops
= &clkops_dspck
,
255 .enable_reg
= DSP_IDLECT2
,
256 .enable_bit
= EN_DSPTIMCK
,
257 .recalc
= &followparent_recalc
,
260 static struct arm_idlect1_clk tc_ck
= {
265 .flags
= CLOCK_IDLE_CONTROL
,
266 .rate_offset
= CKCTL_TCDIV_OFFSET
,
267 .recalc
= &omap1_ckctl_recalc
,
268 .round_rate
= omap1_clk_round_rate_ckctl_arm
,
269 .set_rate
= omap1_clk_set_rate_ckctl_arm
,
271 .idlect_shift
= IDLIF_ARM_SHIFT
,
274 static struct clk arminth_ck1510
= {
275 .name
= "arminth_ck",
277 .parent
= &tc_ck
.clk
,
278 .recalc
= &followparent_recalc
,
279 /* Note: On 1510 the frequency follows TC_CK
281 * 16xx version is in MPU clocks.
285 static struct clk tipb_ck
= {
286 /* No-idle controlled by "tc_ck" */
289 .parent
= &tc_ck
.clk
,
290 .recalc
= &followparent_recalc
,
293 static struct clk l3_ocpi_ck
= {
294 /* No-idle controlled by "tc_ck" */
295 .name
= "l3_ocpi_ck",
296 .ops
= &clkops_generic
,
297 .parent
= &tc_ck
.clk
,
298 .enable_reg
= OMAP1_IO_ADDRESS(ARM_IDLECT3
),
299 .enable_bit
= EN_OCPI_CK
,
300 .recalc
= &followparent_recalc
,
303 static struct clk tc1_ck
= {
305 .ops
= &clkops_generic
,
306 .parent
= &tc_ck
.clk
,
307 .enable_reg
= OMAP1_IO_ADDRESS(ARM_IDLECT3
),
308 .enable_bit
= EN_TC1_CK
,
309 .recalc
= &followparent_recalc
,
313 * FIXME: This clock seems to be necessary but no-one has asked for its
314 * activation. [ pm.c (SRAM), CCP, Camera ]
316 static struct clk tc2_ck
= {
318 .ops
= &clkops_generic
,
319 .parent
= &tc_ck
.clk
,
320 .flags
= ENABLE_ON_INIT
,
321 .enable_reg
= OMAP1_IO_ADDRESS(ARM_IDLECT3
),
322 .enable_bit
= EN_TC2_CK
,
323 .recalc
= &followparent_recalc
,
326 static struct clk dma_ck
= {
327 /* No-idle controlled by "tc_ck" */
330 .parent
= &tc_ck
.clk
,
331 .recalc
= &followparent_recalc
,
334 static struct clk dma_lcdfree_ck
= {
335 .name
= "dma_lcdfree_ck",
337 .parent
= &tc_ck
.clk
,
338 .recalc
= &followparent_recalc
,
341 static struct arm_idlect1_clk api_ck
= {
344 .ops
= &clkops_generic
,
345 .parent
= &tc_ck
.clk
,
346 .flags
= CLOCK_IDLE_CONTROL
,
347 .enable_reg
= OMAP1_IO_ADDRESS(ARM_IDLECT2
),
348 .enable_bit
= EN_APICK
,
349 .recalc
= &followparent_recalc
,
351 .idlect_shift
= IDLAPI_ARM_SHIFT
,
354 static struct arm_idlect1_clk lb_ck
= {
357 .ops
= &clkops_generic
,
358 .parent
= &tc_ck
.clk
,
359 .flags
= CLOCK_IDLE_CONTROL
,
360 .enable_reg
= OMAP1_IO_ADDRESS(ARM_IDLECT2
),
361 .enable_bit
= EN_LBCK
,
362 .recalc
= &followparent_recalc
,
364 .idlect_shift
= IDLLB_ARM_SHIFT
,
367 static struct clk rhea1_ck
= {
370 .parent
= &tc_ck
.clk
,
371 .recalc
= &followparent_recalc
,
374 static struct clk rhea2_ck
= {
377 .parent
= &tc_ck
.clk
,
378 .recalc
= &followparent_recalc
,
381 static struct clk lcd_ck_16xx
= {
383 .ops
= &clkops_generic
,
385 .enable_reg
= OMAP1_IO_ADDRESS(ARM_IDLECT2
),
386 .enable_bit
= EN_LCDCK
,
387 .rate_offset
= CKCTL_LCDDIV_OFFSET
,
388 .recalc
= &omap1_ckctl_recalc
,
389 .round_rate
= omap1_clk_round_rate_ckctl_arm
,
390 .set_rate
= omap1_clk_set_rate_ckctl_arm
,
393 static struct arm_idlect1_clk lcd_ck_1510
= {
396 .ops
= &clkops_generic
,
398 .flags
= CLOCK_IDLE_CONTROL
,
399 .enable_reg
= OMAP1_IO_ADDRESS(ARM_IDLECT2
),
400 .enable_bit
= EN_LCDCK
,
401 .rate_offset
= CKCTL_LCDDIV_OFFSET
,
402 .recalc
= &omap1_ckctl_recalc
,
403 .round_rate
= omap1_clk_round_rate_ckctl_arm
,
404 .set_rate
= omap1_clk_set_rate_ckctl_arm
,
406 .idlect_shift
= OMAP1510_IDLLCD_ARM_SHIFT
,
410 * XXX The enable_bit here is misused - it simply switches between 12MHz
411 * and 48MHz. Reimplement with clksel.
413 * XXX does this need SYSC register handling?
415 static struct clk uart1_1510
= {
418 /* Direct from ULPD, no real parent */
419 .parent
= &armper_ck
.clk
,
421 .flags
= ENABLE_REG_32BIT
| CLOCK_NO_IDLE_PARENT
,
422 .enable_reg
= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0
),
423 .enable_bit
= CONF_MOD_UART1_CLK_MODE_R
,
424 .set_rate
= &omap1_set_uart_rate
,
425 .recalc
= &omap1_uart_recalc
,
429 * XXX The enable_bit here is misused - it simply switches between 12MHz
430 * and 48MHz. Reimplement with clksel.
432 * XXX SYSC register handling does not belong in the clock framework
434 static struct uart_clk uart1_16xx
= {
437 .ops
= &clkops_uart_16xx
,
438 /* Direct from ULPD, no real parent */
439 .parent
= &armper_ck
.clk
,
441 .flags
= ENABLE_REG_32BIT
| CLOCK_NO_IDLE_PARENT
,
442 .enable_reg
= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0
),
443 .enable_bit
= CONF_MOD_UART1_CLK_MODE_R
,
445 .sysc_addr
= 0xfffb0054,
449 * XXX The enable_bit here is misused - it simply switches between 12MHz
450 * and 48MHz. Reimplement with clksel.
452 * XXX does this need SYSC register handling?
454 static struct clk uart2_ck
= {
457 /* Direct from ULPD, no real parent */
458 .parent
= &armper_ck
.clk
,
460 .flags
= ENABLE_REG_32BIT
| CLOCK_NO_IDLE_PARENT
,
461 .enable_reg
= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0
),
462 .enable_bit
= CONF_MOD_UART2_CLK_MODE_R
,
463 .set_rate
= &omap1_set_uart_rate
,
464 .recalc
= &omap1_uart_recalc
,
468 * XXX The enable_bit here is misused - it simply switches between 12MHz
469 * and 48MHz. Reimplement with clksel.
471 * XXX does this need SYSC register handling?
473 static struct clk uart3_1510
= {
476 /* Direct from ULPD, no real parent */
477 .parent
= &armper_ck
.clk
,
479 .flags
= ENABLE_REG_32BIT
| CLOCK_NO_IDLE_PARENT
,
480 .enable_reg
= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0
),
481 .enable_bit
= CONF_MOD_UART3_CLK_MODE_R
,
482 .set_rate
= &omap1_set_uart_rate
,
483 .recalc
= &omap1_uart_recalc
,
487 * XXX The enable_bit here is misused - it simply switches between 12MHz
488 * and 48MHz. Reimplement with clksel.
490 * XXX SYSC register handling does not belong in the clock framework
492 static struct uart_clk uart3_16xx
= {
495 .ops
= &clkops_uart_16xx
,
496 /* Direct from ULPD, no real parent */
497 .parent
= &armper_ck
.clk
,
499 .flags
= ENABLE_REG_32BIT
| CLOCK_NO_IDLE_PARENT
,
500 .enable_reg
= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0
),
501 .enable_bit
= CONF_MOD_UART3_CLK_MODE_R
,
503 .sysc_addr
= 0xfffb9854,
506 static struct clk usb_clko
= { /* 6 MHz output on W4_USB_CLKO */
508 .ops
= &clkops_generic
,
509 /* Direct from ULPD, no parent */
511 .flags
= ENABLE_REG_32BIT
,
512 .enable_reg
= OMAP1_IO_ADDRESS(ULPD_CLOCK_CTRL
),
513 .enable_bit
= USB_MCLK_EN_BIT
,
516 static struct clk usb_hhc_ck1510
= {
517 .name
= "usb_hhc_ck",
518 .ops
= &clkops_generic
,
519 /* Direct from ULPD, no parent */
520 .rate
= 48000000, /* Actually 2 clocks, 12MHz and 48MHz */
521 .flags
= ENABLE_REG_32BIT
,
522 .enable_reg
= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0
),
523 .enable_bit
= USB_HOST_HHC_UHOST_EN
,
526 static struct clk usb_hhc_ck16xx
= {
527 .name
= "usb_hhc_ck",
528 .ops
= &clkops_generic
,
529 /* Direct from ULPD, no parent */
531 /* OTG_SYSCON_2.OTG_PADEN == 0 (not 1510-compatible) */
532 .flags
= ENABLE_REG_32BIT
,
533 .enable_reg
= OMAP1_IO_ADDRESS(OTG_BASE
+ 0x08), /* OTG_SYSCON_2 */
534 .enable_bit
= OTG_SYSCON_2_UHOST_EN_SHIFT
537 static struct clk usb_dc_ck
= {
539 .ops
= &clkops_generic
,
540 /* Direct from ULPD, no parent */
542 .enable_reg
= OMAP1_IO_ADDRESS(SOFT_REQ_REG
),
543 .enable_bit
= SOFT_USB_OTG_DPLL_REQ_SHIFT
,
546 static struct clk uart1_7xx
= {
548 .ops
= &clkops_generic
,
549 /* Direct from ULPD, no parent */
551 .enable_reg
= OMAP1_IO_ADDRESS(SOFT_REQ_REG
),
555 static struct clk uart2_7xx
= {
557 .ops
= &clkops_generic
,
558 /* Direct from ULPD, no parent */
560 .enable_reg
= OMAP1_IO_ADDRESS(SOFT_REQ_REG
),
564 static struct clk mclk_1510
= {
566 .ops
= &clkops_generic
,
567 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
569 .enable_reg
= OMAP1_IO_ADDRESS(SOFT_REQ_REG
),
570 .enable_bit
= SOFT_COM_MCKO_REQ_SHIFT
,
573 static struct clk mclk_16xx
= {
575 .ops
= &clkops_generic
,
576 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
577 .enable_reg
= OMAP1_IO_ADDRESS(COM_CLK_DIV_CTRL_SEL
),
578 .enable_bit
= COM_ULPD_PLL_CLK_REQ
,
579 .set_rate
= &omap1_set_ext_clk_rate
,
580 .round_rate
= &omap1_round_ext_clk_rate
,
581 .init
= &omap1_init_ext_clk
,
584 static struct clk bclk_1510
= {
586 .ops
= &clkops_generic
,
587 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
591 static struct clk bclk_16xx
= {
593 .ops
= &clkops_generic
,
594 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
595 .enable_reg
= OMAP1_IO_ADDRESS(SWD_CLK_DIV_CTRL_SEL
),
596 .enable_bit
= SWD_ULPD_PLL_CLK_REQ
,
597 .set_rate
= &omap1_set_ext_clk_rate
,
598 .round_rate
= &omap1_round_ext_clk_rate
,
599 .init
= &omap1_init_ext_clk
,
602 static struct clk mmc1_ck
= {
604 .ops
= &clkops_generic
,
605 /* Functional clock is direct from ULPD, interface clock is ARMPER */
606 .parent
= &armper_ck
.clk
,
608 .flags
= ENABLE_REG_32BIT
| CLOCK_NO_IDLE_PARENT
,
609 .enable_reg
= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0
),
610 .enable_bit
= CONF_MOD_MMC_SD_CLK_REQ_R
,
614 * XXX MOD_CONF_CTRL_0 bit 20 is defined in the 1510 TRM as
615 * CONF_MOD_MCBSP3_AUXON ??
617 static struct clk mmc2_ck
= {
619 .ops
= &clkops_generic
,
620 /* Functional clock is direct from ULPD, interface clock is ARMPER */
621 .parent
= &armper_ck
.clk
,
623 .flags
= ENABLE_REG_32BIT
| CLOCK_NO_IDLE_PARENT
,
624 .enable_reg
= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0
),
628 static struct clk mmc3_ck
= {
630 .ops
= &clkops_generic
,
631 /* Functional clock is direct from ULPD, interface clock is ARMPER */
632 .parent
= &armper_ck
.clk
,
634 .flags
= ENABLE_REG_32BIT
| CLOCK_NO_IDLE_PARENT
,
635 .enable_reg
= OMAP1_IO_ADDRESS(SOFT_REQ_REG
),
636 .enable_bit
= SOFT_MMC_DPLL_REQ_SHIFT
,
639 static struct clk virtual_ck_mpu
= {
642 .parent
= &arm_ck
, /* Is smarter alias for */
643 .recalc
= &followparent_recalc
,
644 .set_rate
= &omap1_select_table_rate
,
645 .round_rate
= &omap1_round_to_table_rate
,
648 /* virtual functional clock domain for I2C. Just for making sure that ARMXOR_CK
649 remains active during MPU idle whenever this is enabled */
650 static struct clk i2c_fck
= {
653 .flags
= CLOCK_NO_IDLE_PARENT
,
654 .parent
= &armxor_ck
.clk
,
655 .recalc
= &followparent_recalc
,
658 static struct clk i2c_ick
= {
661 .flags
= CLOCK_NO_IDLE_PARENT
,
662 .parent
= &armper_ck
.clk
,
663 .recalc
= &followparent_recalc
,
670 static struct omap_clk omap_clks
[] = {
671 /* non-ULPD clocks */
672 CLK(NULL
, "ck_ref", &ck_ref
, CK_16XX
| CK_1510
| CK_310
| CK_7XX
),
673 CLK(NULL
, "ck_dpll1", &ck_dpll1
, CK_16XX
| CK_1510
| CK_310
| CK_7XX
),
675 CLK(NULL
, "ck_dpll1out", &ck_dpll1out
.clk
, CK_16XX
),
676 CLK(NULL
, "ck_sossi", &sossi_ck
, CK_16XX
),
677 CLK(NULL
, "arm_ck", &arm_ck
, CK_16XX
| CK_1510
| CK_310
),
678 CLK(NULL
, "armper_ck", &armper_ck
.clk
, CK_16XX
| CK_1510
| CK_310
),
679 CLK("omap_gpio.0", "ick", &arm_gpio_ck
, CK_1510
| CK_310
),
680 CLK(NULL
, "armxor_ck", &armxor_ck
.clk
, CK_16XX
| CK_1510
| CK_310
| CK_7XX
),
681 CLK(NULL
, "armtim_ck", &armtim_ck
.clk
, CK_16XX
| CK_1510
| CK_310
),
682 CLK("omap_wdt", "fck", &armwdt_ck
.clk
, CK_16XX
| CK_1510
| CK_310
),
683 CLK("omap_wdt", "ick", &armper_ck
.clk
, CK_16XX
),
684 CLK("omap_wdt", "ick", &dummy_ck
, CK_1510
| CK_310
),
685 CLK(NULL
, "arminth_ck", &arminth_ck1510
, CK_1510
| CK_310
),
686 CLK(NULL
, "arminth_ck", &arminth_ck16xx
, CK_16XX
),
688 CLK(NULL
, "dsp_ck", &dsp_ck
, CK_16XX
| CK_1510
| CK_310
),
689 CLK(NULL
, "dspmmu_ck", &dspmmu_ck
, CK_16XX
| CK_1510
| CK_310
),
690 CLK(NULL
, "dspper_ck", &dspper_ck
, CK_16XX
| CK_1510
| CK_310
),
691 CLK(NULL
, "dspxor_ck", &dspxor_ck
, CK_16XX
| CK_1510
| CK_310
),
692 CLK(NULL
, "dsptim_ck", &dsptim_ck
, CK_16XX
| CK_1510
| CK_310
),
694 CLK(NULL
, "tc_ck", &tc_ck
.clk
, CK_16XX
| CK_1510
| CK_310
| CK_7XX
),
695 CLK(NULL
, "tipb_ck", &tipb_ck
, CK_1510
| CK_310
),
696 CLK(NULL
, "l3_ocpi_ck", &l3_ocpi_ck
, CK_16XX
| CK_7XX
),
697 CLK(NULL
, "tc1_ck", &tc1_ck
, CK_16XX
),
698 CLK(NULL
, "tc2_ck", &tc2_ck
, CK_16XX
),
699 CLK(NULL
, "dma_ck", &dma_ck
, CK_16XX
| CK_1510
| CK_310
),
700 CLK(NULL
, "dma_lcdfree_ck", &dma_lcdfree_ck
, CK_16XX
),
701 CLK(NULL
, "api_ck", &api_ck
.clk
, CK_16XX
| CK_1510
| CK_310
| CK_7XX
),
702 CLK(NULL
, "lb_ck", &lb_ck
.clk
, CK_1510
| CK_310
),
703 CLK(NULL
, "rhea1_ck", &rhea1_ck
, CK_16XX
),
704 CLK(NULL
, "rhea2_ck", &rhea2_ck
, CK_16XX
),
705 CLK(NULL
, "lcd_ck", &lcd_ck_16xx
, CK_16XX
| CK_7XX
),
706 CLK(NULL
, "lcd_ck", &lcd_ck_1510
.clk
, CK_1510
| CK_310
),
708 CLK(NULL
, "uart1_ck", &uart1_1510
, CK_1510
| CK_310
),
709 CLK(NULL
, "uart1_ck", &uart1_16xx
.clk
, CK_16XX
),
710 CLK(NULL
, "uart1_ck", &uart1_7xx
, CK_7XX
),
711 CLK(NULL
, "uart2_ck", &uart2_ck
, CK_16XX
| CK_1510
| CK_310
),
712 CLK(NULL
, "uart2_ck", &uart2_7xx
, CK_7XX
),
713 CLK(NULL
, "uart3_ck", &uart3_1510
, CK_1510
| CK_310
),
714 CLK(NULL
, "uart3_ck", &uart3_16xx
.clk
, CK_16XX
),
715 CLK(NULL
, "usb_clko", &usb_clko
, CK_16XX
| CK_1510
| CK_310
),
716 CLK(NULL
, "usb_hhc_ck", &usb_hhc_ck1510
, CK_1510
| CK_310
),
717 CLK(NULL
, "usb_hhc_ck", &usb_hhc_ck16xx
, CK_16XX
),
718 CLK(NULL
, "usb_dc_ck", &usb_dc_ck
, CK_16XX
| CK_7XX
),
719 CLK(NULL
, "mclk", &mclk_1510
, CK_1510
| CK_310
),
720 CLK(NULL
, "mclk", &mclk_16xx
, CK_16XX
),
721 CLK(NULL
, "bclk", &bclk_1510
, CK_1510
| CK_310
),
722 CLK(NULL
, "bclk", &bclk_16xx
, CK_16XX
),
723 CLK("mmci-omap.0", "fck", &mmc1_ck
, CK_16XX
| CK_1510
| CK_310
),
724 CLK("mmci-omap.0", "fck", &mmc3_ck
, CK_7XX
),
725 CLK("mmci-omap.0", "ick", &armper_ck
.clk
, CK_16XX
| CK_1510
| CK_310
| CK_7XX
),
726 CLK("mmci-omap.1", "fck", &mmc2_ck
, CK_16XX
),
727 CLK("mmci-omap.1", "ick", &armper_ck
.clk
, CK_16XX
),
729 CLK(NULL
, "mpu", &virtual_ck_mpu
, CK_16XX
| CK_1510
| CK_310
),
730 CLK("omap_i2c.1", "fck", &i2c_fck
, CK_16XX
| CK_1510
| CK_310
| CK_7XX
),
731 CLK("omap_i2c.1", "ick", &i2c_ick
, CK_16XX
),
732 CLK("omap_i2c.1", "ick", &dummy_ck
, CK_1510
| CK_310
| CK_7XX
),
733 CLK("omap1_spi100k.1", "fck", &dummy_ck
, CK_7XX
),
734 CLK("omap1_spi100k.1", "ick", &dummy_ck
, CK_7XX
),
735 CLK("omap1_spi100k.2", "fck", &dummy_ck
, CK_7XX
),
736 CLK("omap1_spi100k.2", "ick", &dummy_ck
, CK_7XX
),
737 CLK("omap_uwire", "fck", &armxor_ck
.clk
, CK_16XX
| CK_1510
| CK_310
),
738 CLK("omap-mcbsp.1", "ick", &dspper_ck
, CK_16XX
),
739 CLK("omap-mcbsp.1", "ick", &dummy_ck
, CK_1510
| CK_310
),
740 CLK("omap-mcbsp.2", "ick", &armper_ck
.clk
, CK_16XX
),
741 CLK("omap-mcbsp.2", "ick", &dummy_ck
, CK_1510
| CK_310
),
742 CLK("omap-mcbsp.3", "ick", &dspper_ck
, CK_16XX
),
743 CLK("omap-mcbsp.3", "ick", &dummy_ck
, CK_1510
| CK_310
),
744 CLK("omap-mcbsp.1", "fck", &dspxor_ck
, CK_16XX
| CK_1510
| CK_310
),
745 CLK("omap-mcbsp.2", "fck", &armper_ck
.clk
, CK_16XX
| CK_1510
| CK_310
),
746 CLK("omap-mcbsp.3", "fck", &dspxor_ck
, CK_16XX
| CK_1510
| CK_310
),
753 static void __init
omap1_show_rates(void)
755 pr_notice("Clocking rate (xtal/DPLL1/MPU): %ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n",
756 ck_ref
.rate
/ 1000000, (ck_ref
.rate
/ 100000) % 10,
757 ck_dpll1
.rate
/ 1000000, (ck_dpll1
.rate
/ 100000) % 10,
758 arm_ck
.rate
/ 1000000, (arm_ck
.rate
/ 100000) % 10);
763 int __init
omap1_clk_init(void)
766 int crystal_type
= 0; /* Default 12 MHz */
769 #ifdef CONFIG_DEBUG_LL
771 * Resets some clocks that may be left on from bootloader,
772 * but leaves serial clocks on.
774 omap_writel(0x3 << 29, MOD_CONF_CTRL_0
);
777 /* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */
778 reg
= omap_readw(SOFT_REQ_REG
) & (1 << 4);
779 omap_writew(reg
, SOFT_REQ_REG
);
780 if (!cpu_is_omap15xx())
781 omap_writew(0, SOFT_REQ_REG2
);
783 /* By default all idlect1 clocks are allowed to idle */
784 arm_idlect1_mask
= ~0;
786 for (c
= omap_clks
; c
< omap_clks
+ ARRAY_SIZE(omap_clks
); c
++)
787 clk_preinit(c
->lk
.clk
);
790 if (cpu_is_omap1710())
792 if (cpu_is_omap16xx())
794 if (cpu_is_omap1510())
796 if (cpu_is_omap7xx())
798 if (cpu_is_omap310())
801 for (c
= omap_clks
; c
< omap_clks
+ ARRAY_SIZE(omap_clks
); c
++)
802 if (c
->cpu
& cpu_mask
) {
804 clk_register(c
->lk
.clk
);
807 /* Pointers to these clocks are needed by code in clock.c */
808 api_ck_p
= clk_get(NULL
, "api_ck");
809 ck_dpll1_p
= clk_get(NULL
, "ck_dpll1");
810 ck_ref_p
= clk_get(NULL
, "ck_ref");
812 if (cpu_is_omap7xx())
813 ck_ref
.rate
= 13000000;
814 if (cpu_is_omap16xx() && crystal_type
== 2)
815 ck_ref
.rate
= 19200000;
817 pr_info("Clocks: ARM_SYSST: 0x%04x DPLL_CTL: 0x%04x ARM_CKCTL: 0x%04x\n",
818 omap_readw(ARM_SYSST
), omap_readw(DPLL_CTL
),
819 omap_readw(ARM_CKCTL
));
821 /* We want to be in syncronous scalable mode */
822 omap_writew(0x1000, ARM_SYSST
);
826 * Initially use the values set by bootloader. Determine PLL rate and
827 * recalculate dependent clocks as if kernel had changed PLL or
828 * divisors. See also omap1_clk_late_init() that can reprogram dpll1
829 * after the SRAM is initialized.
832 unsigned pll_ctl_val
= omap_readw(DPLL_CTL
);
834 ck_dpll1
.rate
= ck_ref
.rate
; /* Base xtal rate */
835 if (pll_ctl_val
& 0x10) {
836 /* PLL enabled, apply multiplier and divisor */
837 if (pll_ctl_val
& 0xf80)
838 ck_dpll1
.rate
*= (pll_ctl_val
& 0xf80) >> 7;
839 ck_dpll1
.rate
/= ((pll_ctl_val
& 0x60) >> 5) + 1;
841 /* PLL disabled, apply bypass divisor */
842 switch (pll_ctl_val
& 0xc) {
854 propagate_rate(&ck_dpll1
);
855 /* Cache rates for clocks connected to ck_ref (not dpll1) */
856 propagate_rate(&ck_ref
);
858 if (machine_is_omap_perseus2() || machine_is_omap_fsample()) {
859 /* Select slicer output as OMAP input clock */
860 omap_writew(omap_readw(OMAP7XX_PCC_UPLD_CTRL
) & ~0x1,
861 OMAP7XX_PCC_UPLD_CTRL
);
864 /* Amstrad Delta wants BCLK high when inactive */
865 if (machine_is_ams_delta())
866 omap_writel(omap_readl(ULPD_CLOCK_CTRL
) |
867 (1 << SDW_MCLK_INV_BIT
),
870 /* Turn off DSP and ARM_TIMXO. Make sure ARM_INTHCK is not divided */
871 /* (on 730, bit 13 must not be cleared) */
872 if (cpu_is_omap7xx())
873 omap_writew(omap_readw(ARM_CKCTL
) & 0x2fff, ARM_CKCTL
);
875 omap_writew(omap_readw(ARM_CKCTL
) & 0x0fff, ARM_CKCTL
);
877 /* Put DSP/MPUI into reset until needed */
878 omap_writew(0, ARM_RSTCT1
);
879 omap_writew(1, ARM_RSTCT2
);
880 omap_writew(0x400, ARM_IDLECT1
);
883 * According to OMAP5910 Erratum SYS_DMA_1, bit DMACK_REQ (bit 8)
884 * of the ARM_IDLECT2 register must be set to zero. The power-on
885 * default value of this bit is one.
887 omap_writew(0x0000, ARM_IDLECT2
); /* Turn LCD clock off also */
890 * Only enable those clocks we will need, let the drivers
891 * enable other clocks as necessary
893 clk_enable(&armper_ck
.clk
);
894 clk_enable(&armxor_ck
.clk
);
895 clk_enable(&armtim_ck
.clk
); /* This should be done by timer code */
897 if (cpu_is_omap15xx())
898 clk_enable(&arm_gpio_ck
);
903 #define OMAP1_DPLL1_SANE_VALUE 60000000
905 void __init
omap1_clk_late_init(void)
907 unsigned long rate
= ck_dpll1
.rate
;
909 /* Find the highest supported frequency and enable it */
910 if (omap1_select_table_rate(&virtual_ck_mpu
, ~0)) {
911 pr_err("System frequencies not set, using default. Check your config.\n");
913 * Reprogramming the DPLL is tricky, it must be done from SRAM.
915 omap_sram_reprogram_clock(0x2290, 0x0005);
916 ck_dpll1
.rate
= OMAP1_DPLL1_SANE_VALUE
;
918 propagate_rate(&ck_dpll1
);
920 loops_per_jiffy
= cpufreq_scale(loops_per_jiffy
, rate
, ck_dpll1
.rate
);