clock2420_data.c 57.2 KB
Newer Older
1
/*
2
 *  linux/arch/arm/mach-omap2/clock2420_data.c
3
 *
4
 *  Copyright (C) 2005-2009 Texas Instruments, Inc.
5
 *  Copyright (C) 2004-2010 Nokia Corporation
6
 *
7 8 9
 *  Contacts:
 *  Richard Woodruff <r-woodruff2@ti.com>
 *  Paul Walmsley
10 11 12 13 14 15
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

16 17
#include <linux/kernel.h>
#include <linux/clk.h>
18
#include <linux/list.h>
19

20
#include <plat/clkdev_omap.h>
21

22 23 24
#include "clock.h"
#include "clock2xxx.h"
#include "opp2xxx.h"
25 26
#include "cm2xxx_3xxx.h"
#include "prm2xxx_3xxx.h"
27 28 29
#include "prm-regbits-24xx.h"
#include "cm-regbits-24xx.h"
#include "sdrc.h"
30
#include "control.h"
31

32 33 34 35
#define OMAP_CM_REGADDR                 OMAP2420_CM_REGADDR

/*
 * 2420 clock tree.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
 *
 * NOTE:In many cases here we are assigning a 'default' parent.	In many
 *	cases the parent is selectable.	The get/set parent calls will also
 *	switch sources.
 *
 *	Many some clocks say always_enabled, but they can be auto idled for
 *	power savings. They will always be available upon clock request.
 *
 *	Several sources are given initial rates which may be wrong, this will
 *	be fixed up in the init func.
 *
 *	Things are broadly separated below by clock domains. It is
 *	noteworthy that most periferals have dependencies on multiple clock
 *	domains. Many get their interface clocks from the L4 domain, but get
 *	functional clocks from fixed sources or other core domain derived
 *	clocks.
52
 */
53 54 55 56

/* Base external input clocks */
static struct clk func_32k_ck = {
	.name		= "func_32k_ck",
57
	.ops		= &clkops_null,
58
	.rate		= 32000,
59
	.clkdm_name	= "wkup_clkdm",
60
};
61

62 63 64 65 66 67 68
static struct clk secure_32k_ck = {
	.name		= "secure_32k_ck",
	.ops		= &clkops_null,
	.rate		= 32768,
	.clkdm_name	= "wkup_clkdm",
};

69 70 71
/* Typical 12/13MHz in standalone mode, will be 26Mhz in chassis mode */
static struct clk osc_ck = {		/* (*12, *13, 19.2, *26, 38.4)MHz */
	.name		= "osc_ck",
72
	.ops		= &clkops_oscck,
73
	.clkdm_name	= "wkup_clkdm",
74
	.recalc		= &omap2_osc_clk_recalc,
75 76
};

77
/* Without modem likely 12MHz, with modem likely 13MHz */
78 79
static struct clk sys_ck = {		/* (*12, *13, 19.2, 26, 38.4)MHz */
	.name		= "sys_ck",		/* ~ ref_clk also */
80
	.ops		= &clkops_null,
81
	.parent		= &osc_ck,
82
	.clkdm_name	= "wkup_clkdm",
83
	.recalc		= &omap2xxx_sys_clk_recalc,
84
};
85

86 87
static struct clk alt_ck = {		/* Typical 54M or 48M, may not exist */
	.name		= "alt_ck",
88
	.ops		= &clkops_null,
89
	.rate		= 54000000,
90
	.clkdm_name	= "wkup_clkdm",
91
};
92

93 94 95 96 97 98
/* Optional external clock input for McBSP CLKS */
static struct clk mcbsp_clks = {
	.name		= "mcbsp_clks",
	.ops		= &clkops_null,
};

99 100 101 102 103
/*
 * Analog domain root source clocks
 */

/* dpll_ck, is broken out in to special cases through clksel */
104 105 106 107
/* REVISIT: Rate changes on dpll_ck trigger a full set change.	...
 * deal with this
 */

108
static struct dpll_data dpll_dd = {
109 110 111
	.mult_div1_reg		= OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
	.mult_mask		= OMAP24XX_DPLL_MULT_MASK,
	.div1_mask		= OMAP24XX_DPLL_DIV_MASK,
112 113 114 115
	.clk_bypass		= &sys_ck,
	.clk_ref		= &sys_ck,
	.control_reg		= OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
	.enable_mask		= OMAP24XX_EN_DPLL_MASK,
116
	.max_multiplier		= 1023,
117
	.min_divider		= 1,
118 119
	.max_divider		= 16,
	.rate_tolerance		= DEFAULT_DPLL_RATE_TOLERANCE
120 121
};

122 123 124 125
/*
 * XXX Cannot add round_rate here yet, as this is still a composite clock,
 * not just a DPLL
 */
126 127
static struct clk dpll_ck = {
	.name		= "dpll_ck",
128
	.ops		= &clkops_null,
129
	.parent		= &sys_ck,		/* Can be func_32k also */
130
	.dpll_data	= &dpll_dd,
131
	.clkdm_name	= "wkup_clkdm",
132 133
	.recalc		= &omap2_dpllcore_recalc,
	.set_rate	= &omap2_reprogram_dpllcore,
134 135 136 137
};

static struct clk apll96_ck = {
	.name		= "apll96_ck",
138
	.ops		= &clkops_apll96,
139 140
	.parent		= &sys_ck,
	.rate		= 96000000,
141
	.flags		= ENABLE_ON_INIT,
142
	.clkdm_name	= "wkup_clkdm",
143 144
	.enable_reg	= OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
	.enable_bit	= OMAP24XX_EN_96M_PLL_SHIFT,
145 146 147 148
};

static struct clk apll54_ck = {
	.name		= "apll54_ck",
149
	.ops		= &clkops_apll54,
150 151
	.parent		= &sys_ck,
	.rate		= 54000000,
152
	.flags		= ENABLE_ON_INIT,
153
	.clkdm_name	= "wkup_clkdm",
154 155
	.enable_reg	= OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
	.enable_bit	= OMAP24XX_EN_54M_PLL_SHIFT,
156 157 158 159 160
};

/*
 * PRCM digital base sources
 */
161 162 163 164

/* func_54m_ck */

