blob: 17f87427125543f47cbcf4c368b01712ea01f409 [file] [log] [blame]
Tony Lindgren3179a012005-11-10 14:26:48 +00001/*
2 * linux/arch/arm/mach-omap1/clock.h
3 *
4 * Copyright (C) 2004 - 2005 Nokia corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
6 * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
7 *
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.
11 */
12
13#ifndef __ARCH_ARM_MACH_OMAP1_CLOCK_H
14#define __ARCH_ARM_MACH_OMAP1_CLOCK_H
15
Russell King8b9dbc12009-02-12 10:12:59 +000016static unsigned long omap1_ckctl_recalc(struct clk *clk);
17static unsigned long omap1_watchdog_recalc(struct clk *clk);
Imre Deakdf2c2e72007-03-05 17:22:58 +020018static int omap1_set_sossi_rate(struct clk *clk, unsigned long rate);
Russell King8b9dbc12009-02-12 10:12:59 +000019static unsigned long omap1_sossi_recalc(struct clk *clk);
20static unsigned long omap1_ckctl_recalc_dsp_domain(struct clk *clk);
Tony Lindgren3179a012005-11-10 14:26:48 +000021static int omap1_clk_set_rate_dsp_domain(struct clk * clk, unsigned long rate);
Tony Lindgren3179a012005-11-10 14:26:48 +000022static int omap1_set_uart_rate(struct clk * clk, unsigned long rate);
Russell King8b9dbc12009-02-12 10:12:59 +000023static unsigned long omap1_uart_recalc(struct clk *clk);
Tony Lindgren3179a012005-11-10 14:26:48 +000024static int omap1_set_ext_clk_rate(struct clk * clk, unsigned long rate);
25static long omap1_round_ext_clk_rate(struct clk * clk, unsigned long rate);
26static void omap1_init_ext_clk(struct clk * clk);
27static int omap1_select_table_rate(struct clk * clk, unsigned long rate);
28static long omap1_round_to_table_rate(struct clk * clk, unsigned long rate);
Tony Lindgren3179a012005-11-10 14:26:48 +000029
Russell Kingd5e60722009-02-08 16:07:46 +000030static int omap1_clk_set_rate_ckctl_arm(struct clk *clk, unsigned long rate);
31static long omap1_clk_round_rate_ckctl_arm(struct clk *clk, unsigned long rate);
32
Tony Lindgren3179a012005-11-10 14:26:48 +000033struct mpu_rate {
34 unsigned long rate;
35 unsigned long xtal;
36 unsigned long pll_rate;
37 __u16 ckctl_val;
38 __u16 dpllctl_val;
39};
40
41struct uart_clk {
42 struct clk clk;
43 unsigned long sysc_addr;
44};
45
46/* Provide a method for preventing idling some ARM IDLECT clocks */
47struct arm_idlect1_clk {
48 struct clk clk;
49 unsigned long no_idle_count;
50 __u8 idlect_shift;
51};
52
53/* ARM_CKCTL bit shifts */
54#define CKCTL_PERDIV_OFFSET 0
55#define CKCTL_LCDDIV_OFFSET 2
56#define CKCTL_ARMDIV_OFFSET 4
57#define CKCTL_DSPDIV_OFFSET 6
58#define CKCTL_TCDIV_OFFSET 8
59#define CKCTL_DSPMMUDIV_OFFSET 10
60/*#define ARM_TIMXO 12*/
61#define EN_DSPCK 13
62/*#define ARM_INTHCK_SEL 14*/ /* Divide-by-2 for mpu inth_ck */
63/* DSP_CKCTL bit shifts */
64#define CKCTL_DSPPERDIV_OFFSET 0
65
66/* ARM_IDLECT2 bit shifts */
67#define EN_WDTCK 0
68#define EN_XORPCK 1
69#define EN_PERCK 2
70#define EN_LCDCK 3
71#define EN_LBCK 4 /* Not on 1610/1710 */
72/*#define EN_HSABCK 5*/
73#define EN_APICK 6
74#define EN_TIMCK 7
75#define DMACK_REQ 8
76#define EN_GPIOCK 9 /* Not on 1610/1710 */
77/*#define EN_LBFREECK 10*/
78#define EN_CKOUT_ARM 11
79
80/* ARM_IDLECT3 bit shifts */
81#define EN_OCPI_CK 0
82#define EN_TC1_CK 2
83#define EN_TC2_CK 4
84
85/* DSP_IDLECT2 bit shifts (0,1,2 are same as for ARM_IDLECT2) */
86#define EN_DSPTIMCK 5
87
88/* Various register defines for clock controls scattered around OMAP chip */
Tony Lindgren90afd5c2006-09-25 13:27:20 +030089#define SDW_MCLK_INV_BIT 2 /* In ULPD_CLKC_CTRL */
Tony Lindgren3179a012005-11-10 14:26:48 +000090#define USB_MCLK_EN_BIT 4 /* In ULPD_CLKC_CTRL */
91#define USB_HOST_HHC_UHOST_EN 9 /* In MOD_CONF_CTRL_0 */
92#define SWD_ULPD_PLL_CLK_REQ 1 /* In SWD_CLK_DIV_CTRL_SEL */
93#define COM_ULPD_PLL_CLK_REQ 1 /* In COM_CLK_DIV_CTRL_SEL */
94#define SWD_CLK_DIV_CTRL_SEL 0xfffe0874
95#define COM_CLK_DIV_CTRL_SEL 0xfffe0878
96#define SOFT_REQ_REG 0xfffe0834
97#define SOFT_REQ_REG2 0xfffe0880
98
99/*-------------------------------------------------------------------------
100 * Omap1 MPU rate table
101 *-------------------------------------------------------------------------*/
102static struct mpu_rate rate_table[] = {
103 /* MPU MHz, xtal MHz, dpll1 MHz, CKCTL, DPLL_CTL
104 * NOTE: Comment order here is different from bits in CKCTL value:
105 * armdiv, dspdiv, dspmmu, tcdiv, perdiv, lcddiv
106 */
107#if defined(CONFIG_OMAP_ARM_216MHZ)
108 { 216000000, 12000000, 216000000, 0x050d, 0x2910 }, /* 1/1/2/2/2/8 */
109#endif
110#if defined(CONFIG_OMAP_ARM_195MHZ)
111 { 195000000, 13000000, 195000000, 0x050e, 0x2790 }, /* 1/1/2/2/4/8 */
112#endif
113#if defined(CONFIG_OMAP_ARM_192MHZ)
114 { 192000000, 19200000, 192000000, 0x050f, 0x2510 }, /* 1/1/2/2/8/8 */
115 { 192000000, 12000000, 192000000, 0x050f, 0x2810 }, /* 1/1/2/2/8/8 */
116 { 96000000, 12000000, 192000000, 0x055f, 0x2810 }, /* 2/2/2/2/8/8 */
117 { 48000000, 12000000, 192000000, 0x0baf, 0x2810 }, /* 4/4/4/8/8/8 */
118 { 24000000, 12000000, 192000000, 0x0fff, 0x2810 }, /* 8/8/8/8/8/8 */
119#endif
120#if defined(CONFIG_OMAP_ARM_182MHZ)
121 { 182000000, 13000000, 182000000, 0x050e, 0x2710 }, /* 1/1/2/2/4/8 */
122#endif
123#if defined(CONFIG_OMAP_ARM_168MHZ)
124 { 168000000, 12000000, 168000000, 0x010f, 0x2710 }, /* 1/1/1/2/8/8 */
125#endif
126#if defined(CONFIG_OMAP_ARM_150MHZ)
127 { 150000000, 12000000, 150000000, 0x010a, 0x2cb0 }, /* 1/1/1/2/4/4 */
128#endif
129#if defined(CONFIG_OMAP_ARM_120MHZ)
130 { 120000000, 12000000, 120000000, 0x010a, 0x2510 }, /* 1/1/1/2/4/4 */
131#endif
132#if defined(CONFIG_OMAP_ARM_96MHZ)
133 { 96000000, 12000000, 96000000, 0x0005, 0x2410 }, /* 1/1/1/1/2/2 */
134#endif
135#if defined(CONFIG_OMAP_ARM_60MHZ)
136 { 60000000, 12000000, 60000000, 0x0005, 0x2290 }, /* 1/1/1/1/2/2 */
137#endif
138#if defined(CONFIG_OMAP_ARM_30MHZ)
139 { 30000000, 12000000, 60000000, 0x0555, 0x2290 }, /* 2/2/2/2/2/2 */
140#endif
141 { 0, 0, 0, 0, 0 },
142};
143
144/*-------------------------------------------------------------------------
145 * Omap1 clocks
146 *-------------------------------------------------------------------------*/
147
148static struct clk ck_ref = {
149 .name = "ck_ref",
Russell King897dcde2008-11-04 16:35:03 +0000150 .ops = &clkops_null,
Tony Lindgren3179a012005-11-10 14:26:48 +0000151 .rate = 12000000,
Tony Lindgren3179a012005-11-10 14:26:48 +0000152};
153
154static struct clk ck_dpll1 = {
155 .name = "ck_dpll1",
Russell King897dcde2008-11-04 16:35:03 +0000156 .ops = &clkops_null,
Tony Lindgren3179a012005-11-10 14:26:48 +0000157 .parent = &ck_ref,
Tony Lindgren3179a012005-11-10 14:26:48 +0000158};
159
160static struct arm_idlect1_clk ck_dpll1out = {
161 .clk = {
Imre Deakdf2c2e72007-03-05 17:22:58 +0200162 .name = "ck_dpll1out",
Russell King548d8492008-11-04 14:02:46 +0000163 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000164 .parent = &ck_dpll1,
Russell King3f0a8202009-01-31 10:05:51 +0000165 .flags = CLOCK_IDLE_CONTROL | ENABLE_REG_32BIT,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700166 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
Tony Lindgren3179a012005-11-10 14:26:48 +0000167 .enable_bit = EN_CKOUT_ARM,
168 .recalc = &followparent_recalc,
Tony Lindgren3179a012005-11-10 14:26:48 +0000169 },
170 .idlect_shift = 12,
171};
172
Imre Deakdf2c2e72007-03-05 17:22:58 +0200173static struct clk sossi_ck = {
174 .name = "ck_sossi",
Russell King548d8492008-11-04 14:02:46 +0000175 .ops = &clkops_generic,
Imre Deakdf2c2e72007-03-05 17:22:58 +0200176 .parent = &ck_dpll1out.clk,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000177 .flags = CLOCK_NO_IDLE_PARENT | ENABLE_REG_32BIT,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700178 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_1),
Imre Deakdf2c2e72007-03-05 17:22:58 +0200179 .enable_bit = 16,
180 .recalc = &omap1_sossi_recalc,
181 .set_rate = &omap1_set_sossi_rate,
Imre Deakdf2c2e72007-03-05 17:22:58 +0200182};
183
Tony Lindgren3179a012005-11-10 14:26:48 +0000184static struct clk arm_ck = {
185 .name = "arm_ck",
Russell King897dcde2008-11-04 16:35:03 +0000186 .ops = &clkops_null,
Tony Lindgren3179a012005-11-10 14:26:48 +0000187 .parent = &ck_dpll1,
Tony Lindgren3179a012005-11-10 14:26:48 +0000188 .rate_offset = CKCTL_ARMDIV_OFFSET,
189 .recalc = &omap1_ckctl_recalc,
Russell Kingd5e60722009-02-08 16:07:46 +0000190 .round_rate = omap1_clk_round_rate_ckctl_arm,
191 .set_rate = omap1_clk_set_rate_ckctl_arm,
Tony Lindgren3179a012005-11-10 14:26:48 +0000192};
193
194static struct arm_idlect1_clk armper_ck = {
195 .clk = {
196 .name = "armper_ck",
Russell King548d8492008-11-04 14:02:46 +0000197 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000198 .parent = &ck_dpll1,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000199 .flags = CLOCK_IDLE_CONTROL,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700200 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
Tony Lindgren3179a012005-11-10 14:26:48 +0000201 .enable_bit = EN_PERCK,
202 .rate_offset = CKCTL_PERDIV_OFFSET,
203 .recalc = &omap1_ckctl_recalc,
Russell Kingd5e60722009-02-08 16:07:46 +0000204 .round_rate = omap1_clk_round_rate_ckctl_arm,
205 .set_rate = omap1_clk_set_rate_ckctl_arm,
Tony Lindgren3179a012005-11-10 14:26:48 +0000206 },
207 .idlect_shift = 2,
208};
209
210static struct clk arm_gpio_ck = {
211 .name = "arm_gpio_ck",
Russell King548d8492008-11-04 14:02:46 +0000212 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000213 .parent = &ck_dpll1,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700214 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
Tony Lindgren3179a012005-11-10 14:26:48 +0000215 .enable_bit = EN_GPIOCK,
216 .recalc = &followparent_recalc,
Tony Lindgren3179a012005-11-10 14:26:48 +0000217};
218
219static struct arm_idlect1_clk armxor_ck = {
220 .clk = {
221 .name = "armxor_ck",
Russell King548d8492008-11-04 14:02:46 +0000222 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000223 .parent = &ck_ref,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000224 .flags = CLOCK_IDLE_CONTROL,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700225 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
Tony Lindgren3179a012005-11-10 14:26:48 +0000226 .enable_bit = EN_XORPCK,
227 .recalc = &followparent_recalc,
Tony Lindgren3179a012005-11-10 14:26:48 +0000228 },
229 .idlect_shift = 1,
230};
231
232static struct arm_idlect1_clk armtim_ck = {
233 .clk = {
234 .name = "armtim_ck",
Russell King548d8492008-11-04 14:02:46 +0000235 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000236 .parent = &ck_ref,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000237 .flags = CLOCK_IDLE_CONTROL,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700238 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
Tony Lindgren3179a012005-11-10 14:26:48 +0000239 .enable_bit = EN_TIMCK,
240 .recalc = &followparent_recalc,
Tony Lindgren3179a012005-11-10 14:26:48 +0000241 },
242 .idlect_shift = 9,
243};
244
245static struct arm_idlect1_clk armwdt_ck = {
246 .clk = {
247 .name = "armwdt_ck",
Russell King548d8492008-11-04 14:02:46 +0000248 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000249 .parent = &ck_ref,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000250 .flags = CLOCK_IDLE_CONTROL,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700251 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
Tony Lindgren3179a012005-11-10 14:26:48 +0000252 .enable_bit = EN_WDTCK,
253 .recalc = &omap1_watchdog_recalc,
Tony Lindgren3179a012005-11-10 14:26:48 +0000254 },
255 .idlect_shift = 0,
256};
257
258static struct clk arminth_ck16xx = {
259 .name = "arminth_ck",
Russell King897dcde2008-11-04 16:35:03 +0000260 .ops = &clkops_null,
Tony Lindgren3179a012005-11-10 14:26:48 +0000261 .parent = &arm_ck,
Tony Lindgren3179a012005-11-10 14:26:48 +0000262 .recalc = &followparent_recalc,
263 /* Note: On 16xx the frequency can be divided by 2 by programming
264 * ARM_CKCTL:ARM_INTHCK_SEL(14) to 1
265 *
266 * 1510 version is in TC clocks.
267 */
Tony Lindgren3179a012005-11-10 14:26:48 +0000268};
269
270static struct clk dsp_ck = {
271 .name = "dsp_ck",
Russell King548d8492008-11-04 14:02:46 +0000272 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000273 .parent = &ck_dpll1,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700274 .enable_reg = OMAP1_IO_ADDRESS(ARM_CKCTL),
Tony Lindgren3179a012005-11-10 14:26:48 +0000275 .enable_bit = EN_DSPCK,
276 .rate_offset = CKCTL_DSPDIV_OFFSET,
277 .recalc = &omap1_ckctl_recalc,
Russell Kingd5e60722009-02-08 16:07:46 +0000278 .round_rate = omap1_clk_round_rate_ckctl_arm,
279 .set_rate = omap1_clk_set_rate_ckctl_arm,
Tony Lindgren3179a012005-11-10 14:26:48 +0000280};
281
282static struct clk dspmmu_ck = {
283 .name = "dspmmu_ck",
Russell King897dcde2008-11-04 16:35:03 +0000284 .ops = &clkops_null,
Tony Lindgren3179a012005-11-10 14:26:48 +0000285 .parent = &ck_dpll1,
Tony Lindgren3179a012005-11-10 14:26:48 +0000286 .rate_offset = CKCTL_DSPMMUDIV_OFFSET,
287 .recalc = &omap1_ckctl_recalc,
Russell Kingd5e60722009-02-08 16:07:46 +0000288 .round_rate = omap1_clk_round_rate_ckctl_arm,
289 .set_rate = omap1_clk_set_rate_ckctl_arm,
Tony Lindgren3179a012005-11-10 14:26:48 +0000290};
291
292static struct clk dspper_ck = {
293 .name = "dspper_ck",
Russell King548d8492008-11-04 14:02:46 +0000294 .ops = &clkops_dspck,
Tony Lindgren3179a012005-11-10 14:26:48 +0000295 .parent = &ck_dpll1,
Russell King397fcaf2008-09-05 15:46:19 +0100296 .enable_reg = DSP_IDLECT2,
Tony Lindgren3179a012005-11-10 14:26:48 +0000297 .enable_bit = EN_PERCK,
298 .rate_offset = CKCTL_PERDIV_OFFSET,
299 .recalc = &omap1_ckctl_recalc_dsp_domain,
Russell Kingd5e60722009-02-08 16:07:46 +0000300 .round_rate = omap1_clk_round_rate_ckctl_arm,
Tony Lindgren3179a012005-11-10 14:26:48 +0000301 .set_rate = &omap1_clk_set_rate_dsp_domain,
Tony Lindgren3179a012005-11-10 14:26:48 +0000302};
303
304static struct clk dspxor_ck = {
305 .name = "dspxor_ck",
Russell King548d8492008-11-04 14:02:46 +0000306 .ops = &clkops_dspck,
Tony Lindgren3179a012005-11-10 14:26:48 +0000307 .parent = &ck_ref,
Russell King397fcaf2008-09-05 15:46:19 +0100308 .enable_reg = DSP_IDLECT2,
Tony Lindgren3179a012005-11-10 14:26:48 +0000309 .enable_bit = EN_XORPCK,
310 .recalc = &followparent_recalc,
Tony Lindgren3179a012005-11-10 14:26:48 +0000311};
312
313static struct clk dsptim_ck = {
314 .name = "dsptim_ck",
Russell King548d8492008-11-04 14:02:46 +0000315 .ops = &clkops_dspck,
Tony Lindgren3179a012005-11-10 14:26:48 +0000316 .parent = &ck_ref,
Russell King397fcaf2008-09-05 15:46:19 +0100317 .enable_reg = DSP_IDLECT2,
Tony Lindgren3179a012005-11-10 14:26:48 +0000318 .enable_bit = EN_DSPTIMCK,
319 .recalc = &followparent_recalc,
Tony Lindgren3179a012005-11-10 14:26:48 +0000320};
321
322/* Tie ARM_IDLECT1:IDLIF_ARM to this logical clock structure */
323static struct arm_idlect1_clk tc_ck = {
324 .clk = {
325 .name = "tc_ck",
Russell King897dcde2008-11-04 16:35:03 +0000326 .ops = &clkops_null,
Tony Lindgren3179a012005-11-10 14:26:48 +0000327 .parent = &ck_dpll1,
Russell King3f0a8202009-01-31 10:05:51 +0000328 .flags = CLOCK_IDLE_CONTROL,
Tony Lindgren3179a012005-11-10 14:26:48 +0000329 .rate_offset = CKCTL_TCDIV_OFFSET,
330 .recalc = &omap1_ckctl_recalc,
Russell Kingd5e60722009-02-08 16:07:46 +0000331 .round_rate = omap1_clk_round_rate_ckctl_arm,
332 .set_rate = omap1_clk_set_rate_ckctl_arm,
Tony Lindgren3179a012005-11-10 14:26:48 +0000333 },
334 .idlect_shift = 6,
335};
336
337static struct clk arminth_ck1510 = {
338 .name = "arminth_ck",
Russell King897dcde2008-11-04 16:35:03 +0000339 .ops = &clkops_null,
Tony Lindgren3179a012005-11-10 14:26:48 +0000340 .parent = &tc_ck.clk,
Tony Lindgren3179a012005-11-10 14:26:48 +0000341 .recalc = &followparent_recalc,
342 /* Note: On 1510 the frequency follows TC_CK
343 *
344 * 16xx version is in MPU clocks.
345 */
Tony Lindgren3179a012005-11-10 14:26:48 +0000346};
347
348static struct clk tipb_ck = {
349 /* No-idle controlled by "tc_ck" */
Marek Vasut6017e292006-12-06 17:13:55 -0800350 .name = "tipb_ck",
Russell King897dcde2008-11-04 16:35:03 +0000351 .ops = &clkops_null,
Tony Lindgren3179a012005-11-10 14:26:48 +0000352 .parent = &tc_ck.clk,
Tony Lindgren3179a012005-11-10 14:26:48 +0000353 .recalc = &followparent_recalc,
Tony Lindgren3179a012005-11-10 14:26:48 +0000354};
355
356static struct clk l3_ocpi_ck = {
357 /* No-idle controlled by "tc_ck" */
358 .name = "l3_ocpi_ck",
Russell King548d8492008-11-04 14:02:46 +0000359 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000360 .parent = &tc_ck.clk,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700361 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3),
Tony Lindgren3179a012005-11-10 14:26:48 +0000362 .enable_bit = EN_OCPI_CK,
363 .recalc = &followparent_recalc,
Tony Lindgren3179a012005-11-10 14:26:48 +0000364};
365
366static struct clk tc1_ck = {
367 .name = "tc1_ck",
Russell King548d8492008-11-04 14:02:46 +0000368 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000369 .parent = &tc_ck.clk,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700370 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3),
Tony Lindgren3179a012005-11-10 14:26:48 +0000371 .enable_bit = EN_TC1_CK,
372 .recalc = &followparent_recalc,
Tony Lindgren3179a012005-11-10 14:26:48 +0000373};
374
375static struct clk tc2_ck = {
376 .name = "tc2_ck",
Russell King548d8492008-11-04 14:02:46 +0000377 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000378 .parent = &tc_ck.clk,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700379 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3),
Tony Lindgren3179a012005-11-10 14:26:48 +0000380 .enable_bit = EN_TC2_CK,
381 .recalc = &followparent_recalc,
Tony Lindgren3179a012005-11-10 14:26:48 +0000382};
383
384static struct clk dma_ck = {
385 /* No-idle controlled by "tc_ck" */
386 .name = "dma_ck",
Russell King897dcde2008-11-04 16:35:03 +0000387 .ops = &clkops_null,
Tony Lindgren3179a012005-11-10 14:26:48 +0000388 .parent = &tc_ck.clk,
Tony Lindgren3179a012005-11-10 14:26:48 +0000389 .recalc = &followparent_recalc,
Tony Lindgren3179a012005-11-10 14:26:48 +0000390};
391
392static struct clk dma_lcdfree_ck = {
393 .name = "dma_lcdfree_ck",
Russell King897dcde2008-11-04 16:35:03 +0000394 .ops = &clkops_null,
Tony Lindgren3179a012005-11-10 14:26:48 +0000395 .parent = &tc_ck.clk,
Tony Lindgren3179a012005-11-10 14:26:48 +0000396 .recalc = &followparent_recalc,
Tony Lindgren3179a012005-11-10 14:26:48 +0000397};
398
399static struct arm_idlect1_clk api_ck = {
400 .clk = {
401 .name = "api_ck",
Russell King548d8492008-11-04 14:02:46 +0000402 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000403 .parent = &tc_ck.clk,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000404 .flags = CLOCK_IDLE_CONTROL,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700405 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
Tony Lindgren3179a012005-11-10 14:26:48 +0000406 .enable_bit = EN_APICK,
407 .recalc = &followparent_recalc,
Tony Lindgren3179a012005-11-10 14:26:48 +0000408 },
409 .idlect_shift = 8,
410};
411
412static struct arm_idlect1_clk lb_ck = {
413 .clk = {
414 .name = "lb_ck",
Russell King548d8492008-11-04 14:02:46 +0000415 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000416 .parent = &tc_ck.clk,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000417 .flags = CLOCK_IDLE_CONTROL,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700418 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
Tony Lindgren3179a012005-11-10 14:26:48 +0000419 .enable_bit = EN_LBCK,
420 .recalc = &followparent_recalc,
Tony Lindgren3179a012005-11-10 14:26:48 +0000421 },
422 .idlect_shift = 4,
423};
424
425static struct clk rhea1_ck = {
426 .name = "rhea1_ck",
Russell King897dcde2008-11-04 16:35:03 +0000427 .ops = &clkops_null,
Tony Lindgren3179a012005-11-10 14:26:48 +0000428 .parent = &tc_ck.clk,
Tony Lindgren3179a012005-11-10 14:26:48 +0000429 .recalc = &followparent_recalc,
Tony Lindgren3179a012005-11-10 14:26:48 +0000430};
431
432static struct clk rhea2_ck = {
433 .name = "rhea2_ck",
Russell King897dcde2008-11-04 16:35:03 +0000434 .ops = &clkops_null,
Tony Lindgren3179a012005-11-10 14:26:48 +0000435 .parent = &tc_ck.clk,
Tony Lindgren3179a012005-11-10 14:26:48 +0000436 .recalc = &followparent_recalc,
Tony Lindgren3179a012005-11-10 14:26:48 +0000437};
438
439static struct clk lcd_ck_16xx = {
440 .name = "lcd_ck",
Russell King548d8492008-11-04 14:02:46 +0000441 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000442 .parent = &ck_dpll1,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700443 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
Tony Lindgren3179a012005-11-10 14:26:48 +0000444 .enable_bit = EN_LCDCK,
445 .rate_offset = CKCTL_LCDDIV_OFFSET,
446 .recalc = &omap1_ckctl_recalc,
Russell Kingd5e60722009-02-08 16:07:46 +0000447 .round_rate = omap1_clk_round_rate_ckctl_arm,
448 .set_rate = omap1_clk_set_rate_ckctl_arm,
Tony Lindgren3179a012005-11-10 14:26:48 +0000449};
450
451static struct arm_idlect1_clk lcd_ck_1510 = {
452 .clk = {
453 .name = "lcd_ck",
Russell King548d8492008-11-04 14:02:46 +0000454 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000455 .parent = &ck_dpll1,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000456 .flags = CLOCK_IDLE_CONTROL,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700457 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
Tony Lindgren3179a012005-11-10 14:26:48 +0000458 .enable_bit = EN_LCDCK,
459 .rate_offset = CKCTL_LCDDIV_OFFSET,
460 .recalc = &omap1_ckctl_recalc,
Russell Kingd5e60722009-02-08 16:07:46 +0000461 .round_rate = omap1_clk_round_rate_ckctl_arm,
462 .set_rate = omap1_clk_set_rate_ckctl_arm,
Tony Lindgren3179a012005-11-10 14:26:48 +0000463 },
464 .idlect_shift = 3,
465};
466
467static struct clk uart1_1510 = {
468 .name = "uart1_ck",
Russell King897dcde2008-11-04 16:35:03 +0000469 .ops = &clkops_null,
Tony Lindgren3179a012005-11-10 14:26:48 +0000470 /* Direct from ULPD, no real parent */
471 .parent = &armper_ck.clk,
472 .rate = 12000000,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000473 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700474 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
Tony Lindgren3179a012005-11-10 14:26:48 +0000475 .enable_bit = 29, /* Chooses between 12MHz and 48MHz */
476 .set_rate = &omap1_set_uart_rate,
477 .recalc = &omap1_uart_recalc,
Tony Lindgren3179a012005-11-10 14:26:48 +0000478};
479
480static struct uart_clk uart1_16xx = {
481 .clk = {
482 .name = "uart1_ck",
Russell King548d8492008-11-04 14:02:46 +0000483 .ops = &clkops_uart,
Tony Lindgren3179a012005-11-10 14:26:48 +0000484 /* Direct from ULPD, no real parent */
485 .parent = &armper_ck.clk,
486 .rate = 48000000,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000487 .flags = RATE_FIXED | ENABLE_REG_32BIT |
488 CLOCK_NO_IDLE_PARENT,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700489 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
Tony Lindgren3179a012005-11-10 14:26:48 +0000490 .enable_bit = 29,
Tony Lindgren3179a012005-11-10 14:26:48 +0000491 },
492 .sysc_addr = 0xfffb0054,
493};
494
495static struct clk uart2_ck = {
496 .name = "uart2_ck",
Russell King897dcde2008-11-04 16:35:03 +0000497 .ops = &clkops_null,
Tony Lindgren3179a012005-11-10 14:26:48 +0000498 /* Direct from ULPD, no real parent */
499 .parent = &armper_ck.clk,
500 .rate = 12000000,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000501 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700502 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
Tony Lindgren3179a012005-11-10 14:26:48 +0000503 .enable_bit = 30, /* Chooses between 12MHz and 48MHz */
504 .set_rate = &omap1_set_uart_rate,
505 .recalc = &omap1_uart_recalc,
Tony Lindgren3179a012005-11-10 14:26:48 +0000506};
507
508static struct clk uart3_1510 = {
509 .name = "uart3_ck",
Russell King897dcde2008-11-04 16:35:03 +0000510 .ops = &clkops_null,
Tony Lindgren3179a012005-11-10 14:26:48 +0000511 /* Direct from ULPD, no real parent */
512 .parent = &armper_ck.clk,
513 .rate = 12000000,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000514 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700515 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
Tony Lindgren3179a012005-11-10 14:26:48 +0000516 .enable_bit = 31, /* Chooses between 12MHz and 48MHz */
517 .set_rate = &omap1_set_uart_rate,
518 .recalc = &omap1_uart_recalc,
Tony Lindgren3179a012005-11-10 14:26:48 +0000519};
520
521static struct uart_clk uart3_16xx = {
522 .clk = {
523 .name = "uart3_ck",
Russell King548d8492008-11-04 14:02:46 +0000524 .ops = &clkops_uart,
Tony Lindgren3179a012005-11-10 14:26:48 +0000525 /* Direct from ULPD, no real parent */
526 .parent = &armper_ck.clk,
527 .rate = 48000000,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000528 .flags = RATE_FIXED | ENABLE_REG_32BIT |
529 CLOCK_NO_IDLE_PARENT,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700530 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
Tony Lindgren3179a012005-11-10 14:26:48 +0000531 .enable_bit = 31,
Tony Lindgren3179a012005-11-10 14:26:48 +0000532 },
533 .sysc_addr = 0xfffb9854,
534};
535
536static struct clk usb_clko = { /* 6 MHz output on W4_USB_CLKO */
537 .name = "usb_clko",
Russell King548d8492008-11-04 14:02:46 +0000538 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000539 /* Direct from ULPD, no parent */
540 .rate = 6000000,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000541 .flags = RATE_FIXED | ENABLE_REG_32BIT,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700542 .enable_reg = OMAP1_IO_ADDRESS(ULPD_CLOCK_CTRL),
Tony Lindgren3179a012005-11-10 14:26:48 +0000543 .enable_bit = USB_MCLK_EN_BIT,
Tony Lindgren3179a012005-11-10 14:26:48 +0000544};
545
546static struct clk usb_hhc_ck1510 = {
547 .name = "usb_hhc_ck",
Russell King548d8492008-11-04 14:02:46 +0000548 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000549 /* Direct from ULPD, no parent */
550 .rate = 48000000, /* Actually 2 clocks, 12MHz and 48MHz */
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000551 .flags = RATE_FIXED | ENABLE_REG_32BIT,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700552 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
Tony Lindgren3179a012005-11-10 14:26:48 +0000553 .enable_bit = USB_HOST_HHC_UHOST_EN,
Tony Lindgren3179a012005-11-10 14:26:48 +0000554};
555
556static struct clk usb_hhc_ck16xx = {
557 .name = "usb_hhc_ck",
Russell King548d8492008-11-04 14:02:46 +0000558 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000559 /* Direct from ULPD, no parent */
560 .rate = 48000000,
561 /* OTG_SYSCON_2.OTG_PADEN == 0 (not 1510-compatible) */
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000562 .flags = RATE_FIXED | ENABLE_REG_32BIT,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700563 .enable_reg = OMAP1_IO_ADDRESS(OTG_BASE + 0x08), /* OTG_SYSCON_2 */
Tony Lindgren3179a012005-11-10 14:26:48 +0000564 .enable_bit = 8 /* UHOST_EN */,
Tony Lindgren3179a012005-11-10 14:26:48 +0000565};
566
567static struct clk usb_dc_ck = {
568 .name = "usb_dc_ck",
Russell King548d8492008-11-04 14:02:46 +0000569 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000570 /* Direct from ULPD, no parent */
571 .rate = 48000000,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000572 .flags = RATE_FIXED,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700573 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
Tony Lindgren3179a012005-11-10 14:26:48 +0000574 .enable_bit = 4,
Tony Lindgren3179a012005-11-10 14:26:48 +0000575};
576
577static struct clk mclk_1510 = {
578 .name = "mclk",
Russell King548d8492008-11-04 14:02:46 +0000579 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000580 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
581 .rate = 12000000,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000582 .flags = RATE_FIXED,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700583 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
584 .enable_bit = 6,
Tony Lindgren3179a012005-11-10 14:26:48 +0000585};
586
587static struct clk mclk_16xx = {
588 .name = "mclk",
Russell King548d8492008-11-04 14:02:46 +0000589 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000590 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700591 .enable_reg = OMAP1_IO_ADDRESS(COM_CLK_DIV_CTRL_SEL),
Tony Lindgren3179a012005-11-10 14:26:48 +0000592 .enable_bit = COM_ULPD_PLL_CLK_REQ,
593 .set_rate = &omap1_set_ext_clk_rate,
594 .round_rate = &omap1_round_ext_clk_rate,
595 .init = &omap1_init_ext_clk,
Tony Lindgren3179a012005-11-10 14:26:48 +0000596};
597
598static struct clk bclk_1510 = {
599 .name = "bclk",
Russell King548d8492008-11-04 14:02:46 +0000600 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000601 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
602 .rate = 12000000,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000603 .flags = RATE_FIXED,
Tony Lindgren3179a012005-11-10 14:26:48 +0000604};
605
606static struct clk bclk_16xx = {
607 .name = "bclk",
Russell King548d8492008-11-04 14:02:46 +0000608 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000609 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700610 .enable_reg = OMAP1_IO_ADDRESS(SWD_CLK_DIV_CTRL_SEL),
Tony Lindgren3179a012005-11-10 14:26:48 +0000611 .enable_bit = SWD_ULPD_PLL_CLK_REQ,
612 .set_rate = &omap1_set_ext_clk_rate,
613 .round_rate = &omap1_round_ext_clk_rate,
614 .init = &omap1_init_ext_clk,
Tony Lindgren3179a012005-11-10 14:26:48 +0000615};
616
617static struct clk mmc1_ck = {
Tony Lindgrenb824efa2006-04-02 17:46:20 +0100618 .name = "mmc_ck",
Russell King548d8492008-11-04 14:02:46 +0000619 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000620 /* Functional clock is direct from ULPD, interface clock is ARMPER */
621 .parent = &armper_ck.clk,
622 .rate = 48000000,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000623 .flags = RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700624 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
Tony Lindgren3179a012005-11-10 14:26:48 +0000625 .enable_bit = 23,
Tony Lindgren3179a012005-11-10 14:26:48 +0000626};
627
628static struct clk mmc2_ck = {
Tony Lindgrenb824efa2006-04-02 17:46:20 +0100629 .name = "mmc_ck",
Tony Lindgrend8874662008-12-10 17:37:16 -0800630 .id = 1,
Russell King548d8492008-11-04 14:02:46 +0000631 .ops = &clkops_generic,
Tony Lindgren3179a012005-11-10 14:26:48 +0000632 /* Functional clock is direct from ULPD, interface clock is ARMPER */
633 .parent = &armper_ck.clk,
634 .rate = 48000000,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000635 .flags = RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
Tony Lindgrenfed415e2009-01-28 12:18:48 -0700636 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
Tony Lindgren3179a012005-11-10 14:26:48 +0000637 .enable_bit = 20,
Tony Lindgren3179a012005-11-10 14:26:48 +0000638};
639
640static struct clk virtual_ck_mpu = {
641 .name = "mpu",
Russell King897dcde2008-11-04 16:35:03 +0000642 .ops = &clkops_null,
Tony Lindgren3179a012005-11-10 14:26:48 +0000643 .parent = &arm_ck, /* Is smarter alias for */
644 .recalc = &followparent_recalc,
645 .set_rate = &omap1_select_table_rate,
646 .round_rate = &omap1_round_to_table_rate,
Tony Lindgren3179a012005-11-10 14:26:48 +0000647};
648
Tony Lindgrenb824efa2006-04-02 17:46:20 +0100649/* virtual functional clock domain for I2C. Just for making sure that ARMXOR_CK
650remains active during MPU idle whenever this is enabled */
651static struct clk i2c_fck = {
652 .name = "i2c_fck",
653 .id = 1,
Russell King897dcde2008-11-04 16:35:03 +0000654 .ops = &clkops_null,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000655 .flags = CLOCK_NO_IDLE_PARENT,
Tony Lindgrenb824efa2006-04-02 17:46:20 +0100656 .parent = &armxor_ck.clk,
657 .recalc = &followparent_recalc,
Tony Lindgrenb824efa2006-04-02 17:46:20 +0100658};
659
Tony Lindgren90afd5c2006-09-25 13:27:20 +0300660static struct clk i2c_ick = {
661 .name = "i2c_ick",
662 .id = 1,
Russell King897dcde2008-11-04 16:35:03 +0000663 .ops = &clkops_null,
Russell Kingd7e8f1f2009-01-18 23:03:15 +0000664 .flags = CLOCK_NO_IDLE_PARENT,
Tony Lindgren90afd5c2006-09-25 13:27:20 +0300665 .parent = &armper_ck.clk,
666 .recalc = &followparent_recalc,
Tony Lindgren90afd5c2006-09-25 13:27:20 +0300667};
668
Tony Lindgren3179a012005-11-10 14:26:48 +0000669#endif