xref: /linux/arch/arm/mach-omap1/clock_data.c (revision 52650505fbf3a6ab851c801f54e73e76c55ab8da)
1*52650505SPaul Walmsley /*
2*52650505SPaul Walmsley  *  linux/arch/arm/mach-omap1/clock_data.c
3*52650505SPaul Walmsley  *
4*52650505SPaul Walmsley  *  Copyright (C) 2004 - 2005, 2009 Nokia corporation
5*52650505SPaul Walmsley  *  Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
6*52650505SPaul Walmsley  *  Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
7*52650505SPaul Walmsley  *
8*52650505SPaul Walmsley  * This program is free software; you can redistribute it and/or modify
9*52650505SPaul Walmsley  * it under the terms of the GNU General Public License version 2 as
10*52650505SPaul Walmsley  * published by the Free Software Foundation.
11*52650505SPaul Walmsley  */
12*52650505SPaul Walmsley 
13*52650505SPaul Walmsley #include <linux/kernel.h>
14*52650505SPaul Walmsley #include <linux/clk.h>
15*52650505SPaul Walmsley #include <linux/io.h>
16*52650505SPaul Walmsley 
17*52650505SPaul Walmsley #include <asm/mach-types.h>  /* for machine_is_* */
18*52650505SPaul Walmsley 
19*52650505SPaul Walmsley #include <plat/clock.h>
20*52650505SPaul Walmsley #include <plat/cpu.h>
21*52650505SPaul Walmsley #include <plat/clkdev_omap.h>
22*52650505SPaul Walmsley #include <plat/usb.h>   /* for OTG_BASE */
23*52650505SPaul Walmsley 
24*52650505SPaul Walmsley #include "clock.h"
25*52650505SPaul Walmsley 
26*52650505SPaul Walmsley /*------------------------------------------------------------------------
27*52650505SPaul Walmsley  * Omap1 clocks
28*52650505SPaul Walmsley  *-------------------------------------------------------------------------*/
29*52650505SPaul Walmsley 
30*52650505SPaul Walmsley /* XXX is this necessary? */
31*52650505SPaul Walmsley static struct clk dummy_ck = {
32*52650505SPaul Walmsley 	.name	= "dummy",
33*52650505SPaul Walmsley 	.ops	= &clkops_dummy,
34*52650505SPaul Walmsley 	.flags	= RATE_FIXED,
35*52650505SPaul Walmsley };
36*52650505SPaul Walmsley 
37*52650505SPaul Walmsley static struct clk ck_ref = {
38*52650505SPaul Walmsley 	.name		= "ck_ref",
39*52650505SPaul Walmsley 	.ops		= &clkops_null,
40*52650505SPaul Walmsley 	.rate		= 12000000,
41*52650505SPaul Walmsley };
42*52650505SPaul Walmsley 
43*52650505SPaul Walmsley static struct clk ck_dpll1 = {
44*52650505SPaul Walmsley 	.name		= "ck_dpll1",
45*52650505SPaul Walmsley 	.ops		= &clkops_null,
46*52650505SPaul Walmsley 	.parent		= &ck_ref,
47*52650505SPaul Walmsley };
48*52650505SPaul Walmsley 
49*52650505SPaul Walmsley /*
50*52650505SPaul Walmsley  * FIXME: This clock seems to be necessary but no-one has asked for its
51*52650505SPaul Walmsley  * activation.  [ FIX: SoSSI, SSR ]
52*52650505SPaul Walmsley  */
53*52650505SPaul Walmsley static struct arm_idlect1_clk ck_dpll1out = {
54*52650505SPaul Walmsley 	.clk = {
55*52650505SPaul Walmsley 		.name		= "ck_dpll1out",
56*52650505SPaul Walmsley 		.ops		= &clkops_generic,
57*52650505SPaul Walmsley 		.parent		= &ck_dpll1,
58*52650505SPaul Walmsley 		.flags		= CLOCK_IDLE_CONTROL | ENABLE_REG_32BIT |
59*52650505SPaul Walmsley 				  ENABLE_ON_INIT,
60*52650505SPaul Walmsley 		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
61*52650505SPaul Walmsley 		.enable_bit	= EN_CKOUT_ARM,
62*52650505SPaul Walmsley 		.recalc		= &followparent_recalc,
63*52650505SPaul Walmsley 	},
64*52650505SPaul Walmsley 	.idlect_shift	= 12,
65*52650505SPaul Walmsley };
66*52650505SPaul Walmsley 
67*52650505SPaul Walmsley static struct clk sossi_ck = {
68*52650505SPaul Walmsley 	.name		= "ck_sossi",
69*52650505SPaul Walmsley 	.ops		= &clkops_generic,
70*52650505SPaul Walmsley 	.parent		= &ck_dpll1out.clk,
71*52650505SPaul Walmsley 	.flags		= CLOCK_NO_IDLE_PARENT | ENABLE_REG_32BIT,
72*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_1),
73*52650505SPaul Walmsley 	.enable_bit	= 16,
74*52650505SPaul Walmsley 	.recalc		= &omap1_sossi_recalc,
75*52650505SPaul Walmsley 	.set_rate	= &omap1_set_sossi_rate,
76*52650505SPaul Walmsley };
77*52650505SPaul Walmsley 
78*52650505SPaul Walmsley static struct clk arm_ck = {
79*52650505SPaul Walmsley 	.name		= "arm_ck",
80*52650505SPaul Walmsley 	.ops		= &clkops_null,
81*52650505SPaul Walmsley 	.parent		= &ck_dpll1,
82*52650505SPaul Walmsley 	.rate_offset	= CKCTL_ARMDIV_OFFSET,
83*52650505SPaul Walmsley 	.recalc		= &omap1_ckctl_recalc,
84*52650505SPaul Walmsley 	.round_rate	= omap1_clk_round_rate_ckctl_arm,
85*52650505SPaul Walmsley 	.set_rate	= omap1_clk_set_rate_ckctl_arm,
86*52650505SPaul Walmsley };
87*52650505SPaul Walmsley 
88*52650505SPaul Walmsley static struct arm_idlect1_clk armper_ck = {
89*52650505SPaul Walmsley 	.clk = {
90*52650505SPaul Walmsley 		.name		= "armper_ck",
91*52650505SPaul Walmsley 		.ops		= &clkops_generic,
92*52650505SPaul Walmsley 		.parent		= &ck_dpll1,
93*52650505SPaul Walmsley 		.flags		= CLOCK_IDLE_CONTROL,
94*52650505SPaul Walmsley 		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
95*52650505SPaul Walmsley 		.enable_bit	= EN_PERCK,
96*52650505SPaul Walmsley 		.rate_offset	= CKCTL_PERDIV_OFFSET,
97*52650505SPaul Walmsley 		.recalc		= &omap1_ckctl_recalc,
98*52650505SPaul Walmsley 		.round_rate	= omap1_clk_round_rate_ckctl_arm,
99*52650505SPaul Walmsley 		.set_rate	= omap1_clk_set_rate_ckctl_arm,
100*52650505SPaul Walmsley 	},
101*52650505SPaul Walmsley 	.idlect_shift	= 2,
102*52650505SPaul Walmsley };
103*52650505SPaul Walmsley 
104*52650505SPaul Walmsley /*
105*52650505SPaul Walmsley  * FIXME: This clock seems to be necessary but no-one has asked for its
106*52650505SPaul Walmsley  * activation.  [ GPIO code for 1510 ]
107*52650505SPaul Walmsley  */
108*52650505SPaul Walmsley static struct clk arm_gpio_ck = {
109*52650505SPaul Walmsley 	.name		= "arm_gpio_ck",
110*52650505SPaul Walmsley 	.ops		= &clkops_generic,
111*52650505SPaul Walmsley 	.parent		= &ck_dpll1,
112*52650505SPaul Walmsley 	.flags		= ENABLE_ON_INIT,
113*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
114*52650505SPaul Walmsley 	.enable_bit	= EN_GPIOCK,
115*52650505SPaul Walmsley 	.recalc		= &followparent_recalc,
116*52650505SPaul Walmsley };
117*52650505SPaul Walmsley 
118*52650505SPaul Walmsley static struct arm_idlect1_clk armxor_ck = {
119*52650505SPaul Walmsley 	.clk = {
120*52650505SPaul Walmsley 		.name		= "armxor_ck",
121*52650505SPaul Walmsley 		.ops		= &clkops_generic,
122*52650505SPaul Walmsley 		.parent		= &ck_ref,
123*52650505SPaul Walmsley 		.flags		= CLOCK_IDLE_CONTROL,
124*52650505SPaul Walmsley 		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
125*52650505SPaul Walmsley 		.enable_bit	= EN_XORPCK,
126*52650505SPaul Walmsley 		.recalc		= &followparent_recalc,
127*52650505SPaul Walmsley 	},
128*52650505SPaul Walmsley 	.idlect_shift	= 1,
129*52650505SPaul Walmsley };
130*52650505SPaul Walmsley 
131*52650505SPaul Walmsley static struct arm_idlect1_clk armtim_ck = {
132*52650505SPaul Walmsley 	.clk = {
133*52650505SPaul Walmsley 		.name		= "armtim_ck",
134*52650505SPaul Walmsley 		.ops		= &clkops_generic,
135*52650505SPaul Walmsley 		.parent		= &ck_ref,
136*52650505SPaul Walmsley 		.flags		= CLOCK_IDLE_CONTROL,
137*52650505SPaul Walmsley 		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
138*52650505SPaul Walmsley 		.enable_bit	= EN_TIMCK,
139*52650505SPaul Walmsley 		.recalc		= &followparent_recalc,
140*52650505SPaul Walmsley 	},
141*52650505SPaul Walmsley 	.idlect_shift	= 9,
142*52650505SPaul Walmsley };
143*52650505SPaul Walmsley 
144*52650505SPaul Walmsley static struct arm_idlect1_clk armwdt_ck = {
145*52650505SPaul Walmsley 	.clk = {
146*52650505SPaul Walmsley 		.name		= "armwdt_ck",
147*52650505SPaul Walmsley 		.ops		= &clkops_generic,
148*52650505SPaul Walmsley 		.parent		= &ck_ref,
149*52650505SPaul Walmsley 		.flags		= CLOCK_IDLE_CONTROL,
150*52650505SPaul Walmsley 		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
151*52650505SPaul Walmsley 		.enable_bit	= EN_WDTCK,
152*52650505SPaul Walmsley 		.recalc		= &omap1_watchdog_recalc,
153*52650505SPaul Walmsley 	},
154*52650505SPaul Walmsley 	.idlect_shift	= 0,
155*52650505SPaul Walmsley };
156*52650505SPaul Walmsley 
157*52650505SPaul Walmsley static struct clk arminth_ck16xx = {
158*52650505SPaul Walmsley 	.name		= "arminth_ck",
159*52650505SPaul Walmsley 	.ops		= &clkops_null,
160*52650505SPaul Walmsley 	.parent		= &arm_ck,
161*52650505SPaul Walmsley 	.recalc		= &followparent_recalc,
162*52650505SPaul Walmsley 	/* Note: On 16xx the frequency can be divided by 2 by programming
163*52650505SPaul Walmsley 	 * ARM_CKCTL:ARM_INTHCK_SEL(14) to 1
164*52650505SPaul Walmsley 	 *
165*52650505SPaul Walmsley 	 * 1510 version is in TC clocks.
166*52650505SPaul Walmsley 	 */
167*52650505SPaul Walmsley };
168*52650505SPaul Walmsley 
169*52650505SPaul Walmsley static struct clk dsp_ck = {
170*52650505SPaul Walmsley 	.name		= "dsp_ck",
171*52650505SPaul Walmsley 	.ops		= &clkops_generic,
172*52650505SPaul Walmsley 	.parent		= &ck_dpll1,
173*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(ARM_CKCTL),
174*52650505SPaul Walmsley 	.enable_bit	= EN_DSPCK,
175*52650505SPaul Walmsley 	.rate_offset	= CKCTL_DSPDIV_OFFSET,
176*52650505SPaul Walmsley 	.recalc		= &omap1_ckctl_recalc,
177*52650505SPaul Walmsley 	.round_rate	= omap1_clk_round_rate_ckctl_arm,
178*52650505SPaul Walmsley 	.set_rate	= omap1_clk_set_rate_ckctl_arm,
179*52650505SPaul Walmsley };
180*52650505SPaul Walmsley 
181*52650505SPaul Walmsley static struct clk dspmmu_ck = {
182*52650505SPaul Walmsley 	.name		= "dspmmu_ck",
183*52650505SPaul Walmsley 	.ops		= &clkops_null,
184*52650505SPaul Walmsley 	.parent		= &ck_dpll1,
185*52650505SPaul Walmsley 	.rate_offset	= CKCTL_DSPMMUDIV_OFFSET,
186*52650505SPaul Walmsley 	.recalc		= &omap1_ckctl_recalc,
187*52650505SPaul Walmsley 	.round_rate	= omap1_clk_round_rate_ckctl_arm,
188*52650505SPaul Walmsley 	.set_rate	= omap1_clk_set_rate_ckctl_arm,
189*52650505SPaul Walmsley };
190*52650505SPaul Walmsley 
191*52650505SPaul Walmsley static struct clk dspper_ck = {
192*52650505SPaul Walmsley 	.name		= "dspper_ck",
193*52650505SPaul Walmsley 	.ops		= &clkops_dspck,
194*52650505SPaul Walmsley 	.parent		= &ck_dpll1,
195*52650505SPaul Walmsley 	.enable_reg	= DSP_IDLECT2,
196*52650505SPaul Walmsley 	.enable_bit	= EN_PERCK,
197*52650505SPaul Walmsley 	.rate_offset	= CKCTL_PERDIV_OFFSET,
198*52650505SPaul Walmsley 	.recalc		= &omap1_ckctl_recalc_dsp_domain,
199*52650505SPaul Walmsley 	.round_rate	= omap1_clk_round_rate_ckctl_arm,
200*52650505SPaul Walmsley 	.set_rate	= &omap1_clk_set_rate_dsp_domain,
201*52650505SPaul Walmsley };
202*52650505SPaul Walmsley 
203*52650505SPaul Walmsley static struct clk dspxor_ck = {
204*52650505SPaul Walmsley 	.name		= "dspxor_ck",
205*52650505SPaul Walmsley 	.ops		= &clkops_dspck,
206*52650505SPaul Walmsley 	.parent		= &ck_ref,
207*52650505SPaul Walmsley 	.enable_reg	= DSP_IDLECT2,
208*52650505SPaul Walmsley 	.enable_bit	= EN_XORPCK,
209*52650505SPaul Walmsley 	.recalc		= &followparent_recalc,
210*52650505SPaul Walmsley };
211*52650505SPaul Walmsley 
212*52650505SPaul Walmsley static struct clk dsptim_ck = {
213*52650505SPaul Walmsley 	.name		= "dsptim_ck",
214*52650505SPaul Walmsley 	.ops		= &clkops_dspck,
215*52650505SPaul Walmsley 	.parent		= &ck_ref,
216*52650505SPaul Walmsley 	.enable_reg	= DSP_IDLECT2,
217*52650505SPaul Walmsley 	.enable_bit	= EN_DSPTIMCK,
218*52650505SPaul Walmsley 	.recalc		= &followparent_recalc,
219*52650505SPaul Walmsley };
220*52650505SPaul Walmsley 
221*52650505SPaul Walmsley /* Tie ARM_IDLECT1:IDLIF_ARM to this logical clock structure */
222*52650505SPaul Walmsley static struct arm_idlect1_clk tc_ck = {
223*52650505SPaul Walmsley 	.clk = {
224*52650505SPaul Walmsley 		.name		= "tc_ck",
225*52650505SPaul Walmsley 		.ops		= &clkops_null,
226*52650505SPaul Walmsley 		.parent		= &ck_dpll1,
227*52650505SPaul Walmsley 		.flags		= CLOCK_IDLE_CONTROL,
228*52650505SPaul Walmsley 		.rate_offset	= CKCTL_TCDIV_OFFSET,
229*52650505SPaul Walmsley 		.recalc		= &omap1_ckctl_recalc,
230*52650505SPaul Walmsley 		.round_rate	= omap1_clk_round_rate_ckctl_arm,
231*52650505SPaul Walmsley 		.set_rate	= omap1_clk_set_rate_ckctl_arm,
232*52650505SPaul Walmsley 	},
233*52650505SPaul Walmsley 	.idlect_shift	= 6,
234*52650505SPaul Walmsley };
235*52650505SPaul Walmsley 
236*52650505SPaul Walmsley static struct clk arminth_ck1510 = {
237*52650505SPaul Walmsley 	.name		= "arminth_ck",
238*52650505SPaul Walmsley 	.ops		= &clkops_null,
239*52650505SPaul Walmsley 	.parent		= &tc_ck.clk,
240*52650505SPaul Walmsley 	.recalc		= &followparent_recalc,
241*52650505SPaul Walmsley 	/* Note: On 1510 the frequency follows TC_CK
242*52650505SPaul Walmsley 	 *
243*52650505SPaul Walmsley 	 * 16xx version is in MPU clocks.
244*52650505SPaul Walmsley 	 */
245*52650505SPaul Walmsley };
246*52650505SPaul Walmsley 
247*52650505SPaul Walmsley static struct clk tipb_ck = {
248*52650505SPaul Walmsley 	/* No-idle controlled by "tc_ck" */
249*52650505SPaul Walmsley 	.name		= "tipb_ck",
250*52650505SPaul Walmsley 	.ops		= &clkops_null,
251*52650505SPaul Walmsley 	.parent		= &tc_ck.clk,
252*52650505SPaul Walmsley 	.recalc		= &followparent_recalc,
253*52650505SPaul Walmsley };
254*52650505SPaul Walmsley 
255*52650505SPaul Walmsley static struct clk l3_ocpi_ck = {
256*52650505SPaul Walmsley 	/* No-idle controlled by "tc_ck" */
257*52650505SPaul Walmsley 	.name		= "l3_ocpi_ck",
258*52650505SPaul Walmsley 	.ops		= &clkops_generic,
259*52650505SPaul Walmsley 	.parent		= &tc_ck.clk,
260*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT3),
261*52650505SPaul Walmsley 	.enable_bit	= EN_OCPI_CK,
262*52650505SPaul Walmsley 	.recalc		= &followparent_recalc,
263*52650505SPaul Walmsley };
264*52650505SPaul Walmsley 
265*52650505SPaul Walmsley static struct clk tc1_ck = {
266*52650505SPaul Walmsley 	.name		= "tc1_ck",
267*52650505SPaul Walmsley 	.ops		= &clkops_generic,
268*52650505SPaul Walmsley 	.parent		= &tc_ck.clk,
269*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT3),
270*52650505SPaul Walmsley 	.enable_bit	= EN_TC1_CK,
271*52650505SPaul Walmsley 	.recalc		= &followparent_recalc,
272*52650505SPaul Walmsley };
273*52650505SPaul Walmsley 
274*52650505SPaul Walmsley /*
275*52650505SPaul Walmsley  * FIXME: This clock seems to be necessary but no-one has asked for its
276*52650505SPaul Walmsley  * activation.  [ pm.c (SRAM), CCP, Camera ]
277*52650505SPaul Walmsley  */
278*52650505SPaul Walmsley static struct clk tc2_ck = {
279*52650505SPaul Walmsley 	.name		= "tc2_ck",
280*52650505SPaul Walmsley 	.ops		= &clkops_generic,
281*52650505SPaul Walmsley 	.parent		= &tc_ck.clk,
282*52650505SPaul Walmsley 	.flags		= ENABLE_ON_INIT,
283*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT3),
284*52650505SPaul Walmsley 	.enable_bit	= EN_TC2_CK,
285*52650505SPaul Walmsley 	.recalc		= &followparent_recalc,
286*52650505SPaul Walmsley };
287*52650505SPaul Walmsley 
288*52650505SPaul Walmsley static struct clk dma_ck = {
289*52650505SPaul Walmsley 	/* No-idle controlled by "tc_ck" */
290*52650505SPaul Walmsley 	.name		= "dma_ck",
291*52650505SPaul Walmsley 	.ops		= &clkops_null,
292*52650505SPaul Walmsley 	.parent		= &tc_ck.clk,
293*52650505SPaul Walmsley 	.recalc		= &followparent_recalc,
294*52650505SPaul Walmsley };
295*52650505SPaul Walmsley 
296*52650505SPaul Walmsley static struct clk dma_lcdfree_ck = {
297*52650505SPaul Walmsley 	.name		= "dma_lcdfree_ck",
298*52650505SPaul Walmsley 	.ops		= &clkops_null,
299*52650505SPaul Walmsley 	.parent		= &tc_ck.clk,
300*52650505SPaul Walmsley 	.recalc		= &followparent_recalc,
301*52650505SPaul Walmsley };
302*52650505SPaul Walmsley 
303*52650505SPaul Walmsley static struct arm_idlect1_clk api_ck = {
304*52650505SPaul Walmsley 	.clk = {
305*52650505SPaul Walmsley 		.name		= "api_ck",
306*52650505SPaul Walmsley 		.ops		= &clkops_generic,
307*52650505SPaul Walmsley 		.parent		= &tc_ck.clk,
308*52650505SPaul Walmsley 		.flags		= CLOCK_IDLE_CONTROL,
309*52650505SPaul Walmsley 		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
310*52650505SPaul Walmsley 		.enable_bit	= EN_APICK,
311*52650505SPaul Walmsley 		.recalc		= &followparent_recalc,
312*52650505SPaul Walmsley 	},
313*52650505SPaul Walmsley 	.idlect_shift	= 8,
314*52650505SPaul Walmsley };
315*52650505SPaul Walmsley 
316*52650505SPaul Walmsley static struct arm_idlect1_clk lb_ck = {
317*52650505SPaul Walmsley 	.clk = {
318*52650505SPaul Walmsley 		.name		= "lb_ck",
319*52650505SPaul Walmsley 		.ops		= &clkops_generic,
320*52650505SPaul Walmsley 		.parent		= &tc_ck.clk,
321*52650505SPaul Walmsley 		.flags		= CLOCK_IDLE_CONTROL,
322*52650505SPaul Walmsley 		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
323*52650505SPaul Walmsley 		.enable_bit	= EN_LBCK,
324*52650505SPaul Walmsley 		.recalc		= &followparent_recalc,
325*52650505SPaul Walmsley 	},
326*52650505SPaul Walmsley 	.idlect_shift	= 4,
327*52650505SPaul Walmsley };
328*52650505SPaul Walmsley 
329*52650505SPaul Walmsley static struct clk rhea1_ck = {
330*52650505SPaul Walmsley 	.name		= "rhea1_ck",
331*52650505SPaul Walmsley 	.ops		= &clkops_null,
332*52650505SPaul Walmsley 	.parent		= &tc_ck.clk,
333*52650505SPaul Walmsley 	.recalc		= &followparent_recalc,
334*52650505SPaul Walmsley };
335*52650505SPaul Walmsley 
336*52650505SPaul Walmsley static struct clk rhea2_ck = {
337*52650505SPaul Walmsley 	.name		= "rhea2_ck",
338*52650505SPaul Walmsley 	.ops		= &clkops_null,
339*52650505SPaul Walmsley 	.parent		= &tc_ck.clk,
340*52650505SPaul Walmsley 	.recalc		= &followparent_recalc,
341*52650505SPaul Walmsley };
342*52650505SPaul Walmsley 
343*52650505SPaul Walmsley static struct clk lcd_ck_16xx = {
344*52650505SPaul Walmsley 	.name		= "lcd_ck",
345*52650505SPaul Walmsley 	.ops		= &clkops_generic,
346*52650505SPaul Walmsley 	.parent		= &ck_dpll1,
347*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
348*52650505SPaul Walmsley 	.enable_bit	= EN_LCDCK,
349*52650505SPaul Walmsley 	.rate_offset	= CKCTL_LCDDIV_OFFSET,
350*52650505SPaul Walmsley 	.recalc		= &omap1_ckctl_recalc,
351*52650505SPaul Walmsley 	.round_rate	= omap1_clk_round_rate_ckctl_arm,
352*52650505SPaul Walmsley 	.set_rate	= omap1_clk_set_rate_ckctl_arm,
353*52650505SPaul Walmsley };
354*52650505SPaul Walmsley 
355*52650505SPaul Walmsley static struct arm_idlect1_clk lcd_ck_1510 = {
356*52650505SPaul Walmsley 	.clk = {
357*52650505SPaul Walmsley 		.name		= "lcd_ck",
358*52650505SPaul Walmsley 		.ops		= &clkops_generic,
359*52650505SPaul Walmsley 		.parent		= &ck_dpll1,
360*52650505SPaul Walmsley 		.flags		= CLOCK_IDLE_CONTROL,
361*52650505SPaul Walmsley 		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
362*52650505SPaul Walmsley 		.enable_bit	= EN_LCDCK,
363*52650505SPaul Walmsley 		.rate_offset	= CKCTL_LCDDIV_OFFSET,
364*52650505SPaul Walmsley 		.recalc		= &omap1_ckctl_recalc,
365*52650505SPaul Walmsley 		.round_rate	= omap1_clk_round_rate_ckctl_arm,
366*52650505SPaul Walmsley 		.set_rate	= omap1_clk_set_rate_ckctl_arm,
367*52650505SPaul Walmsley 	},
368*52650505SPaul Walmsley 	.idlect_shift	= 3,
369*52650505SPaul Walmsley };
370*52650505SPaul Walmsley 
371*52650505SPaul Walmsley static struct clk uart1_1510 = {
372*52650505SPaul Walmsley 	.name		= "uart1_ck",
373*52650505SPaul Walmsley 	.ops		= &clkops_null,
374*52650505SPaul Walmsley 	/* Direct from ULPD, no real parent */
375*52650505SPaul Walmsley 	.parent		= &armper_ck.clk,
376*52650505SPaul Walmsley 	.rate		= 12000000,
377*52650505SPaul Walmsley 	.flags		= ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
378*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
379*52650505SPaul Walmsley 	.enable_bit	= 29,	/* Chooses between 12MHz and 48MHz */
380*52650505SPaul Walmsley 	.set_rate	= &omap1_set_uart_rate,
381*52650505SPaul Walmsley 	.recalc		= &omap1_uart_recalc,
382*52650505SPaul Walmsley };
383*52650505SPaul Walmsley 
384*52650505SPaul Walmsley static struct uart_clk uart1_16xx = {
385*52650505SPaul Walmsley 	.clk	= {
386*52650505SPaul Walmsley 		.name		= "uart1_ck",
387*52650505SPaul Walmsley 		.ops		= &clkops_uart,
388*52650505SPaul Walmsley 		/* Direct from ULPD, no real parent */
389*52650505SPaul Walmsley 		.parent		= &armper_ck.clk,
390*52650505SPaul Walmsley 		.rate		= 48000000,
391*52650505SPaul Walmsley 		.flags		= RATE_FIXED | ENABLE_REG_32BIT |
392*52650505SPaul Walmsley 				  CLOCK_NO_IDLE_PARENT,
393*52650505SPaul Walmsley 		.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
394*52650505SPaul Walmsley 		.enable_bit	= 29,
395*52650505SPaul Walmsley 	},
396*52650505SPaul Walmsley 	.sysc_addr	= 0xfffb0054,
397*52650505SPaul Walmsley };
398*52650505SPaul Walmsley 
399*52650505SPaul Walmsley static struct clk uart2_ck = {
400*52650505SPaul Walmsley 	.name		= "uart2_ck",
401*52650505SPaul Walmsley 	.ops		= &clkops_null,
402*52650505SPaul Walmsley 	/* Direct from ULPD, no real parent */
403*52650505SPaul Walmsley 	.parent		= &armper_ck.clk,
404*52650505SPaul Walmsley 	.rate		= 12000000,
405*52650505SPaul Walmsley 	.flags		= ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
406*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
407*52650505SPaul Walmsley 	.enable_bit	= 30,	/* Chooses between 12MHz and 48MHz */
408*52650505SPaul Walmsley 	.set_rate	= &omap1_set_uart_rate,
409*52650505SPaul Walmsley 	.recalc		= &omap1_uart_recalc,
410*52650505SPaul Walmsley };
411*52650505SPaul Walmsley 
412*52650505SPaul Walmsley static struct clk uart3_1510 = {
413*52650505SPaul Walmsley 	.name		= "uart3_ck",
414*52650505SPaul Walmsley 	.ops		= &clkops_null,
415*52650505SPaul Walmsley 	/* Direct from ULPD, no real parent */
416*52650505SPaul Walmsley 	.parent		= &armper_ck.clk,
417*52650505SPaul Walmsley 	.rate		= 12000000,
418*52650505SPaul Walmsley 	.flags		= ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
419*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
420*52650505SPaul Walmsley 	.enable_bit	= 31,	/* Chooses between 12MHz and 48MHz */
421*52650505SPaul Walmsley 	.set_rate	= &omap1_set_uart_rate,
422*52650505SPaul Walmsley 	.recalc		= &omap1_uart_recalc,
423*52650505SPaul Walmsley };
424*52650505SPaul Walmsley 
425*52650505SPaul Walmsley static struct uart_clk uart3_16xx = {
426*52650505SPaul Walmsley 	.clk	= {
427*52650505SPaul Walmsley 		.name		= "uart3_ck",
428*52650505SPaul Walmsley 		.ops		= &clkops_uart,
429*52650505SPaul Walmsley 		/* Direct from ULPD, no real parent */
430*52650505SPaul Walmsley 		.parent		= &armper_ck.clk,
431*52650505SPaul Walmsley 		.rate		= 48000000,
432*52650505SPaul Walmsley 		.flags		= RATE_FIXED | ENABLE_REG_32BIT |
433*52650505SPaul Walmsley 				  CLOCK_NO_IDLE_PARENT,
434*52650505SPaul Walmsley 		.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
435*52650505SPaul Walmsley 		.enable_bit	= 31,
436*52650505SPaul Walmsley 	},
437*52650505SPaul Walmsley 	.sysc_addr	= 0xfffb9854,
438*52650505SPaul Walmsley };
439*52650505SPaul Walmsley 
440*52650505SPaul Walmsley static struct clk usb_clko = {	/* 6 MHz output on W4_USB_CLKO */
441*52650505SPaul Walmsley 	.name		= "usb_clko",
442*52650505SPaul Walmsley 	.ops		= &clkops_generic,
443*52650505SPaul Walmsley 	/* Direct from ULPD, no parent */
444*52650505SPaul Walmsley 	.rate		= 6000000,
445*52650505SPaul Walmsley 	.flags		= RATE_FIXED | ENABLE_REG_32BIT,
446*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(ULPD_CLOCK_CTRL),
447*52650505SPaul Walmsley 	.enable_bit	= USB_MCLK_EN_BIT,
448*52650505SPaul Walmsley };
449*52650505SPaul Walmsley 
450*52650505SPaul Walmsley static struct clk usb_hhc_ck1510 = {
451*52650505SPaul Walmsley 	.name		= "usb_hhc_ck",
452*52650505SPaul Walmsley 	.ops		= &clkops_generic,
453*52650505SPaul Walmsley 	/* Direct from ULPD, no parent */
454*52650505SPaul Walmsley 	.rate		= 48000000, /* Actually 2 clocks, 12MHz and 48MHz */
455*52650505SPaul Walmsley 	.flags		= RATE_FIXED | ENABLE_REG_32BIT,
456*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
457*52650505SPaul Walmsley 	.enable_bit	= USB_HOST_HHC_UHOST_EN,
458*52650505SPaul Walmsley };
459*52650505SPaul Walmsley 
460*52650505SPaul Walmsley static struct clk usb_hhc_ck16xx = {
461*52650505SPaul Walmsley 	.name		= "usb_hhc_ck",
462*52650505SPaul Walmsley 	.ops		= &clkops_generic,
463*52650505SPaul Walmsley 	/* Direct from ULPD, no parent */
464*52650505SPaul Walmsley 	.rate		= 48000000,
465*52650505SPaul Walmsley 	/* OTG_SYSCON_2.OTG_PADEN == 0 (not 1510-compatible) */
466*52650505SPaul Walmsley 	.flags		= RATE_FIXED | ENABLE_REG_32BIT,
467*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(OTG_BASE + 0x08), /* OTG_SYSCON_2 */
468*52650505SPaul Walmsley 	.enable_bit	= 8 /* UHOST_EN */,
469*52650505SPaul Walmsley };
470*52650505SPaul Walmsley 
471*52650505SPaul Walmsley static struct clk usb_dc_ck = {
472*52650505SPaul Walmsley 	.name		= "usb_dc_ck",
473*52650505SPaul Walmsley 	.ops		= &clkops_generic,
474*52650505SPaul Walmsley 	/* Direct from ULPD, no parent */
475*52650505SPaul Walmsley 	.rate		= 48000000,
476*52650505SPaul Walmsley 	.flags		= RATE_FIXED,
477*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(SOFT_REQ_REG),
478*52650505SPaul Walmsley 	.enable_bit	= 4,
479*52650505SPaul Walmsley };
480*52650505SPaul Walmsley 
481*52650505SPaul Walmsley static struct clk usb_dc_ck7xx = {
482*52650505SPaul Walmsley 	.name		= "usb_dc_ck",
483*52650505SPaul Walmsley 	.ops		= &clkops_generic,
484*52650505SPaul Walmsley 	/* Direct from ULPD, no parent */
485*52650505SPaul Walmsley 	.rate		= 48000000,
486*52650505SPaul Walmsley 	.flags		= RATE_FIXED,
487*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(SOFT_REQ_REG),
488*52650505SPaul Walmsley 	.enable_bit	= 8,
489*52650505SPaul Walmsley };
490*52650505SPaul Walmsley 
491*52650505SPaul Walmsley static struct clk mclk_1510 = {
492*52650505SPaul Walmsley 	.name		= "mclk",
493*52650505SPaul Walmsley 	.ops		= &clkops_generic,
494*52650505SPaul Walmsley 	/* Direct from ULPD, no parent. May be enabled by ext hardware. */
495*52650505SPaul Walmsley 	.rate		= 12000000,
496*52650505SPaul Walmsley 	.flags		= RATE_FIXED,
497*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(SOFT_REQ_REG),
498*52650505SPaul Walmsley 	.enable_bit	= 6,
499*52650505SPaul Walmsley };
500*52650505SPaul Walmsley 
501*52650505SPaul Walmsley static struct clk mclk_16xx = {
502*52650505SPaul Walmsley 	.name		= "mclk",
503*52650505SPaul Walmsley 	.ops		= &clkops_generic,
504*52650505SPaul Walmsley 	/* Direct from ULPD, no parent. May be enabled by ext hardware. */
505*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(COM_CLK_DIV_CTRL_SEL),
506*52650505SPaul Walmsley 	.enable_bit	= COM_ULPD_PLL_CLK_REQ,
507*52650505SPaul Walmsley 	.set_rate	= &omap1_set_ext_clk_rate,
508*52650505SPaul Walmsley 	.round_rate	= &omap1_round_ext_clk_rate,
509*52650505SPaul Walmsley 	.init		= &omap1_init_ext_clk,
510*52650505SPaul Walmsley };
511*52650505SPaul Walmsley 
512*52650505SPaul Walmsley static struct clk bclk_1510 = {
513*52650505SPaul Walmsley 	.name		= "bclk",
514*52650505SPaul Walmsley 	.ops		= &clkops_generic,
515*52650505SPaul Walmsley 	/* Direct from ULPD, no parent. May be enabled by ext hardware. */
516*52650505SPaul Walmsley 	.rate		= 12000000,
517*52650505SPaul Walmsley 	.flags		= RATE_FIXED,
518*52650505SPaul Walmsley };
519*52650505SPaul Walmsley 
520*52650505SPaul Walmsley static struct clk bclk_16xx = {
521*52650505SPaul Walmsley 	.name		= "bclk",
522*52650505SPaul Walmsley 	.ops		= &clkops_generic,
523*52650505SPaul Walmsley 	/* Direct from ULPD, no parent. May be enabled by ext hardware. */
524*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(SWD_CLK_DIV_CTRL_SEL),
525*52650505SPaul Walmsley 	.enable_bit	= SWD_ULPD_PLL_CLK_REQ,
526*52650505SPaul Walmsley 	.set_rate	= &omap1_set_ext_clk_rate,
527*52650505SPaul Walmsley 	.round_rate	= &omap1_round_ext_clk_rate,
528*52650505SPaul Walmsley 	.init		= &omap1_init_ext_clk,
529*52650505SPaul Walmsley };
530*52650505SPaul Walmsley 
531*52650505SPaul Walmsley static struct clk mmc1_ck = {
532*52650505SPaul Walmsley 	.name		= "mmc_ck",
533*52650505SPaul Walmsley 	.ops		= &clkops_generic,
534*52650505SPaul Walmsley 	/* Functional clock is direct from ULPD, interface clock is ARMPER */
535*52650505SPaul Walmsley 	.parent		= &armper_ck.clk,
536*52650505SPaul Walmsley 	.rate		= 48000000,
537*52650505SPaul Walmsley 	.flags		= RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
538*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
539*52650505SPaul Walmsley 	.enable_bit	= 23,
540*52650505SPaul Walmsley };
541*52650505SPaul Walmsley 
542*52650505SPaul Walmsley static struct clk mmc2_ck = {
543*52650505SPaul Walmsley 	.name		= "mmc_ck",
544*52650505SPaul Walmsley 	.id		= 1,
545*52650505SPaul Walmsley 	.ops		= &clkops_generic,
546*52650505SPaul Walmsley 	/* Functional clock is direct from ULPD, interface clock is ARMPER */
547*52650505SPaul Walmsley 	.parent		= &armper_ck.clk,
548*52650505SPaul Walmsley 	.rate		= 48000000,
549*52650505SPaul Walmsley 	.flags		= RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
550*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
551*52650505SPaul Walmsley 	.enable_bit	= 20,
552*52650505SPaul Walmsley };
553*52650505SPaul Walmsley 
554*52650505SPaul Walmsley static struct clk mmc3_ck = {
555*52650505SPaul Walmsley 	.name		= "mmc_ck",
556*52650505SPaul Walmsley 	.id		= 2,
557*52650505SPaul Walmsley 	.ops		= &clkops_generic,
558*52650505SPaul Walmsley 	/* Functional clock is direct from ULPD, interface clock is ARMPER */
559*52650505SPaul Walmsley 	.parent		= &armper_ck.clk,
560*52650505SPaul Walmsley 	.rate		= 48000000,
561*52650505SPaul Walmsley 	.flags		= RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
562*52650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(SOFT_REQ_REG),
563*52650505SPaul Walmsley 	.enable_bit	= 12,
564*52650505SPaul Walmsley };
565*52650505SPaul Walmsley 
566*52650505SPaul Walmsley static struct clk virtual_ck_mpu = {
567*52650505SPaul Walmsley 	.name		= "mpu",
568*52650505SPaul Walmsley 	.ops		= &clkops_null,
569*52650505SPaul Walmsley 	.parent		= &arm_ck, /* Is smarter alias for */
570*52650505SPaul Walmsley 	.recalc		= &followparent_recalc,
571*52650505SPaul Walmsley 	.set_rate	= &omap1_select_table_rate,
572*52650505SPaul Walmsley 	.round_rate	= &omap1_round_to_table_rate,
573*52650505SPaul Walmsley };
574*52650505SPaul Walmsley 
575*52650505SPaul Walmsley /* virtual functional clock domain for I2C. Just for making sure that ARMXOR_CK
576*52650505SPaul Walmsley remains active during MPU idle whenever this is enabled */
577*52650505SPaul Walmsley static struct clk i2c_fck = {
578*52650505SPaul Walmsley 	.name		= "i2c_fck",
579*52650505SPaul Walmsley 	.id		= 1,
580*52650505SPaul Walmsley 	.ops		= &clkops_null,
581*52650505SPaul Walmsley 	.flags		= CLOCK_NO_IDLE_PARENT,
582*52650505SPaul Walmsley 	.parent		= &armxor_ck.clk,
583*52650505SPaul Walmsley 	.recalc		= &followparent_recalc,
584*52650505SPaul Walmsley };
585*52650505SPaul Walmsley 
586*52650505SPaul Walmsley static struct clk i2c_ick = {
587*52650505SPaul Walmsley 	.name		= "i2c_ick",
588*52650505SPaul Walmsley 	.id		= 1,
589*52650505SPaul Walmsley 	.ops		= &clkops_null,
590*52650505SPaul Walmsley 	.flags		= CLOCK_NO_IDLE_PARENT,
591*52650505SPaul Walmsley 	.parent		= &armper_ck.clk,
592*52650505SPaul Walmsley 	.recalc		= &followparent_recalc,
593*52650505SPaul Walmsley };
594*52650505SPaul Walmsley 
595*52650505SPaul Walmsley /*
596*52650505SPaul Walmsley  * clkdev integration
597*52650505SPaul Walmsley  */
598*52650505SPaul Walmsley 
599*52650505SPaul Walmsley static struct omap_clk omap_clks[] = {
600*52650505SPaul Walmsley 	/* non-ULPD clocks */
601*52650505SPaul Walmsley 	CLK(NULL,	"ck_ref",	&ck_ref,	CK_16XX | CK_1510 | CK_310 | CK_7XX),
602*52650505SPaul Walmsley 	CLK(NULL,	"ck_dpll1",	&ck_dpll1,	CK_16XX | CK_1510 | CK_310),
603*52650505SPaul Walmsley 	/* CK_GEN1 clocks */
604*52650505SPaul Walmsley 	CLK(NULL,	"ck_dpll1out",	&ck_dpll1out.clk, CK_16XX),
605*52650505SPaul Walmsley 	CLK(NULL,	"ck_sossi",	&sossi_ck,	CK_16XX),
606*52650505SPaul Walmsley 	CLK(NULL,	"arm_ck",	&arm_ck,	CK_16XX | CK_1510 | CK_310),
607*52650505SPaul Walmsley 	CLK(NULL,	"armper_ck",	&armper_ck.clk,	CK_16XX | CK_1510 | CK_310),
608*52650505SPaul Walmsley 	CLK(NULL,	"arm_gpio_ck",	&arm_gpio_ck,	CK_1510 | CK_310),
609*52650505SPaul Walmsley 	CLK(NULL,	"armxor_ck",	&armxor_ck.clk,	CK_16XX | CK_1510 | CK_310 | CK_7XX),
610*52650505SPaul Walmsley 	CLK(NULL,	"armtim_ck",	&armtim_ck.clk,	CK_16XX | CK_1510 | CK_310),
611*52650505SPaul Walmsley 	CLK("omap_wdt",	"fck",		&armwdt_ck.clk,	CK_16XX | CK_1510 | CK_310),
612*52650505SPaul Walmsley 	CLK("omap_wdt",	"ick",		&armper_ck.clk,	CK_16XX),
613*52650505SPaul Walmsley 	CLK("omap_wdt", "ick",		&dummy_ck,	CK_1510 | CK_310),
614*52650505SPaul Walmsley 	CLK(NULL,	"arminth_ck",	&arminth_ck1510, CK_1510 | CK_310),
615*52650505SPaul Walmsley 	CLK(NULL,	"arminth_ck",	&arminth_ck16xx, CK_16XX),
616*52650505SPaul Walmsley 	/* CK_GEN2 clocks */
617*52650505SPaul Walmsley 	CLK(NULL,	"dsp_ck",	&dsp_ck,	CK_16XX | CK_1510 | CK_310),
618*52650505SPaul Walmsley 	CLK(NULL,	"dspmmu_ck",	&dspmmu_ck,	CK_16XX | CK_1510 | CK_310),
619*52650505SPaul Walmsley 	CLK(NULL,	"dspper_ck",	&dspper_ck,	CK_16XX | CK_1510 | CK_310),
620*52650505SPaul Walmsley 	CLK(NULL,	"dspxor_ck",	&dspxor_ck,	CK_16XX | CK_1510 | CK_310),
621*52650505SPaul Walmsley 	CLK(NULL,	"dsptim_ck",	&dsptim_ck,	CK_16XX | CK_1510 | CK_310),
622*52650505SPaul Walmsley 	/* CK_GEN3 clocks */
623*52650505SPaul Walmsley 	CLK(NULL,	"tc_ck",	&tc_ck.clk,	CK_16XX | CK_1510 | CK_310 | CK_7XX),
624*52650505SPaul Walmsley 	CLK(NULL,	"tipb_ck",	&tipb_ck,	CK_1510 | CK_310),
625*52650505SPaul Walmsley 	CLK(NULL,	"l3_ocpi_ck",	&l3_ocpi_ck,	CK_16XX | CK_7XX),
626*52650505SPaul Walmsley 	CLK(NULL,	"tc1_ck",	&tc1_ck,	CK_16XX),
627*52650505SPaul Walmsley 	CLK(NULL,	"tc2_ck",	&tc2_ck,	CK_16XX),
628*52650505SPaul Walmsley 	CLK(NULL,	"dma_ck",	&dma_ck,	CK_16XX | CK_1510 | CK_310),
629*52650505SPaul Walmsley 	CLK(NULL,	"dma_lcdfree_ck", &dma_lcdfree_ck, CK_16XX),
630*52650505SPaul Walmsley 	CLK(NULL,	"api_ck",	&api_ck.clk,	CK_16XX | CK_1510 | CK_310),
631*52650505SPaul Walmsley 	CLK(NULL,	"lb_ck",	&lb_ck.clk,	CK_1510 | CK_310),
632*52650505SPaul Walmsley 	CLK(NULL,	"rhea1_ck",	&rhea1_ck,	CK_16XX),
633*52650505SPaul Walmsley 	CLK(NULL,	"rhea2_ck",	&rhea2_ck,	CK_16XX),
634*52650505SPaul Walmsley 	CLK(NULL,	"lcd_ck",	&lcd_ck_16xx,	CK_16XX | CK_7XX),
635*52650505SPaul Walmsley 	CLK(NULL,	"lcd_ck",	&lcd_ck_1510.clk, CK_1510 | CK_310),
636*52650505SPaul Walmsley 	/* ULPD clocks */
637*52650505SPaul Walmsley 	CLK(NULL,	"uart1_ck",	&uart1_1510,	CK_1510 | CK_310),
638*52650505SPaul Walmsley 	CLK(NULL,	"uart1_ck",	&uart1_16xx.clk, CK_16XX),
639*52650505SPaul Walmsley 	CLK(NULL,	"uart2_ck",	&uart2_ck,	CK_16XX | CK_1510 | CK_310),
640*52650505SPaul Walmsley 	CLK(NULL,	"uart3_ck",	&uart3_1510,	CK_1510 | CK_310),
641*52650505SPaul Walmsley 	CLK(NULL,	"uart3_ck",	&uart3_16xx.clk, CK_16XX),
642*52650505SPaul Walmsley 	CLK(NULL,	"usb_clko",	&usb_clko,	CK_16XX | CK_1510 | CK_310),
643*52650505SPaul Walmsley 	CLK(NULL,	"usb_hhc_ck",	&usb_hhc_ck1510, CK_1510 | CK_310),
644*52650505SPaul Walmsley 	CLK(NULL,	"usb_hhc_ck",	&usb_hhc_ck16xx, CK_16XX),
645*52650505SPaul Walmsley 	CLK(NULL,	"usb_dc_ck",	&usb_dc_ck,	CK_16XX),
646*52650505SPaul Walmsley 	CLK(NULL,	"usb_dc_ck",	&usb_dc_ck7xx,	CK_7XX),
647*52650505SPaul Walmsley 	CLK(NULL,	"mclk",		&mclk_1510,	CK_1510 | CK_310),
648*52650505SPaul Walmsley 	CLK(NULL,	"mclk",		&mclk_16xx,	CK_16XX),
649*52650505SPaul Walmsley 	CLK(NULL,	"bclk",		&bclk_1510,	CK_1510 | CK_310),
650*52650505SPaul Walmsley 	CLK(NULL,	"bclk",		&bclk_16xx,	CK_16XX),
651*52650505SPaul Walmsley 	CLK("mmci-omap.0", "fck",	&mmc1_ck,	CK_16XX | CK_1510 | CK_310),
652*52650505SPaul Walmsley 	CLK("mmci-omap.0", "fck",	&mmc3_ck,	CK_7XX),
653*52650505SPaul Walmsley 	CLK("mmci-omap.0", "ick",	&armper_ck.clk,	CK_16XX | CK_1510 | CK_310 | CK_7XX),
654*52650505SPaul Walmsley 	CLK("mmci-omap.1", "fck",	&mmc2_ck,	CK_16XX),
655*52650505SPaul Walmsley 	CLK("mmci-omap.1", "ick",	&armper_ck.clk,	CK_16XX),
656*52650505SPaul Walmsley 	/* Virtual clocks */
657*52650505SPaul Walmsley 	CLK(NULL,	"mpu",		&virtual_ck_mpu, CK_16XX | CK_1510 | CK_310),
658*52650505SPaul Walmsley 	CLK("i2c_omap.1", "fck",	&i2c_fck,	CK_16XX | CK_1510 | CK_310),
659*52650505SPaul Walmsley 	CLK("i2c_omap.1", "ick",	&i2c_ick,	CK_16XX),
660*52650505SPaul Walmsley 	CLK("i2c_omap.1", "ick",	&dummy_ck,	CK_1510 | CK_310),
661*52650505SPaul Walmsley 	CLK("omap_uwire", "fck",	&armxor_ck.clk,	CK_16XX | CK_1510 | CK_310),
662*52650505SPaul Walmsley 	CLK("omap-mcbsp.1", "ick",	&dspper_ck,	CK_16XX),
663*52650505SPaul Walmsley 	CLK("omap-mcbsp.1", "ick",	&dummy_ck,	CK_1510 | CK_310),
664*52650505SPaul Walmsley 	CLK("omap-mcbsp.2", "ick",	&armper_ck.clk,	CK_16XX),
665*52650505SPaul Walmsley 	CLK("omap-mcbsp.2", "ick",	&dummy_ck,	CK_1510 | CK_310),
666*52650505SPaul Walmsley 	CLK("omap-mcbsp.3", "ick",	&dspper_ck,	CK_16XX),
667*52650505SPaul Walmsley 	CLK("omap-mcbsp.3", "ick",	&dummy_ck,	CK_1510 | CK_310),
668*52650505SPaul Walmsley 	CLK("omap-mcbsp.1", "fck",	&dspxor_ck,	CK_16XX | CK_1510 | CK_310),
669*52650505SPaul Walmsley 	CLK("omap-mcbsp.2", "fck",	&armper_ck.clk,	CK_16XX | CK_1510 | CK_310),
670*52650505SPaul Walmsley 	CLK("omap-mcbsp.3", "fck",	&dspxor_ck,	CK_16XX | CK_1510 | CK_310),
671*52650505SPaul Walmsley };
672*52650505SPaul Walmsley 
673*52650505SPaul Walmsley /*
674*52650505SPaul Walmsley  * init
675*52650505SPaul Walmsley  */
676*52650505SPaul Walmsley 
677*52650505SPaul Walmsley static struct clk_functions omap1_clk_functions __initdata = {
678*52650505SPaul Walmsley 	.clk_enable		= omap1_clk_enable,
679*52650505SPaul Walmsley 	.clk_disable		= omap1_clk_disable,
680*52650505SPaul Walmsley 	.clk_round_rate		= omap1_clk_round_rate,
681*52650505SPaul Walmsley 	.clk_set_rate		= omap1_clk_set_rate,
682*52650505SPaul Walmsley 	.clk_disable_unused	= omap1_clk_disable_unused,
683*52650505SPaul Walmsley };
684*52650505SPaul Walmsley 
685*52650505SPaul Walmsley int __init omap1_clk_init(void)
686*52650505SPaul Walmsley {
687*52650505SPaul Walmsley 	struct omap_clk *c;
688*52650505SPaul Walmsley 	const struct omap_clock_config *info;
689*52650505SPaul Walmsley 	int crystal_type = 0; /* Default 12 MHz */
690*52650505SPaul Walmsley 	u32 reg, cpu_mask;
691*52650505SPaul Walmsley 
692*52650505SPaul Walmsley #ifdef CONFIG_DEBUG_LL
693*52650505SPaul Walmsley 	/*
694*52650505SPaul Walmsley 	 * Resets some clocks that may be left on from bootloader,
695*52650505SPaul Walmsley 	 * but leaves serial clocks on.
696*52650505SPaul Walmsley 	 */
697*52650505SPaul Walmsley 	omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
698*52650505SPaul Walmsley #endif
699*52650505SPaul Walmsley 
700*52650505SPaul Walmsley 	/* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */
701*52650505SPaul Walmsley 	reg = omap_readw(SOFT_REQ_REG) & (1 << 4);
702*52650505SPaul Walmsley 	omap_writew(reg, SOFT_REQ_REG);
703*52650505SPaul Walmsley 	if (!cpu_is_omap15xx())
704*52650505SPaul Walmsley 		omap_writew(0, SOFT_REQ_REG2);
705*52650505SPaul Walmsley 
706*52650505SPaul Walmsley 	clk_init(&omap1_clk_functions);
707*52650505SPaul Walmsley 
708*52650505SPaul Walmsley 	/* By default all idlect1 clocks are allowed to idle */
709*52650505SPaul Walmsley 	arm_idlect1_mask = ~0;
710*52650505SPaul Walmsley 
711*52650505SPaul Walmsley 	for (c = omap_clks; c < omap_clks + ARRAY_SIZE(omap_clks); c++)
712*52650505SPaul Walmsley 		clk_preinit(c->lk.clk);
713*52650505SPaul Walmsley 
714*52650505SPaul Walmsley 	cpu_mask = 0;
715*52650505SPaul Walmsley 	if (cpu_is_omap16xx())
716*52650505SPaul Walmsley 		cpu_mask |= CK_16XX;
717*52650505SPaul Walmsley 	if (cpu_is_omap1510())
718*52650505SPaul Walmsley 		cpu_mask |= CK_1510;
719*52650505SPaul Walmsley 	if (cpu_is_omap7xx())
720*52650505SPaul Walmsley 		cpu_mask |= CK_7XX;
721*52650505SPaul Walmsley 	if (cpu_is_omap310())
722*52650505SPaul Walmsley 		cpu_mask |= CK_310;
723*52650505SPaul Walmsley 
724*52650505SPaul Walmsley 	for (c = omap_clks; c < omap_clks + ARRAY_SIZE(omap_clks); c++)
725*52650505SPaul Walmsley 		if (c->cpu & cpu_mask) {
726*52650505SPaul Walmsley 			clkdev_add(&c->lk);
727*52650505SPaul Walmsley 			clk_register(c->lk.clk);
728*52650505SPaul Walmsley 		}
729*52650505SPaul Walmsley 
730*52650505SPaul Walmsley 	/* Pointers to these clocks are needed by code in clock.c */
731*52650505SPaul Walmsley 	api_ck_p = clk_get(NULL, "api_ck");
732*52650505SPaul Walmsley 	ck_dpll1_p = clk_get(NULL, "ck_dpll1");
733*52650505SPaul Walmsley 	ck_ref_p = clk_get(NULL, "ck_ref");
734*52650505SPaul Walmsley 
735*52650505SPaul Walmsley 	info = omap_get_config(OMAP_TAG_CLOCK, struct omap_clock_config);
736*52650505SPaul Walmsley 	if (info != NULL) {
737*52650505SPaul Walmsley 		if (!cpu_is_omap15xx())
738*52650505SPaul Walmsley 			crystal_type = info->system_clock_type;
739*52650505SPaul Walmsley 	}
740*52650505SPaul Walmsley 
741*52650505SPaul Walmsley #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
742*52650505SPaul Walmsley 	ck_ref.rate = 13000000;
743*52650505SPaul Walmsley #elif defined(CONFIG_ARCH_OMAP16XX)
744*52650505SPaul Walmsley 	if (crystal_type == 2)
745*52650505SPaul Walmsley 		ck_ref.rate = 19200000;
746*52650505SPaul Walmsley #endif
747*52650505SPaul Walmsley 
748*52650505SPaul Walmsley 	pr_info("Clocks: ARM_SYSST: 0x%04x DPLL_CTL: 0x%04x ARM_CKCTL: "
749*52650505SPaul Walmsley 		"0x%04x\n", omap_readw(ARM_SYSST), omap_readw(DPLL_CTL),
750*52650505SPaul Walmsley 		omap_readw(ARM_CKCTL));
751*52650505SPaul Walmsley 
752*52650505SPaul Walmsley 	/* We want to be in syncronous scalable mode */
753*52650505SPaul Walmsley 	omap_writew(0x1000, ARM_SYSST);
754*52650505SPaul Walmsley 
755*52650505SPaul Walmsley #ifdef CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER
756*52650505SPaul Walmsley 	/* Use values set by bootloader. Determine PLL rate and recalculate
757*52650505SPaul Walmsley 	 * dependent clocks as if kernel had changed PLL or divisors.
758*52650505SPaul Walmsley 	 */
759*52650505SPaul Walmsley 	{
760*52650505SPaul Walmsley 		unsigned pll_ctl_val = omap_readw(DPLL_CTL);
761*52650505SPaul Walmsley 
762*52650505SPaul Walmsley 		ck_dpll1.rate = ck_ref.rate; /* Base xtal rate */
763*52650505SPaul Walmsley 		if (pll_ctl_val & 0x10) {
764*52650505SPaul Walmsley 			/* PLL enabled, apply multiplier and divisor */
765*52650505SPaul Walmsley 			if (pll_ctl_val & 0xf80)
766*52650505SPaul Walmsley 				ck_dpll1.rate *= (pll_ctl_val & 0xf80) >> 7;
767*52650505SPaul Walmsley 			ck_dpll1.rate /= ((pll_ctl_val & 0x60) >> 5) + 1;
768*52650505SPaul Walmsley 		} else {
769*52650505SPaul Walmsley 			/* PLL disabled, apply bypass divisor */
770*52650505SPaul Walmsley 			switch (pll_ctl_val & 0xc) {
771*52650505SPaul Walmsley 			case 0:
772*52650505SPaul Walmsley 				break;
773*52650505SPaul Walmsley 			case 0x4:
774*52650505SPaul Walmsley 				ck_dpll1.rate /= 2;
775*52650505SPaul Walmsley 				break;
776*52650505SPaul Walmsley 			default:
777*52650505SPaul Walmsley 				ck_dpll1.rate /= 4;
778*52650505SPaul Walmsley 				break;
779*52650505SPaul Walmsley 			}
780*52650505SPaul Walmsley 		}
781*52650505SPaul Walmsley 	}
782*52650505SPaul Walmsley #else
783*52650505SPaul Walmsley 	/* Find the highest supported frequency and enable it */
784*52650505SPaul Walmsley 	if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) {
785*52650505SPaul Walmsley 		printk(KERN_ERR "System frequencies not set. Check your config.\n");
786*52650505SPaul Walmsley 		/* Guess sane values (60MHz) */
787*52650505SPaul Walmsley 		omap_writew(0x2290, DPLL_CTL);
788*52650505SPaul Walmsley 		omap_writew(cpu_is_omap7xx() ? 0x3005 : 0x1005, ARM_CKCTL);
789*52650505SPaul Walmsley 		ck_dpll1.rate = 60000000;
790*52650505SPaul Walmsley 	}
791*52650505SPaul Walmsley #endif
792*52650505SPaul Walmsley 	propagate_rate(&ck_dpll1);
793*52650505SPaul Walmsley 	/* Cache rates for clocks connected to ck_ref (not dpll1) */
794*52650505SPaul Walmsley 	propagate_rate(&ck_ref);
795*52650505SPaul Walmsley 	printk(KERN_INFO "Clocking rate (xtal/DPLL1/MPU): "
796*52650505SPaul Walmsley 		"%ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n",
797*52650505SPaul Walmsley 	       ck_ref.rate / 1000000, (ck_ref.rate / 100000) % 10,
798*52650505SPaul Walmsley 	       ck_dpll1.rate / 1000000, (ck_dpll1.rate / 100000) % 10,
799*52650505SPaul Walmsley 	       arm_ck.rate / 1000000, (arm_ck.rate / 100000) % 10);
800*52650505SPaul Walmsley 
801*52650505SPaul Walmsley #if defined(CONFIG_MACH_OMAP_PERSEUS2) || defined(CONFIG_MACH_OMAP_FSAMPLE)
802*52650505SPaul Walmsley 	/* Select slicer output as OMAP input clock */
803*52650505SPaul Walmsley 	omap_writew(omap_readw(OMAP7XX_PCC_UPLD_CTRL) & ~0x1, OMAP7XX_PCC_UPLD_CTRL);
804*52650505SPaul Walmsley #endif
805*52650505SPaul Walmsley 
806*52650505SPaul Walmsley 	/* Amstrad Delta wants BCLK high when inactive */
807*52650505SPaul Walmsley 	if (machine_is_ams_delta())
808*52650505SPaul Walmsley 		omap_writel(omap_readl(ULPD_CLOCK_CTRL) |
809*52650505SPaul Walmsley 				(1 << SDW_MCLK_INV_BIT),
810*52650505SPaul Walmsley 				ULPD_CLOCK_CTRL);
811*52650505SPaul Walmsley 
812*52650505SPaul Walmsley 	/* Turn off DSP and ARM_TIMXO. Make sure ARM_INTHCK is not divided */
813*52650505SPaul Walmsley 	/* (on 730, bit 13 must not be cleared) */
814*52650505SPaul Walmsley 	if (cpu_is_omap7xx())
815*52650505SPaul Walmsley 		omap_writew(omap_readw(ARM_CKCTL) & 0x2fff, ARM_CKCTL);
816*52650505SPaul Walmsley 	else
817*52650505SPaul Walmsley 		omap_writew(omap_readw(ARM_CKCTL) & 0x0fff, ARM_CKCTL);
818*52650505SPaul Walmsley 
819*52650505SPaul Walmsley 	/* Put DSP/MPUI into reset until needed */
820*52650505SPaul Walmsley 	omap_writew(0, ARM_RSTCT1);
821*52650505SPaul Walmsley 	omap_writew(1, ARM_RSTCT2);
822*52650505SPaul Walmsley 	omap_writew(0x400, ARM_IDLECT1);
823*52650505SPaul Walmsley 
824*52650505SPaul Walmsley 	/*
825*52650505SPaul Walmsley 	 * According to OMAP5910 Erratum SYS_DMA_1, bit DMACK_REQ (bit 8)
826*52650505SPaul Walmsley 	 * of the ARM_IDLECT2 register must be set to zero. The power-on
827*52650505SPaul Walmsley 	 * default value of this bit is one.
828*52650505SPaul Walmsley 	 */
829*52650505SPaul Walmsley 	omap_writew(0x0000, ARM_IDLECT2);	/* Turn LCD clock off also */
830*52650505SPaul Walmsley 
831*52650505SPaul Walmsley 	/*
832*52650505SPaul Walmsley 	 * Only enable those clocks we will need, let the drivers
833*52650505SPaul Walmsley 	 * enable other clocks as necessary
834*52650505SPaul Walmsley 	 */
835*52650505SPaul Walmsley 	clk_enable(&armper_ck.clk);
836*52650505SPaul Walmsley 	clk_enable(&armxor_ck.clk);
837*52650505SPaul Walmsley 	clk_enable(&armtim_ck.clk); /* This should be done by timer code */
838*52650505SPaul Walmsley 
839*52650505SPaul Walmsley 	if (cpu_is_omap15xx())
840*52650505SPaul Walmsley 		clk_enable(&arm_gpio_ck);
841*52650505SPaul Walmsley 
842*52650505SPaul Walmsley 	return 0;
843*52650505SPaul Walmsley }
844