static const struct clksel_rate func_54m_apll54_rates[] = {
165
	{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
166 167 168 169
	{ .div = 0 },
};

static const struct clksel_rate func_54m_alt_rates[] = {
170
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
171 172 173 174 175 176 177 178 179
	{ .div = 0 },
};

static const struct clksel func_54m_clksel[] = {
	{ .parent = &apll54_ck, .rates = func_54m_apll54_rates, },
	{ .parent = &alt_ck,	.rates = func_54m_alt_rates, },
	{ .parent = NULL },
};

180 181
static struct clk func_54m_ck = {
	.name		= "func_54m_ck",
182
	.ops		= &clkops_null,
183
	.parent		= &apll54_ck,	/* can also be alt_clk */
184
	.clkdm_name	= "wkup_clkdm",
185 186
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
187
	.clksel_mask	= OMAP24XX_54M_SOURCE_MASK,
188 189
	.clksel		= func_54m_clksel,
	.recalc		= &omap2_clksel_recalc,
190
};
191

192 193
static struct clk core_ck = {
	.name		= "core_ck",
194
	.ops		= &clkops_null,
195
	.parent		= &dpll_ck,		/* can also be 32k */
196
	.clkdm_name	= "wkup_clkdm",
197
	.recalc		= &followparent_recalc,
198
};
199

200 201
static struct clk func_96m_ck = {
	.name		= "func_96m_ck",
202
	.ops		= &clkops_null,
203
	.parent		= &apll96_ck,
204
	.clkdm_name	= "wkup_clkdm",
205
	.recalc		= &followparent_recalc,
206 207 208 209 210
};

/* func_48m_ck */

static const struct clksel_rate func_48m_apll96_rates[] = {
211
	{ .div = 2, .val = 0, .flags = RATE_IN_24XX },
212 213 214 215
	{ .div = 0 },
};

static const struct clksel_rate func_48m_alt_rates[] = {
216
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
217 218 219 220 221 222 223
	{ .div = 0 },
};

static const struct clksel func_48m_clksel[] = {
	{ .parent = &apll96_ck,	.rates = func_48m_apll96_rates },
	{ .parent = &alt_ck, .rates = func_48m_alt_rates },
	{ .parent = NULL }
224 225 226 227
};

static struct clk func_48m_ck = {
	.name		= "func_48m_ck",
228
	.ops		= &clkops_null,
229
	.parent		= &apll96_ck,	 /* 96M or Alt */
230
	.clkdm_name	= "wkup_clkdm",
231 232
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
233
	.clksel_mask	= OMAP24XX_48M_SOURCE_MASK,
234 235 236 237
	.clksel		= func_48m_clksel,
	.recalc		= &omap2_clksel_recalc,
	.round_rate	= &omap2_clksel_round_rate,
	.set_rate	= &omap2_clksel_set_rate
238 239 240 241
};

static struct clk func_12m_ck = {
	.name		= "func_12m_ck",
242
	.ops		= &clkops_null,
243
	.parent		= &func_48m_ck,
244
	.fixed_div	= 4,
245
	.clkdm_name	= "wkup_clkdm",
246
	.recalc		= &omap_fixed_divisor_recalc,
247 248 249 250 251
};

/* Secure timer, only available in secure mode */
static struct clk wdt1_osc_ck = {
	.name		= "ck_wdt1_osc",
252
	.ops		= &clkops_null, /* RMK: missing? */
253
	.parent		= &osc_ck,
254 255 256 257 258 259 260 261 262 263 264 265
	.recalc		= &followparent_recalc,
};

/*
 * The common_clkout* clksel_rate structs are common to
 * sys_clkout, sys_clkout_src, sys_clkout2, and sys_clkout2_src.
 * sys_clkout2_* are 2420-only, so the
 * clksel_rate flags fields are inaccurate for those clocks. This is
 * harmless since access to those clocks are gated by the struct clk
 * flags fields, which mark them as 2420-only.
 */
static const struct clksel_rate common_clkout_src_core_rates[] = {
266
	{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
267 268 269 270
	{ .div = 0 }
};

static const struct clksel_rate common_clkout_src_sys_rates[] = {
271
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
272 273 274 275
	{ .div = 0 }
};

static const struct clksel_rate common_clkout_src_96m_rates[] = {
276
	{ .div = 1, .val = 2, .flags = RATE_IN_24XX },
277 278 279 280
	{ .div = 0 }
};

static const struct clksel_rate common_clkout_src_54m_rates[] = {
281
	{ .div = 1, .val = 3, .flags = RATE_IN_24XX },
282 283 284 285 286 287 288 289 290 291 292 293 294
	{ .div = 0 }
};

static const struct clksel common_clkout_src_clksel[] = {
	{ .parent = &core_ck,	  .rates = common_clkout_src_core_rates },
	{ .parent = &sys_ck,	  .rates = common_clkout_src_sys_rates },
	{ .parent = &func_96m_ck, .rates = common_clkout_src_96m_rates },
	{ .parent = &func_54m_ck, .rates = common_clkout_src_54m_rates },
	{ .parent = NULL }
};

static struct clk sys_clkout_src = {
	.name		= "sys_clkout_src",
295
	.ops		= &clkops_omap2_dflt,
296
	.parent		= &func_54m_ck,
297
	.clkdm_name	= "wkup_clkdm",
298
	.enable_reg	= OMAP2420_PRCM_CLKOUT_CTRL,
299 300
	.enable_bit	= OMAP24XX_CLKOUT_EN_SHIFT,
	.init		= &omap2_init_clksel_parent,
301
	.clksel_reg	= OMAP2420_PRCM_CLKOUT_CTRL,
302 303 304 305 306 307 308 309
	.clksel_mask	= OMAP24XX_CLKOUT_SOURCE_MASK,
	.clksel		= common_clkout_src_clksel,
	.recalc		= &omap2_clksel_recalc,
	.round_rate	= &omap2_clksel_round_rate,
	.set_rate	= &omap2_clksel_set_rate
};

static const struct clksel_rate common_clkout_rates[] = {
310
	{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
311 312 313 314 315 316 317 318 319 320
	{ .div = 2, .val = 1, .flags = RATE_IN_24XX },
	{ .div = 4, .val = 2, .flags = RATE_IN_24XX },
	{ .div = 8, .val = 3, .flags = RATE_IN_24XX },
	{ .div = 16, .val = 4, .flags = RATE_IN_24XX },
	{ .div = 0 },
};

static const struct clksel sys_clkout_clksel[] = {
	{ .parent = &sys_clkout_src, .rates = common_clkout_rates },
	{ .parent = NULL }
321 322 323 324
};

static struct clk sys_clkout = {
	.name		= "sys_clkout",
325
	.ops		= &clkops_null,
326
	.parent		= &sys_clkout_src,
327
	.clkdm_name	= "wkup_clkdm",
328
	.clksel_reg	= OMAP2420_PRCM_CLKOUT_CTRL,
329 330 331 332 333 334 335 336 337 338
	.clksel_mask	= OMAP24XX_CLKOUT_DIV_MASK,
	.clksel		= sys_clkout_clksel,
	.recalc		= &omap2_clksel_recalc,
	.round_rate	= &omap2_clksel_round_rate,
	.set_rate	= &omap2_clksel_set_rate
};

/* In 2430, new in 2420 ES2 */
static struct clk sys_clkout2_src = {
	.name		= "sys_clkout2_src",
339
	.ops		= &clkops_omap2_dflt,
340
	.parent		= &func_54m_ck,
341
	.clkdm_name	= "wkup_clkdm",
342
	.enable_reg	= OMAP2420_PRCM_CLKOUT_CTRL,
343 344
	.enable_bit	= OMAP2420_CLKOUT2_EN_SHIFT,
	.init		= &omap2_init_clksel_parent,
345
	.clksel_reg	= OMAP2420_PRCM_CLKOUT_CTRL,
346 347
	.clksel_mask	= OMAP2420_CLKOUT2_SOURCE_MASK,
	.clksel		= common_clkout_src_clksel,
348
	.recalc		= &omap2_clksel_recalc,
349 350 351 352 353 354 355
	.round_rate	= &omap2_clksel_round_rate,
	.set_rate	= &omap2_clksel_set_rate
};

static const struct clksel sys_clkout2_clksel[] = {
	{ .parent = &sys_clkout2_src, .rates = common_clkout_rates },
	{ .parent = NULL }
356 357 358 359 360
};

/* In 2430, new in 2420 ES2 */
static struct clk sys_clkout2 = {
	.name		= "sys_clkout2",
361
	.ops		= &clkops_null,
362
	.parent		= &sys_clkout2_src,
363
	.clkdm_name	= "wkup_clkdm",
364
	.clksel_reg	= OMAP2420_PRCM_CLKOUT_CTRL,
365 366
	.clksel_mask	= OMAP2420_CLKOUT2_DIV_MASK,
	.clksel		= sys_clkout2_clksel,
367
	.recalc		= &omap2_clksel_recalc,
368 369
	.round_rate	= &omap2_clksel_round_rate,
	.set_rate	= &omap2_clksel_set_rate
370 371
};

372 373
static struct clk emul_ck = {
	.name		= "emul_ck",
374
	.ops		= &clkops_omap2_dflt,
375
	.parent		= &func_54m_ck,
376
	.clkdm_name	= "wkup_clkdm",
377
	.enable_reg	= OMAP2420_PRCM_CLKEMUL_CTRL,
378 379
	.enable_bit	= OMAP24XX_EMULATION_EN_SHIFT,
	.recalc		= &followparent_recalc,
380 381

};
382

383 384 385 386 387 388 389 390 391 392
/*
 * MPU clock domain
 *	Clocks:
 *		MPU_FCLK, MPU_ICLK
 *		INT_M_FCLK, INT_M_I_CLK
 *
 * - Individual clocks are hardware managed.
 * - Base divider comes from: CM_CLKSEL_MPU
 *
 */
393
static const struct clksel_rate mpu_core_rates[] = {
394
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
395 396 397 398 399 400 401 402 403 404 405 406
	{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
	{ .div = 4, .val = 4, .flags = RATE_IN_242X },
	{ .div = 6, .val = 6, .flags = RATE_IN_242X },
	{ .div = 8, .val = 8, .flags = RATE_IN_242X },
	{ .div = 0 },
};

static const struct clksel mpu_clksel[] = {
	{ .parent = &core_ck, .rates = mpu_core_rates },
	{ .parent = NULL }
};

407 408
static struct clk mpu_ck = {	/* Control cpu */
	.name		= "mpu_ck",
409
	.ops		= &clkops_null,
410
	.parent		= &core_ck,
411
	.clkdm_name	= "mpu_clkdm",
412 413 414
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL),
	.clksel_mask	= OMAP24XX_CLKSEL_MPU_MASK,
415
	.clksel		= mpu_clksel,
416 417
	.recalc		= &omap2_clksel_recalc,
};
418

419
/*
420
 * DSP (2420-UMA+IVA1) clock domain
421 422
 * Clocks:
 *	2420: UMA_FCLK, UMA_ICLK, IVA_MPU, IVA_COP
423 424 425 426 427
 *
 * Won't be too specific here. The core clock comes into this block
 * it is divided then tee'ed. One branch goes directly to xyz enable
 * controls. The other branch gets further divided by 2 then possibly
 * routed into a synchronizer and out of clocks abc.
428
 */
429
static const struct clksel_rate dsp_fck_core_rates[] = {
430
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446
	{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
	{ .div = 3, .val = 3, .flags = RATE_IN_24XX },
	{ .div = 4, .val = 4, .flags = RATE_IN_24XX },
	{ .div = 6, .val = 6, .flags = RATE_IN_242X },
	{ .div = 8, .val = 8, .flags = RATE_IN_242X },
	{ .div = 12, .val = 12, .flags = RATE_IN_242X },
	{ .div = 0 },
};

static const struct clksel dsp_fck_clksel[] = {
	{ .parent = &core_ck, .rates = dsp_fck_core_rates },
	{ .parent = NULL }
};

static struct clk dsp_fck = {
	.name		= "dsp_fck",
447
	.ops		= &clkops_omap2_dflt_wait,
448
	.parent		= &core_ck,
449
	.clkdm_name	= "dsp_clkdm",
450 451 452 453 454
	.enable_reg	= OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
	.enable_bit	= OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT,
	.clksel_reg	= OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
	.clksel_mask	= OMAP24XX_CLKSEL_DSP_MASK,
	.clksel		= dsp_fck_clksel,
455 456 457
	.recalc		= &omap2_clksel_recalc,
};

458 459
/* DSP interface clock */
static const struct clksel_rate dsp_irate_ick_rates[] = {
460
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
461 462 463 464 465 466 467
	{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
	{ .div = 0 },
};

static const struct clksel dsp_irate_ick_clksel[] = {
	{ .parent = &dsp_fck, .rates = dsp_irate_ick_rates },
	{ .parent = NULL }
468 469
};

470
/* This clock does not exist as such in the TRM. */
471 472
static struct clk dsp_irate_ick = {
	.name		= "dsp_irate_ick",
473
	.ops		= &clkops_null,
474 475 476 477
	.parent		= &dsp_fck,
	.clksel_reg	= OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
	.clksel_mask	= OMAP24XX_CLKSEL_DSP_IF_MASK,
	.clksel		= dsp_irate_ick_clksel,
478 479 480
	.recalc		= &omap2_clksel_recalc,
};

481
/* 2420 only */
482 483
static struct clk dsp_ick = {
	.name		= "dsp_ick",	 /* apparently ipi and isp */
484
	.ops		= &clkops_omap2_dflt_wait,
485 486 487 488 489
	.parent		= &dsp_irate_ick,
	.enable_reg	= OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP2420_EN_DSP_IPI_SHIFT,	      /* for ipi */
};

490 491 492 493 494
/*
 * The IVA1 is an ARM7 core on the 2420 that has nothing to do with
 * the C54x, but which is contained in the DSP powerdomain.  Does not
 * exist on later OMAPs.
 */
495 496
static struct clk iva1_ifck = {
	.name		= "iva1_ifck",
497
	.ops		= &clkops_omap2_dflt_wait,
498
	.parent		= &core_ck,
499
	.clkdm_name	= "iva1_clkdm",
500 501 502 503 504
	.enable_reg	= OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
	.enable_bit	= OMAP2420_EN_IVA_COP_SHIFT,
	.clksel_reg	= OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
	.clksel_mask	= OMAP2420_CLKSEL_IVA_MASK,
	.clksel		= dsp_fck_clksel,
505 506 507 508 509 510
	.recalc		= &omap2_clksel_recalc,
};

/* IVA1 mpu/int/i/f clocks are /2 of parent */
static struct clk iva1_mpu_int_ifck = {
	.name		= "iva1_mpu_int_ifck",
511
	.ops		= &clkops_omap2_dflt_wait,
512
	.parent		= &iva1_ifck,
513
	.clkdm_name	= "iva1_clkdm",
514 515 516
	.enable_reg	= OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
	.enable_bit	= OMAP2420_EN_IVA_MPU_SHIFT,
	.fixed_div	= 2,
517
	.recalc		= &omap_fixed_divisor_recalc,
518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538
};

/*
 * L3 clock domain
 * L3 clocks are used for both interface and functional clocks to
 * multiple entities. Some of these clocks are completely managed
 * by hardware, and some others allow software control. Hardware
 * managed ones general are based on directly CLK_REQ signals and
 * various auto idle settings. The functional spec sets many of these
 * as 'tie-high' for their enables.
 *
 * I-CLOCKS:
 *	L3-Interconnect, SMS, GPMC, SDRC, OCM_RAM, OCM_ROM, SDMA
 *	CAM, HS-USB.
 * F-CLOCK
 *	SSI.
 *
 * GPMC memories and SDRC have timing and clock sensitive registers which
 * may very well need notification when the clock changes. Currently for low
 * operating points, these are taken care of in sleep.S.
 */
539 540 541
static const struct clksel_rate core_l3_core_rates[] = {
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
	{ .div = 2, .val = 2, .flags = RATE_IN_242X },
542
	{ .div = 4, .val = 4, .flags = RATE_IN_24XX },
543 544 545 546 547 548 549 550 551 552 553 554
	{ .div = 6, .val = 6, .flags = RATE_IN_24XX },
	{ .div = 8, .val = 8, .flags = RATE_IN_242X },
	{ .div = 12, .val = 12, .flags = RATE_IN_242X },
	{ .div = 16, .val = 16, .flags = RATE_IN_242X },
	{ .div = 0 }
};

static const struct clksel core_l3_clksel[] = {
	{ .parent = &core_ck, .rates = core_l3_core_rates },
	{ .parent = NULL }
};

555 556
static struct clk core_l3_ck = {	/* Used for ick and fck, interconnect */
	.name		= "core_l3_ck",
557
	.ops		= &clkops_null,
558
	.parent		= &core_ck,
559
	.clkdm_name	= "core_l3_clkdm",
560 561 562
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
	.clksel_mask	= OMAP24XX_CLKSEL_L3_MASK,
	.clksel		= core_l3_clksel,
563
	.recalc		= &omap2_clksel_recalc,
564 565 566 567 568
};

/* usb_l4_ick */
static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
569
	{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
570 571 572 573 574 575 576
	{ .div = 4, .val = 4, .flags = RATE_IN_24XX },
	{ .div = 0 }
};

static const struct clksel usb_l4_ick_clksel[] = {
	{ .parent = &core_l3_ck, .rates = usb_l4_ick_core_l3_rates },
	{ .parent = NULL },
577 578
};

579
/* It is unclear from TRM whether usb_l4_ick is really in L3 or L4 clkdm */
580 581
static struct clk usb_l4_ick = {	/* FS-USB interface clock */
	.name		= "usb_l4_ick",
582
	.ops		= &clkops_omap2_dflt_wait,
583
	.parent		= &core_l3_ck,
584
	.clkdm_name	= "core_l4_clkdm",
585 586 587 588 589
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP24XX_EN_USB_SHIFT,
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
	.clksel_mask	= OMAP24XX_CLKSEL_USB_MASK,
	.clksel		= usb_l4_ick_clksel,
590 591 592
	.recalc		= &omap2_clksel_recalc,
};

593 594 595 596 597 598 599 600
/*
 * L4 clock management domain
 *
 * This domain contains lots of interface clocks from the L4 interface, some
 * functional clocks.	Fixed APLL functional source clocks are managed in
 * this domain.
 */
static const struct clksel_rate l4_core_l3_rates[] = {
601
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
602 603 604 605 606 607 608 609 610 611 612
	{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
	{ .div = 0 }
};

static const struct clksel l4_clksel[] = {
	{ .parent = &core_l3_ck, .rates = l4_core_l3_rates },
	{ .parent = NULL }
};

static struct clk l4_ck = {		/* used both as an ick and fck */
	.name		= "l4_ck",
613
	.ops		= &clkops_null,
614 615 616 617 618 619 620 621
	.parent		= &core_l3_ck,
	.clkdm_name	= "core_l4_clkdm",
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
	.clksel_mask	= OMAP24XX_CLKSEL_L4_MASK,
	.clksel		= l4_clksel,
	.recalc		= &omap2_clksel_recalc,
};

622 623 624 625
/*
 * SSI is in L3 management domain, its direct parent is core not l3,
 * many core power domain entities are grouped into the L3 clock
 * domain.
626
 * SSI_SSR_FCLK, SSI_SST_FCLK, SSI_L4_ICLK
627 628 629
 *
 * ssr = core/1/2/3/4/5, sst = 1/2 ssr.
 */
630 631
static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
632
	{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
633 634 635 636 637 638 639 640 641 642 643 644
	{ .div = 3, .val = 3, .flags = RATE_IN_24XX },
	{ .div = 4, .val = 4, .flags = RATE_IN_24XX },
	{ .div = 6, .val = 6, .flags = RATE_IN_242X },
	{ .div = 8, .val = 8, .flags = RATE_IN_242X },
	{ .div = 0 }
};

static const struct clksel ssi_ssr_sst_fck_clksel[] = {
	{ .parent = &core_ck, .rates = ssi_ssr_sst_fck_core_rates },
	{ .parent = NULL }
};

645 646
static struct clk ssi_ssr_sst_fck = {
	.name		= "ssi_fck",
647
	.ops		= &clkops_omap2_dflt_wait,
648
	.parent		= &core_ck,
649
	.clkdm_name	= "core_l3_clkdm",
650 651 652 653 654
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP24XX_EN_SSI_SHIFT,
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
	.clksel_mask	= OMAP24XX_CLKSEL_SSI_MASK,
	.clksel		= ssi_ssr_sst_fck_clksel,
655 656 657
	.recalc		= &omap2_clksel_recalc,
};

658 659 660 661 662 663 664 665 666 667 668 669 670 671
/*
 * Presumably this is the same as SSI_ICLK.
 * TRM contradicts itself on what clockdomain SSI_ICLK is in
 */
static struct clk ssi_l4_ick = {
	.name		= "ssi_l4_ick",
	.ops		= &clkops_omap2_dflt_wait,
	.parent		= &l4_ck,
	.clkdm_name	= "core_l4_clkdm",
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP24XX_EN_SSI_SHIFT,
	.recalc		= &followparent_recalc,
};

672

673 674 675 676 677 678 679 680 681 682 683
/*
 * GFX clock domain
 *	Clocks:
 * GFX_FCLK, GFX_ICLK
 * GFX_CG1(2d), GFX_CG2(3d)
 *
 * GFX_FCLK runs from L3, and is divided by (1,2,3,4)
 * The 2d and 3d clocks run at a hardware determined
 * divided value of fclk.
 *
 */
684 685 686 687 688 689 690

/* This clksel struct is shared between gfx_3d_fck and gfx_2d_fck */
static const struct clksel gfx_fck_clksel[] = {
	{ .parent = &core_l3_ck, .rates = gfx_l3_rates },
	{ .parent = NULL },
};

691 692
static struct clk gfx_3d_fck = {
	.name		= "gfx_3d_fck",
693
	.ops		= &clkops_omap2_dflt_wait,
694
	.parent		= &core_l3_ck,
695
	.clkdm_name	= "gfx_clkdm",
696 697 698 699 700
	.enable_reg	= OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
	.enable_bit	= OMAP24XX_EN_3D_SHIFT,
	.clksel_reg	= OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
	.clksel_mask	= OMAP_CLKSEL_GFX_MASK,
	.clksel		= gfx_fck_clksel,
701
	.recalc		= &omap2_clksel_recalc,
702 703
	.round_rate	= &omap2_clksel_round_rate,
	.set_rate	= &omap2_clksel_set_rate
704 705 706 707
};

static struct clk gfx_2d_fck = {
	.name		= "gfx_2d_fck",
708
	.ops		= &clkops_omap2_dflt_wait,
709
	.parent		= &core_l3_ck,
710
	.clkdm_name	= "gfx_clkdm",
711 712 713 714 715
	.enable_reg	= OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
	.enable_bit	= OMAP24XX_EN_2D_SHIFT,
	.clksel_reg	= OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
	.clksel_mask	= OMAP_CLKSEL_GFX_MASK,
	.clksel		= gfx_fck_clksel,
716 717 718 719 720
	.recalc		= &omap2_clksel_recalc,
};

static struct clk gfx_ick = {
	.name		= "gfx_ick",		/* From l3 */
721
	.ops		= &clkops_omap2_dflt_wait,
722
	.parent		= &core_l3_ck,
723
	.clkdm_name	= "gfx_clkdm",
724 725 726
	.enable_reg	= OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
	.enable_bit	= OMAP_EN_GFX_SHIFT,
	.recalc		= &followparent_recalc,
727 728 729 730 731 732 733 734 735 736
};

/*
 * DSS clock domain
 * CLOCKs:
 * DSS_L4_ICLK, DSS_L3_ICLK,
 * DSS_CLK1, DSS_CLK2, DSS_54MHz_CLK
 *
 * DSS is both initiator and target.
 */
737 738 739
/* XXX Add RATE_NOT_VALIDATED */

static const struct clksel_rate dss1_fck_sys_rates[] = {
740
	{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
741 742 743 744 745 746 747 748 749 750 751 752 753
	{ .div = 0 }
};

static const struct clksel_rate dss1_fck_core_rates[] = {
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
	{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
	{ .div = 3, .val = 3, .flags = RATE_IN_24XX },
	{ .div = 4, .val = 4, .flags = RATE_IN_24XX },
	{ .div = 5, .val = 5, .flags = RATE_IN_24XX },
	{ .div = 6, .val = 6, .flags = RATE_IN_24XX },
	{ .div = 8, .val = 8, .flags = RATE_IN_24XX },
	{ .div = 9, .val = 9, .flags = RATE_IN_24XX },
	{ .div = 12, .val = 12, .flags = RATE_IN_24XX },
754
	{ .div = 16, .val = 16, .flags = RATE_IN_24XX },
755 756 757 758 759 760 761 762 763
	{ .div = 0 }
};

static const struct clksel dss1_fck_clksel[] = {
	{ .parent = &sys_ck,  .rates = dss1_fck_sys_rates },
	{ .parent = &core_ck, .rates = dss1_fck_core_rates },
	{ .parent = NULL },
};

764 765
static struct clk dss_ick = {		/* Enables both L3,L4 ICLK's */
	.name		= "dss_ick",
766
	.ops		= &clkops_omap2_dflt,
767
	.parent		= &l4_ck,	/* really both l3 and l4 */
768
	.clkdm_name	= "dss_clkdm",
769 770 771
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_DSS1_SHIFT,
	.recalc		= &followparent_recalc,
772 773 774 775
};

static struct clk dss1_fck = {
	.name		= "dss1_fck",
776
	.ops		= &clkops_omap2_dflt,
777
	.parent		= &core_ck,		/* Core or sys */
778
	.clkdm_name	= "dss_clkdm",
779 780 781 782 783 784
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_DSS1_SHIFT,
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
	.clksel_mask	= OMAP24XX_CLKSEL_DSS1_MASK,
	.clksel		= dss1_fck_clksel,
785
	.recalc		= &omap2_clksel_recalc,
786 787 788
};

static const struct clksel_rate dss2_fck_sys_rates[] = {
789
	{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
790 791 792 793
	{ .div = 0 }
};

static const struct clksel_rate dss2_fck_48m_rates[] = {
794
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
795 796 797 798 799 800 801
	{ .div = 0 }
};

static const struct clksel dss2_fck_clksel[] = {
	{ .parent = &sys_ck,	  .rates = dss2_fck_sys_rates },
	{ .parent = &func_48m_ck, .rates = dss2_fck_48m_rates },
	{ .parent = NULL }
802 803 804 805
};

static struct clk dss2_fck = {		/* Alt clk used in power management */
	.name		= "dss2_fck",
806
	.ops		= &clkops_omap2_dflt,
807
	.parent		= &sys_ck,		/* fixed at sys_ck or 48MHz */
808
	.clkdm_name	= "dss_clkdm",
809 810 811 812 813 814
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_DSS2_SHIFT,
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
	.clksel_mask	= OMAP24XX_CLKSEL_DSS2_MASK,
	.clksel		= dss2_fck_clksel,
815
	.recalc		= &omap2_clksel_recalc,
816 817 818 819
};

static struct clk dss_54m_fck = {	/* Alt clk used in power management */
	.name		= "dss_54m_fck",	/* 54m tv clk */
820
	.ops		= &clkops_omap2_dflt_wait,
821
	.parent		= &func_54m_ck,
822
	.clkdm_name	= "dss_clkdm",
823 824 825
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_TV_SHIFT,
	.recalc		= &followparent_recalc,
826 827 828 829 830 831 832 833
};

/*
 * CORE power domain ICLK & FCLK defines.
 * Many of the these can have more than one possible parent. Entries
 * here will likely have an L4 interface parent, and may have multiple
 * functional clock parents.
 */
834
static const struct clksel_rate gpt_alt_rates[] = {
835
	{ .div = 1, .val = 2, .flags = RATE_IN_24XX },
836 837 838 839 840 841 842 843 844 845
	{ .div = 0 }
};

static const struct clksel omap24xx_gpt_clksel[] = {
	{ .parent = &func_32k_ck, .rates = gpt_32k_rates },
	{ .parent = &sys_ck,	  .rates = gpt_sys_rates },
	{ .parent = &alt_ck,	  .rates = gpt_alt_rates },
	{ .parent = NULL },
};

846 847
static struct clk gpt1_ick = {
	.name		= "gpt1_ick",
848
	.ops		= &clkops_omap2_dflt_wait,
849
	.parent		= &l4_ck,
850
	.clkdm_name	= "core_l4_clkdm",
851 852 853
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_GPT1_SHIFT,
	.recalc		= &followparent_recalc,
854 855 856 857
};

static struct clk gpt1_fck = {
	.name		= "gpt1_fck",
858
	.ops		= &clkops_omap2_dflt_wait,
859
	.parent		= &func_32k_ck,
860
	.clkdm_name	= "core_l4_clkdm",
861 862 863 864 865 866 867 868 869
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
	.enable_bit	= OMAP24XX_EN_GPT1_SHIFT,
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1),
	.clksel_mask	= OMAP24XX_CLKSEL_GPT1_MASK,
	.clksel		= omap24xx_gpt_clksel,
	.recalc		= &omap2_clksel_recalc,
	.round_rate	= &omap2_clksel_round_rate,
	.set_rate	= &omap2_clksel_set_rate
870 871 872 873
};

static struct clk gpt2_ick = {
	.name		= "gpt2_ick",
874
	.ops		= &clkops_omap2_dflt_wait,
875
	.parent		= &l4_ck,
876
	.clkdm_name	= "core_l4_clkdm",
877 878 879
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT2_SHIFT,
	.recalc		= &followparent_recalc,
880 881 882 883
};

static struct clk gpt2_fck = {
	.name		= "gpt2_fck",
884
	.ops		= &clkops_omap2_dflt_wait,
885
	.parent		= &func_32k_ck,
886
	.clkdm_name	= "core_l4_clkdm",
887 888 889 890 891 892 893
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT2_SHIFT,
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
	.clksel_mask	= OMAP24XX_CLKSEL_GPT2_MASK,
	.clksel		= omap24xx_gpt_clksel,
	.recalc		= &omap2_clksel_recalc,
894 895 896 897
};

static struct clk gpt3_ick = {
	.name		= "gpt3_ick",
898
	.ops		= &clkops_omap2_dflt_wait,
899
	.parent		= &l4_ck,
900
	.clkdm_name	= "core_l4_clkdm",
901 902 903
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT3_SHIFT,
	.recalc		= &followparent_recalc,
904 905 906 907
};

static struct clk gpt3_fck = {
	.name		= "gpt3_fck",
908
	.ops		= &clkops_omap2_dflt_wait,
909
	.parent		= &func_32k_ck,
910
	.clkdm_name	= "core_l4_clkdm",
911 912 913 914 915 916 917
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT3_SHIFT,
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
	.clksel_mask	= OMAP24XX_CLKSEL_GPT3_MASK,
	.clksel		= omap24xx_gpt_clksel,
	.recalc		= &omap2_clksel_recalc,
918 919 920 921
};

static struct clk gpt4_ick = {
	.name		= "gpt4_ick",
922
	.ops		= &clkops_omap2_dflt_wait,
923
	.parent		= &l4_ck,
924
	.clkdm_name	= "core_l4_clkdm",
925 926 927
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT4_SHIFT,
	.recalc		= &followparent_recalc,
928 929 930 931
};

static struct clk gpt4_fck = {
	.name		= "gpt4_fck",
932
	.ops		= &clkops_omap2_dflt_wait,
933
	.parent		= &func_32k_ck,
934
	.clkdm_name	= "core_l4_clkdm",
935 936 937 938 939 940 941
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT4_SHIFT,
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
	.clksel_mask	= OMAP24XX_CLKSEL_GPT4_MASK,
	.clksel		= omap24xx_gpt_clksel,
	.recalc		= &omap2_clksel_recalc,
942 943 944 945
};

static struct clk gpt5_ick = {
	.name		= "gpt5_ick",
946
	.ops		= &clkops_omap2_dflt_wait,
947
	.parent		= &l4_ck,
948
	.clkdm_name	= "core_l4_clkdm",
949 950 951
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT5_SHIFT,
	.recalc		= &followparent_recalc,
952 953 954 955
};

static struct clk gpt5_fck = {
	.name		= "gpt5_fck",
956
	.ops		= &clkops_omap2_dflt_wait,
957
	.parent		= &func_32k_ck,
958
	.clkdm_name	= "core_l4_clkdm",
959 960 961 962 963 964 965
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT5_SHIFT,
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
	.clksel_mask	= OMAP24XX_CLKSEL_GPT5_MASK,
	.clksel		= omap24xx_gpt_clksel,
	.recalc		= &omap2_clksel_recalc,
966 967 968 969
};

static struct clk gpt6_ick = {
	.name		= "gpt6_ick",
970
	.ops		= &clkops_omap2_dflt_wait,
971
	.parent		= &l4_ck,
972
	.clkdm_name	= "core_l4_clkdm",
973 974 975
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT6_SHIFT,
	.recalc		= &followparent_recalc,
976 977 978 979
};

static struct clk gpt6_fck = {
	.name		= "gpt6_fck",
980
	.ops		= &clkops_omap2_dflt_wait,
981
	.parent		= &func_32k_ck,
982
	.clkdm_name	= "core_l4_clkdm",
983 984 985 986 987 988 989
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT6_SHIFT,
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
	.clksel_mask	= OMAP24XX_CLKSEL_GPT6_MASK,
	.clksel		= omap24xx_gpt_clksel,
	.recalc		= &omap2_clksel_recalc,
990 991 992 993
};

static struct clk gpt7_ick = {
	.name		= "gpt7_ick",
994
	.ops		= &clkops_omap2_dflt_wait,
995
	.parent		= &l4_ck,
996 997 998
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT7_SHIFT,
	.recalc		= &followparent_recalc,
999 1000 1001 1002
};

static struct clk gpt7_fck = {
	.name		= "gpt7_fck",
1003
	.ops		= &clkops_omap2_dflt_wait,
1004
	.parent		= &func_32k_ck,
1005
	.clkdm_name	= "core_l4_clkdm",
1006 1007 1008 1009 1010 1011 1012
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT7_SHIFT,
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
	.clksel_mask	= OMAP24XX_CLKSEL_GPT7_MASK,
	.clksel		= omap24xx_gpt_clksel,
	.recalc		= &omap2_clksel_recalc,
1013 1014 1015 1016
};

static struct clk gpt8_ick = {
	.name		= "gpt8_ick",
1017
	.ops		= &clkops_omap2_dflt_wait,
1018
	.parent		= &l4_ck,
1019
	.clkdm_name	= "core_l4_clkdm",
1020 1021 1022
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT8_SHIFT,
	.recalc		= &followparent_recalc,
1023 1024 1025 1026
};

static struct clk gpt8_fck = {
	.name		= "gpt8_fck",
1027
	.ops		= &clkops_omap2_dflt_wait,
1028
	.parent		= &func_32k_ck,
1029
	.clkdm_name	= "core_l4_clkdm",
1030 1031 1032 1033 1034 1035 1036
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT8_SHIFT,
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
	.clksel_mask	= OMAP24XX_CLKSEL_GPT8_MASK,
	.clksel		= omap24xx_gpt_clksel,
	.recalc		= &omap2_clksel_recalc,
1037 1038 1039 1040
};

static struct clk gpt9_ick = {
	.name		= "gpt9_ick",
1041
	.ops		= &clkops_omap2_dflt_wait,
1042
	.parent		= &l4_ck,
1043
	.clkdm_name	= "core_l4_clkdm",
1044 1045 1046
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT9_SHIFT,
	.recalc		= &followparent_recalc,
1047 1048 1049 1050
};

static struct clk gpt9_fck = {
	.name		= "gpt9_fck",
1051
	.ops		= &clkops_omap2_dflt_wait,
1052
	.parent		= &func_32k_ck,
1053
	.clkdm_name	= "core_l4_clkdm",
1054 1055 1056 1057 1058 1059 1060
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT9_SHIFT,
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
	.clksel_mask	= OMAP24XX_CLKSEL_GPT9_MASK,
	.clksel		= omap24xx_gpt_clksel,
	.recalc		= &omap2_clksel_recalc,
1061 1062 1063 1064
};

static struct clk gpt10_ick = {
	.name		= "gpt10_ick",
1065
	.ops		= &clkops_omap2_dflt_wait,
1066
	.parent		= &l4_ck,
1067
	.clkdm_name	= "core_l4_clkdm",
1068 1069 1070
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT10_SHIFT,
	.recalc		= &followparent_recalc,
1071 1072 1073 1074
};

static struct clk gpt10_fck = {
	.name		= "gpt10_fck",
1075
	.ops		= &clkops_omap2_dflt_wait,
1076
	.parent		= &func_32k_ck,
1077
	.clkdm_name	= "core_l4_clkdm",
1078 1079 1080 1081 1082 1083 1084
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT10_SHIFT,
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
	.clksel_mask	= OMAP24XX_CLKSEL_GPT10_MASK,
	.clksel		= omap24xx_gpt_clksel,
	.recalc		= &omap2_clksel_recalc,
1085 1086 1087 1088
};

static struct clk gpt11_ick = {
	.name		= "gpt11_ick",
1089
	.ops		= &clkops_omap2_dflt_wait,
1090
	.parent		= &l4_ck,
1091
	.clkdm_name	= "core_l4_clkdm",
1092 1093 1094
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT11_SHIFT,
	.recalc		= &followparent_recalc,
1095 1096 1097 1098
};

static struct clk gpt11_fck = {
	.name		= "gpt11_fck",
1099
	.ops		= &clkops_omap2_dflt_wait,
1100
	.parent		= &func_32k_ck,
1101
	.clkdm_name	= "core_l4_clkdm",
1102 1103 1104 1105 1106 1107 1108
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT11_SHIFT,
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
	.clksel_mask	= OMAP24XX_CLKSEL_GPT11_MASK,
	.clksel		= omap24xx_gpt_clksel,
	.recalc		= &omap2_clksel_recalc,
1109 1110 1111 1112
};

static struct clk gpt12_ick = {
	.name		= "gpt12_ick",
1113
	.ops		= &clkops_omap2_dflt_wait,
1114
	.parent		= &l4_ck,
1115
	.clkdm_name	= "core_l4_clkdm",
1116 1117 1118
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT12_SHIFT,
	.recalc		= &followparent_recalc,
1119 1120 1121 1122
};

static struct clk gpt12_fck = {
	.name		= "gpt12_fck",
1123
	.ops		= &clkops_omap2_dflt_wait,
1124
	.parent		= &secure_32k_ck,
1125
	.clkdm_name	= "core_l4_clkdm",
1126 1127 1128 1129 1130 1131 1132
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT12_SHIFT,
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
	.clksel_mask	= OMAP24XX_CLKSEL_GPT12_MASK,
	.clksel		= omap24xx_gpt_clksel,
	.recalc		= &omap2_clksel_recalc,
1133 1134 1135
};

static struct clk mcbsp1_ick = {
1136
	.name		= "mcbsp1_ick",
1137
	.ops		= &clkops_omap2_dflt_wait,
1138
	.parent		= &l4_ck,
1139
	.clkdm_name	= "core_l4_clkdm",
1140 1141 1142
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_MCBSP1_SHIFT,
	.recalc		= &followparent_recalc,
1143 1144
};

1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160
static const struct clksel_rate common_mcbsp_96m_rates[] = {
	{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
	{ .div = 0 }
};

static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
	{ .div = 0 }
};

static const struct clksel mcbsp_fck_clksel[] = {
	{ .parent = &func_96m_ck,  .rates = common_mcbsp_96m_rates },
	{ .parent = &mcbsp_clks,   .rates = common_mcbsp_mcbsp_rates },
	{ .parent = NULL }
};

1161
static struct clk mcbsp1_fck = {
1162
	.name		= "mcbsp1_fck",
1163
	.ops		= &clkops_omap2_dflt_wait,
1164
	.parent		= &func_96m_ck,
1165
	.init		= &omap2_init_clksel_parent,
1166
	.clkdm_name	= "core_l4_clkdm",
1167 1168
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_MCBSP1_SHIFT,
1169 1170 1171 1172
	.clksel_reg	= OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
	.clksel_mask	= OMAP2_MCBSP1_CLKS_MASK,
	.clksel		= mcbsp_fck_clksel,
	.recalc		= &omap2_clksel_recalc,
1173 1174 1175
};

static struct clk mcbsp2_ick = {
1176
	.name		= "mcbsp2_ick",
1177
	.ops		= &clkops_omap2_dflt_wait,
1178
	.parent		= &l4_ck,
1179
	.clkdm_name	= "core_l4_clkdm",
1180 1181 1182
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_MCBSP2_SHIFT,
	.recalc		= &followparent_recalc,
1183 1184 1185
};

static struct clk mcbsp2_fck = {
1186
	.name		= "mcbsp2_fck",
1187
	.ops		= &clkops_omap2_dflt_wait,
1188
	.parent		= &func_96m_ck,
1189
	.init		= &omap2_init_clksel_parent,
1190
	.clkdm_name	= "core_l4_clkdm",
1191 1192
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_MCBSP2_SHIFT,
1193 1194 1195 1196
	.clksel_reg	= OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
	.clksel_mask	= OMAP2_MCBSP2_CLKS_MASK,
	.clksel		= mcbsp_fck_clksel,
	.recalc		= &omap2_clksel_recalc,
1197 1198 1199
};

static struct clk mcspi1_ick = {
1200
	.name		= "mcspi1_ick",
1201
	.ops		= &clkops_omap2_dflt_wait,
1202
	.parent		= &l4_ck,
1203
	.clkdm_name	= "core_l4_clkdm",
1204 1205 1206
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_MCSPI1_SHIFT,
	.recalc		= &followparent_recalc,
1207 1208 1209
};

static struct clk mcspi1_fck = {
1210
	.name		= "mcspi1_fck",
1211
	.ops		= &clkops_omap2_dflt_wait,
1212
	.parent		= &func_48m_ck,
1213
	.clkdm_name	= "core_l4_clkdm",
1214 1215 1216
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_MCSPI1_SHIFT,
	.recalc		= &followparent_recalc,
1217 1218 1219
};

static struct clk mcspi2_ick = {
1220
	.name		= "mcspi2_ick",
1221
	.ops		= &clkops_omap2_dflt_wait,
1222
	.parent		= &l4_ck,
1223
	.clkdm_name	= "core_l4_clkdm",
1224 1225 1226
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_MCSPI2_SHIFT,
	.recalc		= &followparent_recalc,
1227 1228 1229
};

static struct clk mcspi2_fck = {
1230
	.name		= "mcspi2_fck",
1231
	.ops		= &clkops_omap2_dflt_wait,
1232
	.parent		= &func_48m_ck,
1233
	.clkdm_name	= "core_l4_clkdm",
1234 1235 1236
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_MCSPI2_SHIFT,
	.recalc		= &followparent_recalc,
1237 1238 1239 1240
};

static struct clk uart1_ick = {
	.name		= "uart1_ick",
1241
	.ops		= &clkops_omap2_dflt_wait,
1242
	.parent		= &l4_ck,
1243
	.clkdm_name	= "core_l4_clkdm",
1244 1245 1246
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_UART1_SHIFT,
	.recalc		= &followparent_recalc,
1247 1248 1249 1250
};

static struct clk uart1_fck = {
	.name		= "uart1_fck",
1251
	.ops		= &clkops_omap2_dflt_wait,
1252
	.parent		= &func_48m_ck,
1253
	.clkdm_name	= "core_l4_clkdm",
1254 1255 1256
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_UART1_SHIFT,
	.recalc		= &followparent_recalc,
1257 1258 1259 1260
};

static struct clk uart2_ick = {
	.name		= "uart2_ick",
1261
	.ops		= &clkops_omap2_dflt_wait,
1262
	.parent		= &l4_ck,
1263
	.clkdm_name	= "core_l4_clkdm",
1264 1265 1266
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_UART2_SHIFT,
	.recalc		= &followparent_recalc,
1267 1268 1269 1270
};

static struct clk uart2_fck = {
	.name		= "uart2_fck",
1271
	.ops		= &clkops_omap2_dflt_wait,
1272
	.parent		= &func_48m_ck,
1273
	.clkdm_name	= "core_l4_clkdm",
1274 1275 1276
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_UART2_SHIFT,
	.recalc		= &followparent_recalc,
1277 1278 1279 1280
};

static struct clk uart3_ick = {
	.name		= "uart3_ick",
1281
	.ops		= &clkops_omap2_dflt_wait,
1282
	.parent		= &l4_ck,
1283
	.clkdm_name	= "core_l4_clkdm",
1284 1285 1286
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP24XX_EN_UART3_SHIFT,
	.recalc		= &followparent_recalc,
1287 1288 1289 1290
};

static struct clk uart3_fck = {
	.name		= "uart3_fck",
1291
	.ops		= &clkops_omap2_dflt_wait,
1292
	.parent		= &func_48m_ck,
1293
	.clkdm_name	= "core_l4_clkdm",
1294 1295 1296
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP24XX_EN_UART3_SHIFT,
	.recalc		= &followparent_recalc,
1297 1298 1299 1300
};

static struct clk gpios_ick = {
	.name		= "gpios_ick",
1301
	.ops		= &clkops_omap2_dflt_wait,
1302
	.parent		= &l4_ck,
1303
	.clkdm_name	= "core_l4_clkdm",
1304 1305 1306
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_GPIOS_SHIFT,
	.recalc		= &followparent_recalc,
1307 1308 1309 1310
};

static struct clk gpios_fck = {
	.name		= "gpios_fck",
1311
	.ops		= &clkops_omap2_dflt_wait,
1312
	.parent		= &func_32k_ck,
1313
	.clkdm_name	= "wkup_clkdm",
1314 1315 1316
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
	.enable_bit	= OMAP24XX_EN_GPIOS_SHIFT,
	.recalc		= &followparent_recalc,
1317 1318 1319 1320
};

static struct clk mpu_wdt_ick = {
	.name		= "mpu_wdt_ick",
1321
	.ops		= &clkops_omap2_dflt_wait,
1322
	.parent		= &l4_ck,
1323
	.clkdm_name	= "core_l4_clkdm",
1324 1325 1326
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_MPU_WDT_SHIFT,
	.recalc		= &followparent_recalc,
1327 1328 1329 1330
};

static struct clk mpu_wdt_fck = {
	.name		= "mpu_wdt_fck",
1331
	.ops		= &clkops_omap2_dflt_wait,
1332
	.parent		= &func_32k_ck,
1333
	.clkdm_name	= "wkup_clkdm",
1334 1335 1336
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
	.enable_bit	= OMAP24XX_EN_MPU_WDT_SHIFT,
	.recalc		= &followparent_recalc,
1337 1338 1339 1340
};

static struct clk sync_32k_ick = {
	.name		= "sync_32k_ick",
1341
	.ops		= &clkops_omap2_dflt_wait,
1342
	.parent		= &l4_ck,
1343
	.flags		= ENABLE_ON_INIT,
1344
	.clkdm_name	= "core_l4_clkdm",
1345 1346 1347
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_32KSYNC_SHIFT,
	.recalc		= &followparent_recalc,
1348
};
1349

1350 1351
static struct clk wdt1_ick = {
	.name		= "wdt1_ick",
1352
	.ops		= &clkops_omap2_dflt_wait,
1353
	.parent		= &l4_ck,
1354
	.clkdm_name	= "core_l4_clkdm",
1355 1356 1357
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_WDT1_SHIFT,
	.recalc		= &followparent_recalc,
1358
};
1359

1360 1361
static struct clk omapctrl_ick = {
	.name		= "omapctrl_ick",
1362
	.ops		= &clkops_omap2_dflt_wait,
1363
	.parent		= &l4_ck,
1364
	.flags		= ENABLE_ON_INIT,
1365
	.clkdm_name	= "core_l4_clkdm",
1366 1367 1368
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_OMAPCTRL_SHIFT,
	.recalc		= &followparent_recalc,
1369
};
1370

1371 1372
static struct clk cam_ick = {
	.name		= "cam_ick",
1373
	.ops		= &clkops_omap2_dflt,
1374
	.parent		= &l4_ck,
1375
	.clkdm_name	= "core_l4_clkdm",
1376 1377 1378
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_CAM_SHIFT,
	.recalc		= &followparent_recalc,
1379 1380
};

1381 1382 1383 1384 1385
/*
 * cam_fck controls both CAM_MCLK and CAM_FCLK.  It should probably be
 * split into two separate clocks, since the parent clocks are different
 * and the clockdomains are also different.
 */
1386 1387
static struct clk cam_fck = {
	.name		= "cam_fck",
1388
	.ops		= &clkops_omap2_dflt,
1389
	.parent		= &func_96m_ck,
1390
	.clkdm_name	= "core_l3_clkdm",
1391 1392 1393
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_CAM_SHIFT,
	.recalc		= &followparent_recalc,
1394 1395 1396 1397
};

static struct clk mailboxes_ick = {
	.name		= "mailboxes_ick",
1398
	.ops		= &clkops_omap2_dflt_wait,
1399
	.parent		= &l4_ck,
1400
	.clkdm_name	= "core_l4_clkdm",
1401 1402 1403
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_MAILBOXES_SHIFT,
	.recalc		= &followparent_recalc,
1404 1405 1406 1407
};

static struct clk wdt4_ick = {
	.name		= "wdt4_ick",
1408
	.ops		= &clkops_omap2_dflt_wait,
1409
	.parent		= &l4_ck,
1410
	.clkdm_name	= "core_l4_clkdm",
1411 1412 1413
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_WDT4_SHIFT,
	.recalc		= &followparent_recalc,
1414 1415 1416 1417
};

static struct clk wdt4_fck = {
	.name		= "wdt4_fck",
1418
	.ops		= &clkops_omap2_dflt_wait,
1419
	.parent		= &func_32k_ck,
1420
	.clkdm_name	= "core_l4_clkdm",
1421 1422 1423
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_WDT4_SHIFT,
	.recalc		= &followparent_recalc,
1424 1425 1426 1427
};

static struct clk wdt3_ick = {
	.name		= "wdt3_ick",
1428
	.ops		= &clkops_omap2_dflt_wait,
1429
	.parent		= &l4_ck,
1430
	.clkdm_name	= "core_l4_clkdm",
1431 1432 1433
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP2420_EN_WDT3_SHIFT,
	.recalc		= &followparent_recalc,
1434 1435 1436 1437
};

static struct clk wdt3_fck = {
	.name		= "wdt3_fck",
1438
	.ops		= &clkops_omap2_dflt_wait,
1439
	.parent		= &func_32k_ck,
1440
	.clkdm_name	= "core_l4_clkdm",
1441 1442 1443
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP2420_EN_WDT3_SHIFT,
	.recalc		= &followparent_recalc,
1444 1445 1446 1447
};

static struct clk mspro_ick = {
	.name		= "mspro_ick",
1448
	.ops		= &clkops_omap2_dflt_wait,
1449
	.parent		= &l4_ck,
1450
	.clkdm_name	= "core_l4_clkdm",
1451 1452 1453
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_MSPRO_SHIFT,
	.recalc		= &followparent_recalc,
1454 1455 1456 1457
};

static struct clk mspro_fck = {
	.name		= "mspro_fck",
1458
	.ops		= &clkops_omap2_dflt_wait,
1459
	.parent		= &func_96m_ck,
1460
	.clkdm_name	= "core_l4_clkdm",
1461 1462 1463
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_MSPRO_SHIFT,
	.recalc		= &followparent_recalc,
1464 1465 1466 1467
};

static struct clk mmc_ick = {
	.name		= "mmc_ick",
1468
	.ops		= &clkops_omap2_dflt_wait,
1469
	.parent		= &l4_ck,
1470
	.clkdm_name	= "core_l4_clkdm",
1471 1472 1473
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP2420_EN_MMC_SHIFT,
	.recalc		= &followparent_recalc,
1474 1475 1476 1477
};

static struct clk mmc_fck = {
	.name		= "mmc_fck",
1478
	.ops		= &clkops_omap2_dflt_wait,
1479
	.parent		= &func_96m_ck,
1480
	.clkdm_name	= "core_l4_clkdm",
1481 1482 1483
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP2420_EN_MMC_SHIFT,
	.recalc		= &followparent_recalc,
1484 1485 1486 1487
};

static struct clk fac_ick = {
	.name		= "fac_ick",
1488
	.ops		= &clkops_omap2_dflt_wait,
1489
	.parent		= &l4_ck,
1490
	.clkdm_name	= "core_l4_clkdm",
1491 1492 1493
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_FAC_SHIFT,
	.recalc		= &followparent_recalc,
1494 1495 1496 1497
};

static struct clk fac_fck = {
	.name		= "fac_fck",
1498
	.ops		= &clkops_omap2_dflt_wait,
1499
	.parent		= &func_12m_ck,
1500
	.clkdm_name	= "core_l4_clkdm",
1501 1502 1503
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_FAC_SHIFT,
	.recalc		= &followparent_recalc,
1504 1505 1506 1507
};

static struct clk eac_ick = {
	.name		= "eac_ick",
1508
	.ops		= &clkops_omap2_dflt_wait,
1509
	.parent		= &l4_ck,
1510
	.clkdm_name	= "core_l4_clkdm",
1511 1512 1513
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP2420_EN_EAC_SHIFT,
	.recalc		= &followparent_recalc,
1514 1515 1516 1517
};

static struct clk eac_fck = {
	.name		= "eac_fck",
1518
	.ops		= &clkops_omap2_dflt_wait,
1519
	.parent		= &func_96m_ck,
1520
	.clkdm_name	= "core_l4_clkdm",
1521 1522 1523
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP2420_EN_EAC_SHIFT,
	.recalc		= &followparent_recalc,
1524 1525 1526 1527
};

static struct clk hdq_ick = {
	.name		= "hdq_ick",
1528
	.ops		= &clkops_omap2_dflt_wait,
1529
	.parent		= &l4_ck,
1530
	.clkdm_name	= "core_l4_clkdm",
1531 1532 1533
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_HDQ_SHIFT,
	.recalc		= &followparent_recalc,
1534 1535 1536 1537
};

static struct clk hdq_fck = {
	.name		= "hdq_fck",
1538
	.ops		= &clkops_omap2_dflt_wait,
1539
	.parent		= &func_12m_ck,
1540
	.clkdm_name	= "core_l4_clkdm",
1541 1542 1543
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_HDQ_SHIFT,
	.recalc		= &followparent_recalc,
1544 1545 1546
};

static struct clk i2c2_ick = {
1547
	.name		= "i2c2_ick",
1548
	.ops		= &clkops_omap2_dflt_wait,
1549
	.parent		= &l4_ck,
1550
	.clkdm_name	= "core_l4_clkdm",
1551 1552 1553
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP2420_EN_I2C2_SHIFT,
	.recalc		= &followparent_recalc,
1554 1555 1556
};

static struct clk i2c2_fck = {
1557
	.name		= "i2c2_fck",
1558
	.ops		= &clkops_omap2_dflt_wait,
1559
	.parent		= &func_12m_ck,
1560
	.clkdm_name	= "core_l4_clkdm",
1561 1562 1563
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP2420_EN_I2C2_SHIFT,
	.recalc		= &followparent_recalc,
1564 1565 1566
};

static struct clk i2c1_ick = {
1567
	.name		= "i2c1_ick",
1568
	.ops		= &clkops_omap2_dflt_wait,
1569
	.parent		= &l4_ck,
1570
	.clkdm_name	= "core_l4_clkdm",
1571 1572 1573
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP2420_EN_I2C1_SHIFT,
	.recalc		= &followparent_recalc,
1574 1575 1576
};

static struct clk i2c1_fck = {
1577
	.name		= "i2c1_fck",
1578
	.ops		= &clkops_omap2_dflt_wait,
1579
	.parent		= &func_12m_ck,
1580
	.clkdm_name	= "core_l4_clkdm",
1581 1582 1583
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP2420_EN_I2C1_SHIFT,
	.recalc		= &followparent_recalc,
1584 1585
};

1586 1587
static struct clk gpmc_fck = {
	.name		= "gpmc_fck",
1588
	.ops		= &clkops_null, /* RMK: missing? */
1589
	.parent		= &core_l3_ck,
1590
	.flags		= ENABLE_ON_INIT,
1591
	.clkdm_name	= "core_l3_clkdm",
1592 1593 1594 1595 1596
	.recalc		= &followparent_recalc,
};

static struct clk sdma_fck = {
	.name		= "sdma_fck",
1597
	.ops		= &clkops_null, /* RMK: missing? */
1598
	.parent		= &core_l3_ck,
1599
	.clkdm_name	= "core_l3_clkdm",
1600 1601 1602 1603 1604
	.recalc		= &followparent_recalc,
};

static struct clk sdma_ick = {
	.name		= "sdma_ick",
1605
	.ops		= &clkops_null, /* RMK: missing? */
1606
	.parent		= &l4_ck,
1607
	.clkdm_name	= "core_l3_clkdm",
1608
	.recalc		= &followparent_recalc,
1609 1610 1611 1612
};

static struct clk vlynq_ick = {
	.name		= "vlynq_ick",
1613
	.ops		= &clkops_omap2_dflt_wait,
1614
	.parent		= &core_l3_ck,
1615
	.clkdm_name	= "core_l3_clkdm",
1616 1617 1618 1619 1620 1621
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP2420_EN_VLYNQ_SHIFT,
	.recalc		= &followparent_recalc,
};

static const struct clksel_rate vlynq_fck_96m_rates[] = {
1622
	{ .div = 1, .val = 0, .flags = RATE_IN_242X },
1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634
	{ .div = 0 }
};

static const struct clksel_rate vlynq_fck_core_rates[] = {
	{ .div = 1, .val = 1, .flags = RATE_IN_242X },
	{ .div = 2, .val = 2, .flags = RATE_IN_242X },
	{ .div = 3, .val = 3, .flags = RATE_IN_242X },
	{ .div = 4, .val = 4, .flags = RATE_IN_242X },
	{ .div = 6, .val = 6, .flags = RATE_IN_242X },
	{ .div = 8, .val = 8, .flags = RATE_IN_242X },
	{ .div = 9, .val = 9, .flags = RATE_IN_242X },
	{ .div = 12, .val = 12, .flags = RATE_IN_242X },
1635
	{ .div = 16, .val = 16, .flags = RATE_IN_242X },
1636 1637 1638 1639 1640 1641 1642 1643
	{ .div = 18, .val = 18, .flags = RATE_IN_242X },
	{ .div = 0 }
};

static const struct clksel vlynq_fck_clksel[] = {
	{ .parent = &func_96m_ck, .rates = vlynq_fck_96m_rates },
	{ .parent = &core_ck,	  .rates = vlynq_fck_core_rates },
	{ .parent = NULL }
1644 1645 1646 1647
};

static struct clk vlynq_fck = {
	.name		= "vlynq_fck",
1648
	.ops		= &clkops_omap2_dflt_wait,
1649
	.parent		= &func_96m_ck,
1650
	.clkdm_name	= "core_l3_clkdm",
1651 1652 1653 1654 1655 1656 1657
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP2420_EN_VLYNQ_SHIFT,
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
	.clksel_mask	= OMAP2420_CLKSEL_VLYNQ_MASK,
	.clksel		= vlynq_fck_clksel,
	.recalc		= &omap2_clksel_recalc,
1658 1659 1660 1661
};

static struct clk des_ick = {
	.name		= "des_ick",
1662
	.ops		= &clkops_omap2_dflt_wait,
1663
	.parent		= &l4_ck,
1664
	.clkdm_name	= "core_l4_clkdm",
1665 1666 1667
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
	.enable_bit	= OMAP24XX_EN_DES_SHIFT,
	.recalc		= &followparent_recalc,
1668 1669 1670 1671
};

static struct clk sha_ick = {
	.name		= "sha_ick",
1672
	.ops		= &clkops_omap2_dflt_wait,
1673
	.parent		= &l4_ck,
1674
	.clkdm_name	= "core_l4_clkdm",
1675 1676 1677
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
	.enable_bit	= OMAP24XX_EN_SHA_SHIFT,
	.recalc		= &followparent_recalc,
1678 1679 1680 1681
};

static struct clk rng_ick = {
	.name		= "rng_ick",
1682
	.ops		= &clkops_omap2_dflt_wait,
1683
	.parent		= &l4_ck,
1684
	.clkdm_name	= "core_l4_clkdm",
1685 1686 1687
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
	.enable_bit	= OMAP24XX_EN_RNG_SHIFT,
	.recalc		= &followparent_recalc,
1688 1689 1690 1691
};

static struct clk aes_ick = {
	.name		= "aes_ick",
1692
	.ops		= &clkops_omap2_dflt_wait,
1693
	.parent		= &l4_ck,
1694
	.clkdm_name	= "core_l4_clkdm",
1695 1696 1697
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
	.enable_bit	= OMAP24XX_EN_AES_SHIFT,
	.recalc		= &followparent_recalc,
1698 1699 1700 1701
};

static struct clk pka_ick = {
	.name		= "pka_ick",
1702
	.ops		= &clkops_omap2_dflt_wait,
1703
	.parent		= &l4_ck,
1704
	.clkdm_name	= "core_l4_clkdm",
1705 1706 1707
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
	.enable_bit	= OMAP24XX_EN_PKA_SHIFT,
	.recalc		= &followparent_recalc,
1708 1709 1710 1711
};

static struct clk usb_fck = {
	.name		= "usb_fck",
1712
	.ops		= &clkops_omap2_dflt_wait,
1713
	.parent		= &func_48m_ck,
1714
	.clkdm_name	= "core_l3_clkdm",
1715 1716 1717
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP24XX_EN_USB_SHIFT,
	.recalc		= &followparent_recalc,
1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735
};

/*
 * This clock is a composite clock which does entire set changes then
 * forces a rebalance. It keys on the MPU speed, but it really could
 * be any key speed part of a set in the rate table.
 *
 * to really change a set, you need memory table sets which get changed
 * in sram, pre-notifiers & post notifiers, changing the top set, without
 * having low level display recalc's won't work... this is why dpm notifiers
 * work, isr's off, walk a list of clocks already _off_ and not messing with
 * the bus.
 *
 * This clock should have no parent. It embodies the entire upper level
 * active set. A parent will mess up some of the init also.
 */
static struct clk virt_prcm_set = {
	.name		= "virt_prcm_set",
1736
	.ops		= &clkops_null,
1737
	.parent		= &mpu_ck,	/* Indexed by mpu speed, no parent */
1738
	.recalc		= &omap2_table_mpu_recalc,	/* sets are keyed on mpu rate */
1739 1740 1741
	.set_rate	= &omap2_select_table_rate,
	.round_rate	= &omap2_round_to_table_rate,
};
1742

1743 1744 1745 1746 1747

/*
 * clkdev integration
 */

1748
static struct omap_clk omap2420_clks[] = {
1749
	/* external root sources */
1750 1751 1752 1753 1754
	CLK(NULL,	"func_32k_ck",	&func_32k_ck,	CK_242X),
	CLK(NULL,	"secure_32k_ck", &secure_32k_ck, CK_242X),
	CLK(NULL,	"osc_ck",	&osc_ck,	CK_242X),
	CLK(NULL,	"sys_ck",	&sys_ck,	CK_242X),
	CLK(NULL,	"alt_ck",	&alt_ck,	CK_242X),
1755 1756 1757
	CLK("omap-mcbsp.1",	"pad_fck",	&mcbsp_clks,	CK_242X),
	CLK("omap-mcbsp.2",	"pad_fck",	&mcbsp_clks,	CK_242X),
	CLK(NULL,	"mcbsp_clks",	&mcbsp_clks,	CK_242X),
1758
	/* internal analog sources */
1759 1760 1761
	CLK(NULL,	"dpll_ck",	&dpll_ck,	CK_242X),
	CLK(NULL,	"apll96_ck",	&apll96_ck,	CK_242X),
	CLK(NULL,	"apll54_ck",	&apll54_ck,	CK_242X),
1762
	/* internal prcm root sources */
1763 1764
	CLK(NULL,	"func_54m_ck",	&func_54m_ck,	CK_242X),
	CLK(NULL,	"core_ck",	&core_ck,	CK_242X),
1765 1766
	CLK("omap-mcbsp.1",	"prcm_fck",	&func_96m_ck,	CK_242X),
	CLK("omap-mcbsp.2",	"prcm_fck",	&func_96m_ck,	CK_242X),
1767 1768 1769 1770 1771 1772
	CLK(NULL,	"func_96m_ck",	&func_96m_ck,	CK_242X),
	CLK(NULL,	"func_48m_ck",	&func_48m_ck,	CK_242X),
	CLK(NULL,	"func_12m_ck",	&func_12m_ck,	CK_242X),
	CLK(NULL,	"ck_wdt1_osc",	&wdt1_osc_ck,	CK_242X),
	CLK(NULL,	"sys_clkout_src", &sys_clkout_src, CK_242X),
	CLK(NULL,	"sys_clkout",	&sys_clkout,	CK_242X),
1773 1774 1775 1776
	CLK(NULL,	"sys_clkout2_src", &sys_clkout2_src, CK_242X),
	CLK(NULL,	"sys_clkout2",	&sys_clkout2,	CK_242X),
	CLK(NULL,	"emul_ck",	&emul_ck,	CK_242X),
	/* mpu domain clocks */
1777
	CLK(NULL,	"mpu_ck",	&mpu_ck,	CK_242X),
1778
	/* dsp domain clocks */
1779 1780
	CLK(NULL,	"dsp_fck",	&dsp_fck,	CK_242X),
	CLK(NULL,	"dsp_irate_ick", &dsp_irate_ick, CK_242X),
1781 1782 1783 1784
	CLK(NULL,	"dsp_ick",	&dsp_ick,	CK_242X),
	CLK(NULL,	"iva1_ifck",	&iva1_ifck,	CK_242X),
	CLK(NULL,	"iva1_mpu_int_ifck", &iva1_mpu_int_ifck, CK_242X),
	/* GFX domain clocks */
1785 1786 1787
	CLK(NULL,	"gfx_3d_fck",	&gfx_3d_fck,	CK_242X),
	CLK(NULL,	"gfx_2d_fck",	&gfx_2d_fck,	CK_242X),
	CLK(NULL,	"gfx_ick",	&gfx_ick,	CK_242X),
1788
	/* DSS domain clocks */
1789 1790 1791 1792
	CLK("omapdss_dss",	"ick",		&dss_ick,	CK_242X),
	CLK("omapdss_dss",	"dss1_fck",	&dss1_fck,	CK_242X),
	CLK("omapdss_dss",	"dss2_fck",	&dss2_fck,	CK_242X),
	CLK("omapdss_dss",	"tv_fck",	&dss_54m_fck,	CK_242X),
1793
	/* L3 domain clocks */
1794 1795 1796
	CLK(NULL,	"core_l3_ck",	&core_l3_ck,	CK_242X),
	CLK(NULL,	"ssi_fck",	&ssi_ssr_sst_fck, CK_242X),
	CLK(NULL,	"usb_l4_ick",	&usb_l4_ick,	CK_242X),
1797
	/* L4 domain clocks */
1798 1799
	CLK(NULL,	"l4_ck",	&l4_ck,		CK_242X),
	CLK(NULL,	"ssi_l4_ick",	&ssi_l4_ick,	CK_242X),
1800
	/* virtual meta-group clock */
1801
	CLK(NULL,	"virt_prcm_set", &virt_prcm_set, CK_242X),
1802
	/* general l4 interface ck, multi-parent functional clk */
1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852
	CLK(NULL,	"gpt1_ick",	&gpt1_ick,	CK_242X),
	CLK(NULL,	"gpt1_fck",	&gpt1_fck,	CK_242X),
	CLK(NULL,	"gpt2_ick",	&gpt2_ick,	CK_242X),
	CLK(NULL,	"gpt2_fck",	&gpt2_fck,	CK_242X),
	CLK(NULL,	"gpt3_ick",	&gpt3_ick,	CK_242X),
	CLK(NULL,	"gpt3_fck",	&gpt3_fck,	CK_242X),
	CLK(NULL,	"gpt4_ick",	&gpt4_ick,	CK_242X),
	CLK(NULL,	"gpt4_fck",	&gpt4_fck,	CK_242X),
	CLK(NULL,	"gpt5_ick",	&gpt5_ick,	CK_242X),
	CLK(NULL,	"gpt5_fck",	&gpt5_fck,	CK_242X),
	CLK(NULL,	"gpt6_ick",	&gpt6_ick,	CK_242X),
	CLK(NULL,	"gpt6_fck",	&gpt6_fck,	CK_242X),
	CLK(NULL,	"gpt7_ick",	&gpt7_ick,	CK_242X),
	CLK(NULL,	"gpt7_fck",	&gpt7_fck,	CK_242X),
	CLK(NULL,	"gpt8_ick",	&gpt8_ick,	CK_242X),
	CLK(NULL,	"gpt8_fck",	&gpt8_fck,	CK_242X),
	CLK(NULL,	"gpt9_ick",	&gpt9_ick,	CK_242X),
	CLK(NULL,	"gpt9_fck",	&gpt9_fck,	CK_242X),
	CLK(NULL,	"gpt10_ick",	&gpt10_ick,	CK_242X),
	CLK(NULL,	"gpt10_fck",	&gpt10_fck,	CK_242X),
	CLK(NULL,	"gpt11_ick",	&gpt11_ick,	CK_242X),
	CLK(NULL,	"gpt11_fck",	&gpt11_fck,	CK_242X),
	CLK(NULL,	"gpt12_ick",	&gpt12_ick,	CK_242X),
	CLK(NULL,	"gpt12_fck",	&gpt12_fck,	CK_242X),
	CLK("omap-mcbsp.1", "ick",	&mcbsp1_ick,	CK_242X),
	CLK("omap-mcbsp.1", "fck",	&mcbsp1_fck,	CK_242X),
	CLK("omap-mcbsp.2", "ick",	&mcbsp2_ick,	CK_242X),
	CLK("omap-mcbsp.2", "fck",	&mcbsp2_fck,	CK_242X),
	CLK("omap2_mcspi.1", "ick",	&mcspi1_ick,	CK_242X),
	CLK("omap2_mcspi.1", "fck",	&mcspi1_fck,	CK_242X),
	CLK("omap2_mcspi.2", "ick",	&mcspi2_ick,	CK_242X),
	CLK("omap2_mcspi.2", "fck",	&mcspi2_fck,	CK_242X),
	CLK(NULL,	"uart1_ick",	&uart1_ick,	CK_242X),
	CLK(NULL,	"uart1_fck",	&uart1_fck,	CK_242X),
	CLK(NULL,	"uart2_ick",	&uart2_ick,	CK_242X),
	CLK(NULL,	"uart2_fck",	&uart2_fck,	CK_242X),
	CLK(NULL,	"uart3_ick",	&uart3_ick,	CK_242X),
	CLK(NULL,	"uart3_fck",	&uart3_fck,	CK_242X),
	CLK(NULL,	"gpios_ick",	&gpios_ick,	CK_242X),
	CLK(NULL,	"gpios_fck",	&gpios_fck,	CK_242X),
	CLK("omap_wdt",	"ick",		&mpu_wdt_ick,	CK_242X),
	CLK("omap_wdt",	"fck",		&mpu_wdt_fck,	CK_242X),
	CLK(NULL,	"sync_32k_ick",	&sync_32k_ick,	CK_242X),
	CLK(NULL,	"wdt1_ick",	&wdt1_ick,	CK_242X),
	CLK(NULL,	"omapctrl_ick",	&omapctrl_ick,	CK_242X),
	CLK("omap24xxcam", "fck",	&cam_fck,	CK_242X),
	CLK("omap24xxcam", "ick",	&cam_ick,	CK_242X),
	CLK(NULL,	"mailboxes_ick", &mailboxes_ick,	CK_242X),
	CLK(NULL,	"wdt4_ick",	&wdt4_ick,	CK_242X),
	CLK(NULL,	"wdt4_fck",	&wdt4_fck,	CK_242X),
1853 1854
	CLK(NULL,	"wdt3_ick",	&wdt3_ick,	CK_242X),
	CLK(NULL,	"wdt3_fck",	&wdt3_fck,	CK_242X),
1855 1856
	CLK(NULL,	"mspro_ick",	&mspro_ick,	CK_242X),
	CLK(NULL,	"mspro_fck",	&mspro_fck,	CK_242X),
1857 1858
	CLK("mmci-omap.0", "ick",	&mmc_ick,	CK_242X),
	CLK("mmci-omap.0", "fck",	&mmc_fck,	CK_242X),
1859 1860
	CLK(NULL,	"fac_ick",	&fac_ick,	CK_242X),
	CLK(NULL,	"fac_fck",	&fac_fck,	CK_242X),
1861 1862
	CLK(NULL,	"eac_ick",	&eac_ick,	CK_242X),
	CLK(NULL,	"eac_fck",	&eac_fck,	CK_242X),
1863 1864
	CLK("omap_hdq.0", "ick",	&hdq_ick,	CK_242X),
	CLK("omap_hdq.1", "fck",	&hdq_fck,	CK_242X),
1865 1866 1867 1868
	CLK("omap_i2c.1", "ick",	&i2c1_ick,	CK_242X),
	CLK("omap_i2c.1", "fck",	&i2c1_fck,	CK_242X),
	CLK("omap_i2c.2", "ick",	&i2c2_ick,	CK_242X),
	CLK("omap_i2c.2", "fck",	&i2c2_fck,	CK_242X),
1869 1870 1871
	CLK(NULL,	"gpmc_fck",	&gpmc_fck,	CK_242X),
	CLK(NULL,	"sdma_fck",	&sdma_fck,	CK_242X),
	CLK(NULL,	"sdma_ick",	&sdma_ick,	CK_242X),
1872 1873
	CLK(NULL,	"vlynq_ick",	&vlynq_ick,	CK_242X),
	CLK(NULL,	"vlynq_fck",	&vlynq_fck,	CK_242X),
1874
	CLK(NULL,	"des_ick",	&des_ick,	CK_242X),
1875
	CLK("omap-sham",	"ick",	&sha_ick,	CK_242X),
1876
	CLK("omap_rng",	"ick",		&rng_ick,	CK_242X),
1877
	CLK("omap-aes",	"ick",	&aes_ick,	CK_242X),
1878 1879
	CLK(NULL,	"pka_ick",	&pka_ick,	CK_242X),
	CLK(NULL,	"usb_fck",	&usb_fck,	CK_242X),
1880
	CLK("musb-hdrc",	"fck",	&osc_ck,	CK_242X),
1881 1882 1883 1884 1885 1886
};

/*
 * init code
 */

1887
int __init omap2420_clk_init(void)
1888 1889 1890 1891
{
	const struct prcm_config *prcm;
	struct omap_clk *c;
	u32 clkrate;
1892 1893 1894 1895 1896

	prcm_clksrc_ctrl = OMAP2420_PRCM_CLKSRC_CTRL;
	cm_idlest_pll = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST);
	cpu_mask = RATE_IN_242X;
	rate_table = omap2420_rate_table;
1897 1898 1899

	clk_init(&omap2_clk_functions);

1900 1901
	for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks);
	     c++)
1902 1903 1904 1905
		clk_preinit(c->lk.clk);

	osc_ck.rate = omap2_osc_clk_recalc(&osc_ck);
	propagate_rate(&osc_ck);
1906
	sys_ck.rate = omap2xxx_sys_clk_recalc(&sys_ck);
1907 1908
	propagate_rate(&sys_ck);

1909 1910 1911 1912 1913 1914
	for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks);
	     c++) {
		clkdev_add(&c->lk);
		clk_register(c->lk.clk);
		omap2_init_clk_clkdm(c->lk.clk);
	}
1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929

	/* Check the MPU rate set by bootloader */
	clkrate = omap2xxx_clk_get_core_rate(&dpll_ck);
	for (prcm = rate_table; prcm->mpu_speed; prcm++) {
		if (!(prcm->flags & cpu_mask))
			continue;
		if (prcm->xtal_speed != sys_ck.rate)
			continue;
		if (prcm->dpll_speed <= clkrate)
			break;
	}
	curr_prcm_set = prcm;

	recalculate_root_clocks();

1930 1931 1932
	pr_info("Clocking rate (Crystal/DPLL/MPU): %ld.%01ld/%ld/%ld MHz\n",
		(sys_ck.rate / 1000000), (sys_ck.rate / 100000) % 10,
		(dpll_ck.rate / 1000000), (mpu_ck.rate / 1000000)) ;
1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946

	/*
	 * Only enable those clocks we will need, let the drivers
	 * enable other clocks as necessary
	 */
	clk_enable_init_clocks();

	/* Avoid sleeping sleeping during omap2_clk_prepare_for_reboot() */
	vclk = clk_get(NULL, "virt_prcm_set");
	sclk = clk_get(NULL, "sys_ck");
	dclk = clk_get(NULL, "dpll_ck");

	return 0;
}
1947