clock2430_data.c 61.3 KB
Newer Older
1
/*
2
 *  linux/arch/arm/mach-omap2/clock2430_data.c
3
 *
4
 *  Copyright (C) 2005-2009 Texas Instruments, Inc.
5
 *  Copyright (C) 2004-2011 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			OMAP2430_CM_REGADDR

/*
 * 2430 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_omap2xxx_dpll_ops,
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

/* func_96m_ck */
static const struct clksel_rate func_96m_apll96_rates[] = {
202
	{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
203
	{ .div = 0 },
204 205
};

206
static const struct clksel_rate func_96m_alt_rates[] = {
207
	{ .div = 1, .val = 1, .flags = RATE_IN_243X },
208 209 210 211 212 213 214 215 216
	{ .div = 0 },
};

static const struct clksel func_96m_clksel[] = {
	{ .parent = &apll96_ck,	.rates = func_96m_apll96_rates },
	{ .parent = &alt_ck,	.rates = func_96m_alt_rates },
	{ .parent = NULL }
};

217 218
static struct clk func_96m_ck = {
	.name		= "func_96m_ck",
219
	.ops		= &clkops_null,
220
	.parent		= &apll96_ck,
221
	.clkdm_name	= "wkup_clkdm",
222 223
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
224
	.clksel_mask	= OMAP2430_96M_SOURCE_MASK,
225 226 227 228 229 230 231
	.clksel		= func_96m_clksel,
	.recalc		= &omap2_clksel_recalc,
};

/* func_48m_ck */

static const struct clksel_rate func_48m_apll96_rates[] = {
232
	{ .div = 2, .val = 0, .flags = RATE_IN_24XX },
233 234 235 236
	{ .div = 0 },
};

static const struct clksel_rate func_48m_alt_rates[] = {
237
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
238 239 240 241 242 243 244
	{ .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 }
245 246 247 248
};

static struct clk func_48m_ck = {
	.name		= "func_48m_ck",
249
	.ops		= &clkops_null,
250
	.parent		= &apll96_ck,	 /* 96M or Alt */
251
	.clkdm_name	= "wkup_clkdm",
252 253
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
254
	.clksel_mask	= OMAP24XX_48M_SOURCE_MASK,
255 256 257 258
	.clksel		= func_48m_clksel,
	.recalc		= &omap2_clksel_recalc,
	.round_rate	= &omap2_clksel_round_rate,
	.set_rate	= &omap2_clksel_set_rate
259 260 261 262
};

static struct clk func_12m_ck = {
	.name		= "func_12m_ck",
263
	.ops		= &clkops_null,
264
	.parent		= &func_48m_ck,
265
	.fixed_div	= 4,
266
	.clkdm_name	= "wkup_clkdm",
267
	.recalc		= &omap_fixed_divisor_recalc,
268 269 270 271 272
};

/* Secure timer, only available in secure mode */
static struct clk wdt1_osc_ck = {
	.name		= "ck_wdt1_osc",
273
	.ops		= &clkops_null, /* RMK: missing? */
274
	.parent		= &osc_ck,
275 276 277 278 279 280 281 282 283 284 285 286
	.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[] = {
287
	{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
288 289 290 291
	{ .div = 0 }
};

static const struct clksel_rate common_clkout_src_sys_rates[] = {
292
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
293 294 295 296
	{ .div = 0 }
};

static const struct clksel_rate common_clkout_src_96m_rates[] = {
297
	{ .div = 1, .val = 2, .flags = RATE_IN_24XX },
298 299 300 301
	{ .div = 0 }
};

static const struct clksel_rate common_clkout_src_54m_rates[] = {
302
	{ .div = 1, .val = 3, .flags = RATE_IN_24XX },
303 304 305 306 307 308 309 310 311 312 313 314 315
	{ .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",
316
	.ops		= &clkops_omap2_dflt,
317
	.parent		= &func_54m_ck,
318
	.clkdm_name	= "wkup_clkdm",
319
	.enable_reg	= OMAP2430_PRCM_CLKOUT_CTRL,
320 321
	.enable_bit	= OMAP24XX_CLKOUT_EN_SHIFT,
	.init		= &omap2_init_clksel_parent,
322
	.clksel_reg	= OMAP2430_PRCM_CLKOUT_CTRL,
323 324 325 326 327 328 329 330
	.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[] = {
331
	{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
332 333 334 335 336 337 338 339 340 341
	{ .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 }
342 343 344 345
};

static struct clk sys_clkout = {
	.name		= "sys_clkout",
346
	.ops		= &clkops_null,
347
	.parent		= &sys_clkout_src,
348
	.clkdm_name	= "wkup_clkdm",
349
	.clksel_reg	= OMAP2430_PRCM_CLKOUT_CTRL,
350 351 352 353 354 355 356
	.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
};

357 358
static struct clk emul_ck = {
	.name		= "emul_ck",
359
	.ops		= &clkops_omap2_dflt,
360
	.parent		= &func_54m_ck,
361
	.clkdm_name	= "wkup_clkdm",
362
	.enable_reg	= OMAP2430_PRCM_CLKEMUL_CTRL,
363 364
	.enable_bit	= OMAP24XX_EMULATION_EN_SHIFT,
	.recalc		= &followparent_recalc,
365 366

};
367

368 369 370 371 372 373 374 375 376 377
/*
 * 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
 *
 */
378
static const struct clksel_rate mpu_core_rates[] = {
379
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
380 381 382 383 384 385 386 387 388
	{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
	{ .div = 0 },
};

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

389 390
static struct clk mpu_ck = {	/* Control cpu */
	.name		= "mpu_ck",
391
	.ops		= &clkops_null,
392
	.parent		= &core_ck,
393
	.clkdm_name	= "mpu_clkdm",
394 395 396
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL),
	.clksel_mask	= OMAP24XX_CLKSEL_MPU_MASK,
397
	.clksel		= mpu_clksel,
398 399
	.recalc		= &omap2_clksel_recalc,
};
400

401
/*
402
 * DSP (2430-IVA2.1) clock domain
403
 * Clocks:
404 405 406 407 408 409
 *	2430: IVA2.1_FCLK (really just DSP_FCLK), IVA2.1_ICLK
 *
 * 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.
410
 */
411
static const struct clksel_rate dsp_fck_core_rates[] = {
412
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
413 414 415 416 417 418 419 420 421 422 423 424 425
	{ .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 = 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",
426
	.ops		= &clkops_omap2_dflt_wait,
427
	.parent		= &core_ck,
428
	.clkdm_name	= "dsp_clkdm",
429 430 431 432 433
	.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,
434 435 436
	.recalc		= &omap2_clksel_recalc,
};

437 438
/* DSP interface clock */
static const struct clksel_rate dsp_irate_ick_rates[] = {
439
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
440 441 442 443 444 445 446 447
	{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
	{ .div = 3, .val = 3, .flags = RATE_IN_243X },
	{ .div = 0 },
};

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

450
/* This clock does not exist as such in the TRM. */
451 452
static struct clk dsp_irate_ick = {
	.name		= "dsp_irate_ick",
453
	.ops		= &clkops_null,
454 455 456 457
	.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,
458 459 460
	.recalc		= &omap2_clksel_recalc,
};

461 462 463
/* 2430 only - EN_DSP controls both dsp fclk and iclk on 2430 */
static struct clk iva2_1_ick = {
	.name		= "iva2_1_ick",
464
	.ops		= &clkops_omap2_dflt_wait,
465 466 467
	.parent		= &dsp_irate_ick,
	.enable_reg	= OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
	.enable_bit	= OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT,
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488
};

/*
 * 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.
 */
489 490
static const struct clksel_rate core_l3_core_rates[] = {
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
491
	{ .div = 4, .val = 4, .flags = RATE_IN_24XX },
492 493 494 495 496 497 498 499 500
	{ .div = 6, .val = 6, .flags = RATE_IN_24XX },
	{ .div = 0 }
};

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

501 502
static struct clk core_l3_ck = {	/* Used for ick and fck, interconnect */
	.name		= "core_l3_ck",
503
	.ops		= &clkops_null,
504
	.parent		= &core_ck,
505
	.clkdm_name	= "core_l3_clkdm",
506 507 508
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
	.clksel_mask	= OMAP24XX_CLKSEL_L3_MASK,
	.clksel		= core_l3_clksel,
509
	.recalc		= &omap2_clksel_recalc,
510 511 512 513 514
};

/* usb_l4_ick */
static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
515
	{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
516 517 518 519 520 521 522
	{ .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 },
523 524
};

525
/* It is unclear from TRM whether usb_l4_ick is really in L3 or L4 clkdm */
526 527
static struct clk usb_l4_ick = {	/* FS-USB interface clock */
	.name		= "usb_l4_ick",
528
	.ops		= &clkops_omap2_iclk_dflt_wait,
529
	.parent		= &core_l3_ck,
530
	.clkdm_name	= "core_l4_clkdm",
531 532 533 534 535
	.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,
536 537 538
	.recalc		= &omap2_clksel_recalc,
};

539 540 541 542 543 544 545 546
/*
 * 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[] = {
547
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
548 549 550 551 552 553 554 555 556 557 558
	{ .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",
559
	.ops		= &clkops_null,
560 561 562 563 564 565 566 567
	.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,
};

568 569 570 571
/*
 * 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.
572
 * SSI_SSR_FCLK, SSI_SST_FCLK, SSI_L4_ICLK
573 574 575
 *
 * ssr = core/1/2/3/4/5, sst = 1/2 ssr.
 */
576 577
static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
578
	{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
579 580 581 582 583 584 585 586 587 588 589
	{ .div = 3, .val = 3, .flags = RATE_IN_24XX },
	{ .div = 4, .val = 4, .flags = RATE_IN_24XX },
	{ .div = 5, .val = 5, .flags = RATE_IN_243X },
	{ .div = 0 }
};

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

590 591
static struct clk ssi_ssr_sst_fck = {
	.name		= "ssi_fck",
592
	.ops		= &clkops_omap2_dflt_wait,
593
	.parent		= &core_ck,
594
	.clkdm_name	= "core_l3_clkdm",
595 596 597 598 599
	.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,
600 601 602
	.recalc		= &omap2_clksel_recalc,
};

603 604 605 606 607 608
/*
 * 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",
609
	.ops		= &clkops_omap2_iclk_dflt_wait,
610 611 612 613 614 615 616
	.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,
};

617

618 619 620 621 622 623 624 625 626 627 628
/*
 * 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.
 *
 */
629 630 631 632 633 634 635

/* 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 },
};

636 637
static struct clk gfx_3d_fck = {
	.name		= "gfx_3d_fck",
638
	.ops		= &clkops_omap2_dflt_wait,
639
	.parent		= &core_l3_ck,
640
	.clkdm_name	= "gfx_clkdm",
641 642 643 644 645
	.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,
646
	.recalc		= &omap2_clksel_recalc,
647 648
	.round_rate	= &omap2_clksel_round_rate,
	.set_rate	= &omap2_clksel_set_rate
649 650 651 652
};

static struct clk gfx_2d_fck = {
	.name		= "gfx_2d_fck",
653
	.ops		= &clkops_omap2_dflt_wait,
654
	.parent		= &core_l3_ck,
655
	.clkdm_name	= "gfx_clkdm",
656 657 658 659 660
	.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,
661 662 663
	.recalc		= &omap2_clksel_recalc,
};

664
/* This interface clock does not have a CM_AUTOIDLE bit */
665 666
static struct clk gfx_ick = {
	.name		= "gfx_ick",		/* From l3 */
667
	.ops		= &clkops_omap2_dflt_wait,
668
	.parent		= &core_l3_ck,
669
	.clkdm_name	= "gfx_clkdm",
670 671 672
	.enable_reg	= OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
	.enable_bit	= OMAP_EN_GFX_SHIFT,
	.recalc		= &followparent_recalc,
673 674 675 676 677 678 679
};

/*
 * Modem clock domain (2430)
 *	CLOCKS:
 *		MDM_OSC_CLK
 *		MDM_ICLK
680
 * These clocks are usable in chassis mode only.
681
 */
682 683
static const struct clksel_rate mdm_ick_core_rates[] = {
	{ .div = 1, .val = 1, .flags = RATE_IN_243X },
684
	{ .div = 4, .val = 4, .flags = RATE_IN_243X },
685 686 687 688 689 690 691 692 693 694
	{ .div = 6, .val = 6, .flags = RATE_IN_243X },
	{ .div = 9, .val = 9, .flags = RATE_IN_243X },
	{ .div = 0 }
};

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

695 696
static struct clk mdm_ick = {		/* used both as a ick and fck */
	.name		= "mdm_ick",
697
	.ops		= &clkops_omap2_iclk_dflt_wait,
698
	.parent		= &core_ck,
699
	.clkdm_name	= "mdm_clkdm",
700 701 702 703 704
	.enable_reg	= OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_ICLKEN),
	.enable_bit	= OMAP2430_CM_ICLKEN_MDM_EN_MDM_SHIFT,
	.clksel_reg	= OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_CLKSEL),
	.clksel_mask	= OMAP2430_CLKSEL_MDM_MASK,
	.clksel		= mdm_ick_clksel,
705 706 707 708 709
	.recalc		= &omap2_clksel_recalc,
};

static struct clk mdm_osc_ck = {
	.name		= "mdm_osc_ck",
710
	.ops		= &clkops_omap2_mdmclk_dflt_wait,
711
	.parent		= &osc_ck,
712
	.clkdm_name	= "mdm_clkdm",
713 714 715
	.enable_reg	= OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_FCLKEN),
	.enable_bit	= OMAP2430_EN_OSC_SHIFT,
	.recalc		= &followparent_recalc,
716 717 718 719 720 721 722 723 724 725
};

/*
 * DSS clock domain
 * CLOCKs:
 * DSS_L4_ICLK, DSS_L3_ICLK,
 * DSS_CLK1, DSS_CLK2, DSS_54MHz_CLK
 *
 * DSS is both initiator and target.
 */
726 727 728
/* XXX Add RATE_NOT_VALIDATED */

static const struct clksel_rate dss1_fck_sys_rates[] = {
729
	{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
730 731 732 733 734 735 736 737 738 739 740 741 742
	{ .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 },
743
	{ .div = 16, .val = 16, .flags = RATE_IN_24XX },
744 745 746 747 748 749 750 751 752
	{ .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 },
};

753 754
static struct clk dss_ick = {		/* Enables both L3,L4 ICLK's */
	.name		= "dss_ick",
755
	.ops		= &clkops_omap2_iclk_dflt,
756
	.parent		= &l4_ck,	/* really both l3 and l4 */
757
	.clkdm_name	= "dss_clkdm",
758 759 760
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_DSS1_SHIFT,
	.recalc		= &followparent_recalc,
761 762 763 764
};

static struct clk dss1_fck = {
	.name		= "dss1_fck",
765
	.ops		= &clkops_omap2_dflt,
766
	.parent		= &core_ck,		/* Core or sys */
767
	.clkdm_name	= "dss_clkdm",
768 769 770 771 772 773
	.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,
774
	.recalc		= &omap2_clksel_recalc,
775 776 777
};

static const struct clksel_rate dss2_fck_sys_rates[] = {
778
	{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
779 780 781 782
	{ .div = 0 }
};

static const struct clksel_rate dss2_fck_48m_rates[] = {
783
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
784 785 786 787 788 789 790
	{ .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 }
791 792 793 794
};

static struct clk dss2_fck = {		/* Alt clk used in power management */
	.name		= "dss2_fck",
795
	.ops		= &clkops_omap2_dflt,
796
	.parent		= &sys_ck,		/* fixed at sys_ck or 48MHz */
797
	.clkdm_name	= "dss_clkdm",
798 799 800 801 802 803
	.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,
804
	.recalc		= &omap2_clksel_recalc,
805 806 807 808
};

static struct clk dss_54m_fck = {	/* Alt clk used in power management */
	.name		= "dss_54m_fck",	/* 54m tv clk */
809
	.ops		= &clkops_omap2_dflt_wait,
810
	.parent		= &func_54m_ck,
811
	.clkdm_name	= "dss_clkdm",
812 813 814
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_TV_SHIFT,
	.recalc		= &followparent_recalc,
815 816 817 818 819 820 821 822
};

/*
 * 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.
 */
823
static const struct clksel_rate gpt_alt_rates[] = {
824
	{ .div = 1, .val = 2, .flags = RATE_IN_24XX },
825 826 827 828 829 830 831 832 833 834
	{ .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 },
};

835 836
static struct clk gpt1_ick = {
	.name		= "gpt1_ick",
837
	.ops		= &clkops_omap2_iclk_dflt_wait,
838
	.parent		= &l4_ck,
839
	.clkdm_name	= "core_l4_clkdm",
840 841 842
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_GPT1_SHIFT,
	.recalc		= &followparent_recalc,
843 844 845 846
};

static struct clk gpt1_fck = {
	.name		= "gpt1_fck",
847
	.ops		= &clkops_omap2_dflt_wait,
848
	.parent		= &func_32k_ck,
849
	.clkdm_name	= "core_l4_clkdm",
850 851 852 853 854 855 856 857 858
	.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
859 860 861 862
};

static struct clk gpt2_ick = {
	.name		= "gpt2_ick",
863
	.ops		= &clkops_omap2_iclk_dflt_wait,
864
	.parent		= &l4_ck,
865
	.clkdm_name	= "core_l4_clkdm",
866 867 868
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT2_SHIFT,
	.recalc		= &followparent_recalc,
869 870 871 872
};

static struct clk gpt2_fck = {
	.name		= "gpt2_fck",
873
	.ops		= &clkops_omap2_dflt_wait,
874
	.parent		= &func_32k_ck,
875
	.clkdm_name	= "core_l4_clkdm",
876 877 878 879 880 881 882
	.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,
883 884 885 886
};

static struct clk gpt3_ick = {
	.name		= "gpt3_ick",
887
	.ops		= &clkops_omap2_iclk_dflt_wait,
888
	.parent		= &l4_ck,
889
	.clkdm_name	= "core_l4_clkdm",
890 891 892
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT3_SHIFT,
	.recalc		= &followparent_recalc,
893 894 895 896
};

static struct clk gpt3_fck = {
	.name		= "gpt3_fck",
897
	.ops		= &clkops_omap2_dflt_wait,
898
	.parent		= &func_32k_ck,
899
	.clkdm_name	= "core_l4_clkdm",
900 901 902 903 904 905 906
	.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,
907 908 909 910
};

static struct clk gpt4_ick = {
	.name		= "gpt4_ick",
911
	.ops		= &clkops_omap2_iclk_dflt_wait,
912
	.parent		= &l4_ck,
913
	.clkdm_name	= "core_l4_clkdm",
914 915 916
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT4_SHIFT,
	.recalc		= &followparent_recalc,
917 918 919 920
};

static struct clk gpt4_fck = {
	.name		= "gpt4_fck",
921
	.ops		= &clkops_omap2_dflt_wait,
922
	.parent		= &func_32k_ck,
923
	.clkdm_name	= "core_l4_clkdm",
924 925 926 927 928 929 930
	.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,
931 932 933 934
};

static struct clk gpt5_ick = {
	.name		= "gpt5_ick",
935
	.ops		= &clkops_omap2_iclk_dflt_wait,
936
	.parent		= &l4_ck,
937
	.clkdm_name	= "core_l4_clkdm",
938 939 940
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT5_SHIFT,
	.recalc		= &followparent_recalc,
941 942 943 944
};

static struct clk gpt5_fck = {
	.name		= "gpt5_fck",
945
	.ops		= &clkops_omap2_dflt_wait,
946
	.parent		= &func_32k_ck,
947
	.clkdm_name	= "core_l4_clkdm",
948 949 950 951 952 953 954
	.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,
955 956 957 958
};

static struct clk gpt6_ick = {
	.name		= "gpt6_ick",
959
	.ops		= &clkops_omap2_iclk_dflt_wait,
960
	.parent		= &l4_ck,
961
	.clkdm_name	= "core_l4_clkdm",
962 963 964
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT6_SHIFT,
	.recalc		= &followparent_recalc,
965 966 967 968
};

static struct clk gpt6_fck = {
	.name		= "gpt6_fck",
969
	.ops		= &clkops_omap2_dflt_wait,
970
	.parent		= &func_32k_ck,
971
	.clkdm_name	= "core_l4_clkdm",
972 973 974 975 976 977 978
	.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,
979 980 981 982
};

static struct clk gpt7_ick = {
	.name		= "gpt7_ick",
983
	.ops		= &clkops_omap2_iclk_dflt_wait,
984
	.parent		= &l4_ck,
985 986 987
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT7_SHIFT,
	.recalc		= &followparent_recalc,
988 989 990 991
};

static struct clk gpt7_fck = {
	.name		= "gpt7_fck",
992
	.ops		= &clkops_omap2_dflt_wait,
993
	.parent		= &func_32k_ck,
994
	.clkdm_name	= "core_l4_clkdm",
995 996 997 998 999 1000 1001
	.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,
1002 1003 1004 1005
};

static struct clk gpt8_ick = {
	.name		= "gpt8_ick",
1006
	.ops		= &clkops_omap2_iclk_dflt_wait,
1007
	.parent		= &l4_ck,
1008
	.clkdm_name	= "core_l4_clkdm",
1009 1010 1011
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT8_SHIFT,
	.recalc		= &followparent_recalc,
1012 1013 1014 1015
};

static struct clk gpt8_fck = {
	.name		= "gpt8_fck",
1016
	.ops		= &clkops_omap2_dflt_wait,
1017
	.parent		= &func_32k_ck,
1018
	.clkdm_name	= "core_l4_clkdm",
1019 1020 1021 1022 1023 1024 1025
	.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,
1026 1027 1028 1029
};

static struct clk gpt9_ick = {
	.name		= "gpt9_ick",
1030
	.ops		= &clkops_omap2_iclk_dflt_wait,
1031
	.parent		= &l4_ck,
1032
	.clkdm_name	= "core_l4_clkdm",
1033 1034 1035
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT9_SHIFT,
	.recalc		= &followparent_recalc,
1036 1037 1038 1039
};

static struct clk gpt9_fck = {
	.name		= "gpt9_fck",
1040
	.ops		= &clkops_omap2_dflt_wait,
1041
	.parent		= &func_32k_ck,
1042
	.clkdm_name	= "core_l4_clkdm",
1043 1044 1045 1046 1047 1048 1049
	.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,
1050 1051 1052 1053
};

static struct clk gpt10_ick = {
	.name		= "gpt10_ick",
1054
	.ops		= &clkops_omap2_iclk_dflt_wait,
1055
	.parent		= &l4_ck,
1056
	.clkdm_name	= "core_l4_clkdm",
1057 1058 1059
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT10_SHIFT,
	.recalc		= &followparent_recalc,
1060 1061 1062 1063
};

static struct clk gpt10_fck = {
	.name		= "gpt10_fck",
1064
	.ops		= &clkops_omap2_dflt_wait,
1065
	.parent		= &func_32k_ck,
1066
	.clkdm_name	= "core_l4_clkdm",
1067 1068 1069 1070 1071 1072 1073
	.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,
1074 1075 1076 1077
};

static struct clk gpt11_ick = {
	.name		= "gpt11_ick",
1078
	.ops		= &clkops_omap2_iclk_dflt_wait,
1079
	.parent		= &l4_ck,
1080
	.clkdm_name	= "core_l4_clkdm",
1081 1082 1083
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT11_SHIFT,
	.recalc		= &followparent_recalc,
1084 1085 1086 1087
};

static struct clk gpt11_fck = {
	.name		= "gpt11_fck",
1088
	.ops		= &clkops_omap2_dflt_wait,
1089
	.parent		= &func_32k_ck,
1090
	.clkdm_name	= "core_l4_clkdm",
1091 1092 1093 1094 1095 1096 1097
	.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,
1098 1099 1100 1101
};

static struct clk gpt12_ick = {
	.name		= "gpt12_ick",
1102
	.ops		= &clkops_omap2_iclk_dflt_wait,
1103
	.parent		= &l4_ck,
1104
	.clkdm_name	= "core_l4_clkdm",
1105 1106 1107
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT12_SHIFT,
	.recalc		= &followparent_recalc,
1108 1109 1110 1111
};

static struct clk gpt12_fck = {
	.name		= "gpt12_fck",
1112
	.ops		= &clkops_omap2_dflt_wait,
1113
	.parent		= &secure_32k_ck,
1114
	.clkdm_name	= "core_l4_clkdm",
1115 1116 1117 1118 1119 1120 1121
	.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,
1122 1123 1124
};

static struct clk mcbsp1_ick = {
1125
	.name		= "mcbsp1_ick",
1126
	.ops		= &clkops_omap2_iclk_dflt_wait,
1127
	.parent		= &l4_ck,
1128
	.clkdm_name	= "core_l4_clkdm",
1129 1130 1131
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_MCBSP1_SHIFT,
	.recalc		= &followparent_recalc,
1132 1133
};

1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149
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 }
};

1150
static struct clk mcbsp1_fck = {
1151
	.name		= "mcbsp1_fck",
1152
	.ops		= &clkops_omap2_dflt_wait,
1153
	.parent		= &func_96m_ck,
1154
	.init		= &omap2_init_clksel_parent,
1155
	.clkdm_name	= "core_l4_clkdm",
1156 1157
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_MCBSP1_SHIFT,
1158 1159 1160 1161
	.clksel_reg	= OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
	.clksel_mask	= OMAP2_MCBSP1_CLKS_MASK,
	.clksel		= mcbsp_fck_clksel,
	.recalc		= &omap2_clksel_recalc,
1162 1163 1164
};

static struct clk mcbsp2_ick = {
1165
	.name		= "mcbsp2_ick",
1166
	.ops		= &clkops_omap2_iclk_dflt_wait,
1167
	.parent		= &l4_ck,
1168
	.clkdm_name	= "core_l4_clkdm",
1169 1170 1171
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_MCBSP2_SHIFT,
	.recalc		= &followparent_recalc,
1172 1173 1174
};

static struct clk mcbsp2_fck = {
1175
	.name		= "mcbsp2_fck",
1176
	.ops		= &clkops_omap2_dflt_wait,
1177
	.parent		= &func_96m_ck,
1178
	.init		= &omap2_init_clksel_parent,
1179
	.clkdm_name	= "core_l4_clkdm",
1180 1181
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_MCBSP2_SHIFT,
1182 1183 1184 1185
	.clksel_reg	= OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
	.clksel_mask	= OMAP2_MCBSP2_CLKS_MASK,
	.clksel		= mcbsp_fck_clksel,
	.recalc		= &omap2_clksel_recalc,
1186 1187 1188
};

static struct clk mcbsp3_ick = {
1189
	.name		= "mcbsp3_ick",
1190
	.ops		= &clkops_omap2_iclk_dflt_wait,
1191
	.parent		= &l4_ck,
1192
	.clkdm_name	= "core_l4_clkdm",
1193 1194 1195
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_MCBSP3_SHIFT,
	.recalc		= &followparent_recalc,
1196 1197 1198
};

static struct clk mcbsp3_fck = {
1199
	.name		= "mcbsp3_fck",
1200
	.ops		= &clkops_omap2_dflt_wait,
1201
	.parent		= &func_96m_ck,
1202
	.init		= &omap2_init_clksel_parent,
1203
	.clkdm_name	= "core_l4_clkdm",
1204 1205
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_MCBSP3_SHIFT,
1206 1207 1208 1209
	.clksel_reg	= OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
	.clksel_mask	= OMAP2_MCBSP3_CLKS_MASK,
	.clksel		= mcbsp_fck_clksel,
	.recalc		= &omap2_clksel_recalc,
1210 1211 1212
};

static struct clk mcbsp4_ick = {
1213
	.name		= "mcbsp4_ick",
1214
	.ops		= &clkops_omap2_iclk_dflt_wait,
1215
	.parent		= &l4_ck,
1216
	.clkdm_name	= "core_l4_clkdm",
1217 1218 1219
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_MCBSP4_SHIFT,
	.recalc		= &followparent_recalc,
1220 1221 1222
};

static struct clk mcbsp4_fck = {
1223
	.name		= "mcbsp4_fck",
1224
	.ops		= &clkops_omap2_dflt_wait,
1225
	.parent		= &func_96m_ck,
1226
	.init		= &omap2_init_clksel_parent,
1227
	.clkdm_name	= "core_l4_clkdm",
1228 1229
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_MCBSP4_SHIFT,
1230 1231 1232 1233
	.clksel_reg	= OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
	.clksel_mask	= OMAP2_MCBSP4_CLKS_MASK,
	.clksel		= mcbsp_fck_clksel,
	.recalc		= &omap2_clksel_recalc,
1234 1235 1236
};

static struct clk mcbsp5_ick = {
1237
	.name		= "mcbsp5_ick",
1238
	.ops		= &clkops_omap2_iclk_dflt_wait,
1239
	.parent		= &l4_ck,
1240
	.clkdm_name	= "core_l4_clkdm",
1241 1242 1243
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_MCBSP5_SHIFT,
	.recalc		= &followparent_recalc,
1244 1245 1246
};

static struct clk mcbsp5_fck = {
1247
	.name		= "mcbsp5_fck",
1248
	.ops		= &clkops_omap2_dflt_wait,
1249
	.parent		= &func_96m_ck,
1250
	.init		= &omap2_init_clksel_parent,
1251
	.clkdm_name	= "core_l4_clkdm",
1252 1253
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_MCBSP5_SHIFT,
1254 1255 1256 1257
	.clksel_reg	= OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
	.clksel_mask	= OMAP2_MCBSP5_CLKS_MASK,
	.clksel		= mcbsp_fck_clksel,
	.recalc		= &omap2_clksel_recalc,
1258 1259 1260
};

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

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

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

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

static struct clk mcspi3_ick = {
1301
	.name		= "mcspi3_ick",
1302
	.ops		= &clkops_omap2_iclk_dflt_wait,
1303
	.parent		= &l4_ck,
1304
	.clkdm_name	= "core_l4_clkdm",
1305 1306 1307
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_MCSPI3_SHIFT,
	.recalc		= &followparent_recalc,
1308 1309 1310
};

static struct clk mcspi3_fck = {
1311
	.name		= "mcspi3_fck",
1312
	.ops		= &clkops_omap2_dflt_wait,
1313
	.parent		= &func_48m_ck,
1314
	.clkdm_name	= "core_l4_clkdm",
1315 1316 1317
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_MCSPI3_SHIFT,
	.recalc		= &followparent_recalc,
1318 1319 1320 1321
};

static struct clk uart1_ick = {
	.name		= "uart1_ick",
1322
	.ops		= &clkops_omap2_iclk_dflt_wait,
1323
	.parent		= &l4_ck,
1324
	.clkdm_name	= "core_l4_clkdm",
1325 1326 1327
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_UART1_SHIFT,
	.recalc		= &followparent_recalc,
1328 1329 1330 1331
};

static struct clk uart1_fck = {
	.name		= "uart1_fck",
1332
	.ops		= &clkops_omap2_dflt_wait,
1333
	.parent		= &func_48m_ck,
1334
	.clkdm_name	= "core_l4_clkdm",
1335 1336 1337
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_UART1_SHIFT,
	.recalc		= &followparent_recalc,
1338 1339 1340 1341
};

static struct clk uart2_ick = {
	.name		= "uart2_ick",
1342
	.ops		= &clkops_omap2_iclk_dflt_wait,
1343
	.parent		= &l4_ck,
1344
	.clkdm_name	= "core_l4_clkdm",
1345 1346 1347
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_UART2_SHIFT,
	.recalc		= &followparent_recalc,
1348 1349 1350 1351
};

static struct clk uart2_fck = {
	.name		= "uart2_fck",
1352
	.ops		= &clkops_omap2_dflt_wait,
1353
	.parent		= &func_48m_ck,
1354
	.clkdm_name	= "core_l4_clkdm",
1355 1356 1357
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_UART2_SHIFT,
	.recalc		= &followparent_recalc,
1358 1359 1360 1361
};

static struct clk uart3_ick = {
	.name		= "uart3_ick",
1362
	.ops		= &clkops_omap2_iclk_dflt_wait,
1363
	.parent		= &l4_ck,
1364
	.clkdm_name	= "core_l4_clkdm",
1365 1366 1367
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP24XX_EN_UART3_SHIFT,
	.recalc		= &followparent_recalc,
1368 1369 1370 1371
};

static struct clk uart3_fck = {
	.name		= "uart3_fck",
1372
	.ops		= &clkops_omap2_dflt_wait,
1373
	.parent		= &func_48m_ck,
1374
	.clkdm_name	= "core_l4_clkdm",
1375 1376 1377
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP24XX_EN_UART3_SHIFT,
	.recalc		= &followparent_recalc,
1378 1379 1380 1381
};

static struct clk gpios_ick = {
	.name		= "gpios_ick",
1382
	.ops		= &clkops_omap2_iclk_dflt_wait,
1383
	.parent		= &l4_ck,
1384
	.clkdm_name	= "core_l4_clkdm",
1385 1386 1387
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_GPIOS_SHIFT,
	.recalc		= &followparent_recalc,
1388 1389 1390 1391
};

static struct clk gpios_fck = {
	.name		= "gpios_fck",
1392
	.ops		= &clkops_omap2_dflt_wait,
1393
	.parent		= &func_32k_ck,
1394
	.clkdm_name	= "wkup_clkdm",
1395 1396 1397
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
	.enable_bit	= OMAP24XX_EN_GPIOS_SHIFT,
	.recalc		= &followparent_recalc,
1398 1399 1400 1401
};

static struct clk mpu_wdt_ick = {
	.name		= "mpu_wdt_ick",
1402
	.ops		= &clkops_omap2_iclk_dflt_wait,
1403
	.parent		= &l4_ck,
1404
	.clkdm_name	= "core_l4_clkdm",
1405 1406 1407
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_MPU_WDT_SHIFT,
	.recalc		= &followparent_recalc,
1408 1409 1410 1411
};

static struct clk mpu_wdt_fck = {
	.name		= "mpu_wdt_fck",
1412
	.ops		= &clkops_omap2_dflt_wait,
1413
	.parent		= &func_32k_ck,
1414
	.clkdm_name	= "wkup_clkdm",
1415 1416 1417
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
	.enable_bit	= OMAP24XX_EN_MPU_WDT_SHIFT,
	.recalc		= &followparent_recalc,
1418 1419 1420 1421
};

static struct clk sync_32k_ick = {
	.name		= "sync_32k_ick",
1422
	.ops		= &clkops_omap2_iclk_dflt_wait,
1423
	.parent		= &l4_ck,
1424
	.flags		= ENABLE_ON_INIT,
1425
	.clkdm_name	= "core_l4_clkdm",
1426 1427 1428
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_32KSYNC_SHIFT,
	.recalc		= &followparent_recalc,
1429
};
1430

1431 1432
static struct clk wdt1_ick = {
	.name		= "wdt1_ick",
1433
	.ops		= &clkops_omap2_iclk_dflt_wait,
1434
	.parent		= &l4_ck,
1435
	.clkdm_name	= "core_l4_clkdm",
1436 1437 1438
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_WDT1_SHIFT,
	.recalc		= &followparent_recalc,
1439
};
1440

1441 1442
static struct clk omapctrl_ick = {
	.name		= "omapctrl_ick",
1443
	.ops		= &clkops_omap2_iclk_dflt_wait,
1444
	.parent		= &l4_ck,
1445
	.flags		= ENABLE_ON_INIT,
1446
	.clkdm_name	= "core_l4_clkdm",
1447 1448 1449
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_OMAPCTRL_SHIFT,
	.recalc		= &followparent_recalc,
1450
};
1451

1452 1453
static struct clk icr_ick = {
	.name		= "icr_ick",
1454
	.ops		= &clkops_omap2_iclk_dflt_wait,
1455
	.parent		= &l4_ck,
1456
	.clkdm_name	= "core_l4_clkdm",
1457 1458 1459
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP2430_EN_ICR_SHIFT,
	.recalc		= &followparent_recalc,
1460 1461 1462 1463
};

static struct clk cam_ick = {
	.name		= "cam_ick",
1464
	.ops		= &clkops_omap2_iclk_dflt,
1465
	.parent		= &l4_ck,
1466
	.clkdm_name	= "core_l4_clkdm",
1467 1468 1469
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_CAM_SHIFT,
	.recalc		= &followparent_recalc,
1470 1471
};

1472 1473 1474 1475 1476
/*
 * 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.
 */
1477 1478
static struct clk cam_fck = {
	.name		= "cam_fck",
1479
	.ops		= &clkops_omap2_dflt,
1480
	.parent		= &func_96m_ck,
1481
	.clkdm_name	= "core_l3_clkdm",
1482 1483 1484
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_CAM_SHIFT,
	.recalc		= &followparent_recalc,
1485 1486 1487 1488
};

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

static struct clk wdt4_ick = {
	.name		= "wdt4_ick",
1499
	.ops		= &clkops_omap2_iclk_dflt_wait,
1500
	.parent		= &l4_ck,
1501
	.clkdm_name	= "core_l4_clkdm",
1502 1503 1504
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_WDT4_SHIFT,
	.recalc		= &followparent_recalc,
1505 1506 1507 1508
};

static struct clk wdt4_fck = {
	.name		= "wdt4_fck",
1509
	.ops		= &clkops_omap2_dflt_wait,
1510
	.parent		= &func_32k_ck,
1511
	.clkdm_name	= "core_l4_clkdm",
1512 1513 1514
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_WDT4_SHIFT,
	.recalc		= &followparent_recalc,
1515 1516 1517 1518
};

static struct clk mspro_ick = {
	.name		= "mspro_ick",
1519
	.ops		= &clkops_omap2_iclk_dflt_wait,
1520
	.parent		= &l4_ck,
1521
	.clkdm_name	= "core_l4_clkdm",
1522 1523 1524
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_MSPRO_SHIFT,
	.recalc		= &followparent_recalc,
1525 1526 1527 1528
};

static struct clk mspro_fck = {
	.name		= "mspro_fck",
1529
	.ops		= &clkops_omap2_dflt_wait,
1530
	.parent		= &func_96m_ck,
1531
	.clkdm_name	= "core_l4_clkdm",
1532 1533 1534
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_MSPRO_SHIFT,
	.recalc		= &followparent_recalc,
1535 1536 1537 1538
};

static struct clk fac_ick = {
	.name		= "fac_ick",
1539
	.ops		= &clkops_omap2_iclk_dflt_wait,
1540
	.parent		= &l4_ck,
1541
	.clkdm_name	= "core_l4_clkdm",
1542 1543 1544
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_FAC_SHIFT,
	.recalc		= &followparent_recalc,
1545 1546 1547 1548
};

static struct clk fac_fck = {
	.name		= "fac_fck",
1549
	.ops		= &clkops_omap2_dflt_wait,
1550
	.parent		= &func_12m_ck,
1551
	.clkdm_name	= "core_l4_clkdm",
1552 1553 1554
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_FAC_SHIFT,
	.recalc		= &followparent_recalc,
1555 1556 1557 1558
};

static struct clk hdq_ick = {
	.name		= "hdq_ick",
1559
	.ops		= &clkops_omap2_iclk_dflt_wait,
1560
	.parent		= &l4_ck,
1561
	.clkdm_name	= "core_l4_clkdm",
1562 1563 1564
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_HDQ_SHIFT,
	.recalc		= &followparent_recalc,
1565 1566 1567 1568
};

static struct clk hdq_fck = {
	.name		= "hdq_fck",
1569
	.ops		= &clkops_omap2_dflt_wait,
1570
	.parent		= &func_12m_ck,
1571
	.clkdm_name	= "core_l4_clkdm",
1572 1573 1574
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_HDQ_SHIFT,
	.recalc		= &followparent_recalc,
1575 1576
};

1577 1578 1579 1580
/*
 * XXX This is marked as a 2420-only define, but it claims to be present
 * on 2430 also.  Double-check.
 */
1581
static struct clk i2c2_ick = {
1582
	.name		= "i2c2_ick",
1583
	.ops		= &clkops_omap2_iclk_dflt_wait,
1584
	.parent		= &l4_ck,
1585
	.clkdm_name	= "core_l4_clkdm",
1586 1587 1588
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP2420_EN_I2C2_SHIFT,
	.recalc		= &followparent_recalc,
1589 1590 1591
};

static struct clk i2chs2_fck = {
1592
	.name		= "i2chs2_fck",
1593
	.ops		= &clkops_omap2430_i2chs_wait,
1594
	.parent		= &func_96m_ck,
1595
	.clkdm_name	= "core_l4_clkdm",
1596 1597 1598
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_I2CHS2_SHIFT,
	.recalc		= &followparent_recalc,
1599 1600
};

1601 1602 1603 1604
/*
 * XXX This is marked as a 2420-only define, but it claims to be present
 * on 2430 also.  Double-check.
 */
1605
static struct clk i2c1_ick = {
1606
	.name		= "i2c1_ick",
1607
	.ops		= &clkops_omap2_iclk_dflt_wait,
1608
	.parent		= &l4_ck,
1609
	.clkdm_name	= "core_l4_clkdm",
1610 1611 1612
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP2420_EN_I2C1_SHIFT,
	.recalc		= &followparent_recalc,
1613 1614 1615
};

static struct clk i2chs1_fck = {
1616
	.name		= "i2chs1_fck",
1617
	.ops		= &clkops_omap2430_i2chs_wait,
1618
	.parent		= &func_96m_ck,
1619
	.clkdm_name	= "core_l4_clkdm",
1620 1621 1622 1623 1624
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_I2CHS1_SHIFT,
	.recalc		= &followparent_recalc,
};

1625 1626 1627 1628
/*
 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
 * accesses derived from this data.
 */
1629 1630
static struct clk gpmc_fck = {
	.name		= "gpmc_fck",
1631
	.ops		= &clkops_omap2_iclk_idle_only,
1632
	.parent		= &core_l3_ck,
1633
	.flags		= ENABLE_ON_INIT,
1634
	.clkdm_name	= "core_l3_clkdm",
1635 1636
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
	.enable_bit	= OMAP24XX_AUTO_GPMC_SHIFT,
1637 1638 1639 1640 1641
	.recalc		= &followparent_recalc,
};

static struct clk sdma_fck = {
	.name		= "sdma_fck",
1642
	.ops		= &clkops_null, /* RMK: missing? */
1643
	.parent		= &core_l3_ck,
1644
	.clkdm_name	= "core_l3_clkdm",
1645 1646 1647
	.recalc		= &followparent_recalc,
};

1648 1649 1650 1651
/*
 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
 * accesses derived from this data.
 */
1652 1653
static struct clk sdma_ick = {
	.name		= "sdma_ick",
1654
	.ops		= &clkops_omap2_iclk_idle_only,
1655
	.parent		= &core_l3_ck,
1656
	.clkdm_name	= "core_l3_clkdm",
1657 1658
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
	.enable_bit	= OMAP24XX_AUTO_SDMA_SHIFT,
1659
	.recalc		= &followparent_recalc,
1660 1661 1662 1663
};

static struct clk sdrc_ick = {
	.name		= "sdrc_ick",
1664
	.ops		= &clkops_omap2_iclk_idle_only,
1665
	.parent		= &core_l3_ck,
1666
	.flags		= ENABLE_ON_INIT,
1667
	.clkdm_name	= "core_l3_clkdm",
1668 1669 1670
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
	.enable_bit	= OMAP2430_EN_SDRC_SHIFT,
	.recalc		= &followparent_recalc,
1671 1672 1673 1674
};

static struct clk des_ick = {
	.name		= "des_ick",
1675
	.ops		= &clkops_omap2_iclk_dflt_wait,
1676
	.parent		= &l4_ck,
1677
	.clkdm_name	= "core_l4_clkdm",
1678 1679 1680
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
	.enable_bit	= OMAP24XX_EN_DES_SHIFT,
	.recalc		= &followparent_recalc,
1681 1682 1683 1684
};

static struct clk sha_ick = {
	.name		= "sha_ick",
1685
	.ops		= &clkops_omap2_iclk_dflt_wait,
1686
	.parent		= &l4_ck,
1687
	.clkdm_name	= "core_l4_clkdm",
1688 1689 1690
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
	.enable_bit	= OMAP24XX_EN_SHA_SHIFT,
	.recalc		= &followparent_recalc,
1691 1692 1693 1694
};

static struct clk rng_ick = {
	.name		= "rng_ick",
1695
	.ops		= &clkops_omap2_iclk_dflt_wait,
1696
	.parent		= &l4_ck,
1697
	.clkdm_name	= "core_l4_clkdm",
1698 1699 1700
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
	.enable_bit	= OMAP24XX_EN_RNG_SHIFT,
	.recalc		= &followparent_recalc,
1701 1702 1703 1704
};

static struct clk aes_ick = {
	.name		= "aes_ick",
1705
	.ops		= &clkops_omap2_iclk_dflt_wait,
1706
	.parent		= &l4_ck,
1707
	.clkdm_name	= "core_l4_clkdm",
1708 1709 1710
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
	.enable_bit	= OMAP24XX_EN_AES_SHIFT,
	.recalc		= &followparent_recalc,
1711 1712 1713 1714
};

static struct clk pka_ick = {
	.name		= "pka_ick",
1715
	.ops		= &clkops_omap2_iclk_dflt_wait,
1716
	.parent		= &l4_ck,
1717
	.clkdm_name	= "core_l4_clkdm",
1718 1719 1720
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
	.enable_bit	= OMAP24XX_EN_PKA_SHIFT,
	.recalc		= &followparent_recalc,
1721 1722 1723 1724
};

static struct clk usb_fck = {
	.name		= "usb_fck",
1725
	.ops		= &clkops_omap2_dflt_wait,
1726
	.parent		= &func_48m_ck,
1727
	.clkdm_name	= "core_l3_clkdm",
1728 1729 1730
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP24XX_EN_USB_SHIFT,
	.recalc		= &followparent_recalc,
1731 1732 1733 1734
};

static struct clk usbhs_ick = {
	.name		= "usbhs_ick",
1735
	.ops		= &clkops_omap2_iclk_dflt_wait,
1736
	.parent		= &core_l3_ck,
1737
	.clkdm_name	= "core_l3_clkdm",
1738 1739 1740
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_USBHS_SHIFT,
	.recalc		= &followparent_recalc,
1741 1742 1743
};

static struct clk mmchs1_ick = {
1744
	.name		= "mmchs1_ick",
1745
	.ops		= &clkops_omap2_iclk_dflt_wait,
1746
	.parent		= &l4_ck,
1747
	.clkdm_name	= "core_l4_clkdm",
1748 1749 1750
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_MMCHS1_SHIFT,
	.recalc		= &followparent_recalc,
1751 1752 1753
};

static struct clk mmchs1_fck = {
1754
	.name		= "mmchs1_fck",
1755
	.ops		= &clkops_omap2_dflt_wait,
1756
	.parent		= &func_96m_ck,
1757
	.clkdm_name	= "core_l3_clkdm",
1758 1759 1760
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_MMCHS1_SHIFT,
	.recalc		= &followparent_recalc,
1761 1762 1763
};

static struct clk mmchs2_ick = {
1764
	.name		= "mmchs2_ick",
1765
	.ops		= &clkops_omap2_iclk_dflt_wait,
1766
	.parent		= &l4_ck,
1767
	.clkdm_name	= "core_l4_clkdm",
1768 1769 1770
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_MMCHS2_SHIFT,
	.recalc		= &followparent_recalc,
1771 1772 1773
};

static struct clk mmchs2_fck = {
1774
	.name		= "mmchs2_fck",
1775
	.ops		= &clkops_omap2_dflt_wait,
1776
	.parent		= &func_96m_ck,
1777 1778 1779
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_MMCHS2_SHIFT,
	.recalc		= &followparent_recalc,
1780 1781 1782 1783
};

static struct clk gpio5_ick = {
	.name		= "gpio5_ick",
1784
	.ops		= &clkops_omap2_iclk_dflt_wait,
1785
	.parent		= &l4_ck,
1786
	.clkdm_name	= "core_l4_clkdm",
1787 1788 1789
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_GPIO5_SHIFT,
	.recalc		= &followparent_recalc,
1790 1791 1792 1793
};

static struct clk gpio5_fck = {
	.name		= "gpio5_fck",
1794
	.ops		= &clkops_omap2_dflt_wait,
1795
	.parent		= &func_32k_ck,
1796
	.clkdm_name	= "core_l4_clkdm",
1797 1798 1799
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_GPIO5_SHIFT,
	.recalc		= &followparent_recalc,
1800 1801 1802 1803
};

static struct clk mdm_intc_ick = {
	.name		= "mdm_intc_ick",
1804
	.ops		= &clkops_omap2_iclk_dflt_wait,
1805
	.parent		= &l4_ck,
1806
	.clkdm_name	= "core_l4_clkdm",
1807 1808 1809
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_MDM_INTC_SHIFT,
	.recalc		= &followparent_recalc,
1810 1811 1812
};

static struct clk mmchsdb1_fck = {
1813
	.name		= "mmchsdb1_fck",
1814
	.ops		= &clkops_omap2_dflt_wait,
1815
	.parent		= &func_32k_ck,
1816
	.clkdm_name	= "core_l4_clkdm",
1817 1818 1819
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_MMCHSDB1_SHIFT,
	.recalc		= &followparent_recalc,
1820 1821 1822
};

static struct clk mmchsdb2_fck = {
1823
	.name		= "mmchsdb2_fck",
1824
	.ops		= &clkops_omap2_dflt_wait,
1825
	.parent		= &func_32k_ck,
1826
	.clkdm_name	= "core_l4_clkdm",
1827 1828 1829
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_MMCHSDB2_SHIFT,
	.recalc		= &followparent_recalc,
1830
};
1831

1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847
/*
 * 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",
1848
	.ops		= &clkops_null,
1849
	.parent		= &mpu_ck,	/* Indexed by mpu speed, no parent */
1850
	.recalc		= &omap2_table_mpu_recalc,	/* sets are keyed on mpu rate */
1851 1852 1853
	.set_rate	= &omap2_select_table_rate,
	.round_rate	= &omap2_round_to_table_rate,
};
1854

1855 1856 1857 1858 1859

/*
 * clkdev integration
 */

1860
static struct omap_clk omap2430_clks[] = {
1861
	/* external root sources */
1862 1863 1864 1865 1866
	CLK(NULL,	"func_32k_ck",	&func_32k_ck,	CK_243X),
	CLK(NULL,	"secure_32k_ck", &secure_32k_ck, CK_243X),
	CLK(NULL,	"osc_ck",	&osc_ck,	CK_243X),
	CLK(NULL,	"sys_ck",	&sys_ck,	CK_243X),
	CLK(NULL,	"alt_ck",	&alt_ck,	CK_243X),
1867 1868 1869 1870 1871 1872
	CLK("omap-mcbsp.1",	"pad_fck",	&mcbsp_clks,	CK_243X),
	CLK("omap-mcbsp.2",	"pad_fck",	&mcbsp_clks,	CK_243X),
	CLK("omap-mcbsp.3",	"pad_fck",	&mcbsp_clks,	CK_243X),
	CLK("omap-mcbsp.4",	"pad_fck",	&mcbsp_clks,	CK_243X),
	CLK("omap-mcbsp.5",	"pad_fck",	&mcbsp_clks,	CK_243X),
	CLK(NULL,	"mcbsp_clks",	&mcbsp_clks,	CK_243X),
1873
	/* internal analog sources */
1874 1875 1876
	CLK(NULL,	"dpll_ck",	&dpll_ck,	CK_243X),
	CLK(NULL,	"apll96_ck",	&apll96_ck,	CK_243X),
	CLK(NULL,	"apll54_ck",	&apll54_ck,	CK_243X),
1877
	/* internal prcm root sources */
1878 1879
	CLK(NULL,	"func_54m_ck",	&func_54m_ck,	CK_243X),
	CLK(NULL,	"core_ck",	&core_ck,	CK_243X),
1880 1881 1882 1883 1884
	CLK("omap-mcbsp.1",	"prcm_fck",	&func_96m_ck,	CK_243X),
	CLK("omap-mcbsp.2",	"prcm_fck",	&func_96m_ck,	CK_243X),
	CLK("omap-mcbsp.3",	"prcm_fck",	&func_96m_ck,	CK_243X),
	CLK("omap-mcbsp.4",	"prcm_fck",	&func_96m_ck,	CK_243X),
	CLK("omap-mcbsp.5",	"prcm_fck",	&func_96m_ck,	CK_243X),
1885 1886 1887 1888 1889 1890 1891
	CLK(NULL,	"func_96m_ck",	&func_96m_ck,	CK_243X),
	CLK(NULL,	"func_48m_ck",	&func_48m_ck,	CK_243X),
	CLK(NULL,	"func_12m_ck",	&func_12m_ck,	CK_243X),
	CLK(NULL,	"ck_wdt1_osc",	&wdt1_osc_ck,	CK_243X),
	CLK(NULL,	"sys_clkout_src", &sys_clkout_src, CK_243X),
	CLK(NULL,	"sys_clkout",	&sys_clkout,	CK_243X),
	CLK(NULL,	"emul_ck",	&emul_ck,	CK_243X),
1892
	/* mpu domain clocks */
1893
	CLK(NULL,	"mpu_ck",	&mpu_ck,	CK_243X),
1894
	/* dsp domain clocks */
1895 1896
	CLK(NULL,	"dsp_fck",	&dsp_fck,	CK_243X),
	CLK(NULL,	"dsp_irate_ick", &dsp_irate_ick, CK_243X),
1897 1898
	CLK(NULL,	"iva2_1_ick",	&iva2_1_ick,	CK_243X),
	/* GFX domain clocks */
1899 1900 1901
	CLK(NULL,	"gfx_3d_fck",	&gfx_3d_fck,	CK_243X),
	CLK(NULL,	"gfx_2d_fck",	&gfx_2d_fck,	CK_243X),
	CLK(NULL,	"gfx_ick",	&gfx_ick,	CK_243X),
1902 1903 1904 1905
	/* Modem domain clocks */
	CLK(NULL,	"mdm_ick",	&mdm_ick,	CK_243X),
	CLK(NULL,	"mdm_osc_ck",	&mdm_osc_ck,	CK_243X),
	/* DSS domain clocks */
1906 1907 1908 1909
	CLK("omapdss",	"ick",		&dss_ick,	CK_243X),
	CLK("omapdss",	"dss1_fck",	&dss1_fck,	CK_243X),
	CLK("omapdss",	"dss2_fck",	&dss2_fck,	CK_243X),
	CLK("omapdss",	"tv_fck",	&dss_54m_fck,	CK_243X),
1910
	/* L3 domain clocks */
1911 1912 1913
	CLK(NULL,	"core_l3_ck",	&core_l3_ck,	CK_243X),
	CLK(NULL,	"ssi_fck",	&ssi_ssr_sst_fck, CK_243X),
	CLK(NULL,	"usb_l4_ick",	&usb_l4_ick,	CK_243X),
1914
	/* L4 domain clocks */
1915 1916
	CLK(NULL,	"l4_ck",	&l4_ck,		CK_243X),
	CLK(NULL,	"ssi_l4_ick",	&ssi_l4_ick,	CK_243X),
1917
	/* virtual meta-group clock */
1918
	CLK(NULL,	"virt_prcm_set", &virt_prcm_set, CK_243X),
1919
	/* general l4 interface ck, multi-parent functional clk */
1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947
	CLK(NULL,	"gpt1_ick",	&gpt1_ick,	CK_243X),
	CLK(NULL,	"gpt1_fck",	&gpt1_fck,	CK_243X),
	CLK(NULL,	"gpt2_ick",	&gpt2_ick,	CK_243X),
	CLK(NULL,	"gpt2_fck",	&gpt2_fck,	CK_243X),
	CLK(NULL,	"gpt3_ick",	&gpt3_ick,	CK_243X),
	CLK(NULL,	"gpt3_fck",	&gpt3_fck,	CK_243X),
	CLK(NULL,	"gpt4_ick",	&gpt4_ick,	CK_243X),
	CLK(NULL,	"gpt4_fck",	&gpt4_fck,	CK_243X),
	CLK(NULL,	"gpt5_ick",	&gpt5_ick,	CK_243X),
	CLK(NULL,	"gpt5_fck",	&gpt5_fck,	CK_243X),
	CLK(NULL,	"gpt6_ick",	&gpt6_ick,	CK_243X),
	CLK(NULL,	"gpt6_fck",	&gpt6_fck,	CK_243X),
	CLK(NULL,	"gpt7_ick",	&gpt7_ick,	CK_243X),
	CLK(NULL,	"gpt7_fck",	&gpt7_fck,	CK_243X),
	CLK(NULL,	"gpt8_ick",	&gpt8_ick,	CK_243X),
	CLK(NULL,	"gpt8_fck",	&gpt8_fck,	CK_243X),
	CLK(NULL,	"gpt9_ick",	&gpt9_ick,	CK_243X),
	CLK(NULL,	"gpt9_fck",	&gpt9_fck,	CK_243X),
	CLK(NULL,	"gpt10_ick",	&gpt10_ick,	CK_243X),
	CLK(NULL,	"gpt10_fck",	&gpt10_fck,	CK_243X),
	CLK(NULL,	"gpt11_ick",	&gpt11_ick,	CK_243X),
	CLK(NULL,	"gpt11_fck",	&gpt11_fck,	CK_243X),
	CLK(NULL,	"gpt12_ick",	&gpt12_ick,	CK_243X),
	CLK(NULL,	"gpt12_fck",	&gpt12_fck,	CK_243X),
	CLK("omap-mcbsp.1", "ick",	&mcbsp1_ick,	CK_243X),
	CLK("omap-mcbsp.1", "fck",	&mcbsp1_fck,	CK_243X),
	CLK("omap-mcbsp.2", "ick",	&mcbsp2_ick,	CK_243X),
	CLK("omap-mcbsp.2", "fck",	&mcbsp2_fck,	CK_243X),
1948 1949 1950 1951 1952 1953
	CLK("omap-mcbsp.3", "ick",	&mcbsp3_ick,	CK_243X),
	CLK("omap-mcbsp.3", "fck",	&mcbsp3_fck,	CK_243X),
	CLK("omap-mcbsp.4", "ick",	&mcbsp4_ick,	CK_243X),
	CLK("omap-mcbsp.4", "fck",	&mcbsp4_fck,	CK_243X),
	CLK("omap-mcbsp.5", "ick",	&mcbsp5_ick,	CK_243X),
	CLK("omap-mcbsp.5", "fck",	&mcbsp5_fck,	CK_243X),
1954 1955 1956 1957
	CLK("omap2_mcspi.1", "ick",	&mcspi1_ick,	CK_243X),
	CLK("omap2_mcspi.1", "fck",	&mcspi1_fck,	CK_243X),
	CLK("omap2_mcspi.2", "ick",	&mcspi2_ick,	CK_243X),
	CLK("omap2_mcspi.2", "fck",	&mcspi2_fck,	CK_243X),
1958 1959
	CLK("omap2_mcspi.3", "ick",	&mcspi3_ick,	CK_243X),
	CLK("omap2_mcspi.3", "fck",	&mcspi3_fck,	CK_243X),
1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972
	CLK(NULL,	"uart1_ick",	&uart1_ick,	CK_243X),
	CLK(NULL,	"uart1_fck",	&uart1_fck,	CK_243X),
	CLK(NULL,	"uart2_ick",	&uart2_ick,	CK_243X),
	CLK(NULL,	"uart2_fck",	&uart2_fck,	CK_243X),
	CLK(NULL,	"uart3_ick",	&uart3_ick,	CK_243X),
	CLK(NULL,	"uart3_fck",	&uart3_fck,	CK_243X),
	CLK(NULL,	"gpios_ick",	&gpios_ick,	CK_243X),
	CLK(NULL,	"gpios_fck",	&gpios_fck,	CK_243X),
	CLK("omap_wdt",	"ick",		&mpu_wdt_ick,	CK_243X),
	CLK("omap_wdt",	"fck",		&mpu_wdt_fck,	CK_243X),
	CLK(NULL,	"sync_32k_ick",	&sync_32k_ick,	CK_243X),
	CLK(NULL,	"wdt1_ick",	&wdt1_ick,	CK_243X),
	CLK(NULL,	"omapctrl_ick",	&omapctrl_ick,	CK_243X),
1973
	CLK(NULL,	"icr_ick",	&icr_ick,	CK_243X),
1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984
	CLK("omap24xxcam", "fck",	&cam_fck,	CK_243X),
	CLK("omap24xxcam", "ick",	&cam_ick,	CK_243X),
	CLK(NULL,	"mailboxes_ick", &mailboxes_ick,	CK_243X),
	CLK(NULL,	"wdt4_ick",	&wdt4_ick,	CK_243X),
	CLK(NULL,	"wdt4_fck",	&wdt4_fck,	CK_243X),
	CLK(NULL,	"mspro_ick",	&mspro_ick,	CK_243X),
	CLK(NULL,	"mspro_fck",	&mspro_fck,	CK_243X),
	CLK(NULL,	"fac_ick",	&fac_ick,	CK_243X),
	CLK(NULL,	"fac_fck",	&fac_fck,	CK_243X),
	CLK("omap_hdq.0", "ick",	&hdq_ick,	CK_243X),
	CLK("omap_hdq.1", "fck",	&hdq_fck,	CK_243X),
1985 1986 1987 1988
	CLK("omap_i2c.1", "ick",	&i2c1_ick,	CK_243X),
	CLK("omap_i2c.1", "fck",	&i2chs1_fck,	CK_243X),
	CLK("omap_i2c.2", "ick",	&i2c2_ick,	CK_243X),
	CLK("omap_i2c.2", "fck",	&i2chs2_fck,	CK_243X),
1989 1990 1991
	CLK(NULL,	"gpmc_fck",	&gpmc_fck,	CK_243X),
	CLK(NULL,	"sdma_fck",	&sdma_fck,	CK_243X),
	CLK(NULL,	"sdma_ick",	&sdma_ick,	CK_243X),
1992
	CLK(NULL,	"sdrc_ick",	&sdrc_ick,	CK_243X),
1993
	CLK(NULL,	"des_ick",	&des_ick,	CK_243X),
1994
	CLK("omap-sham",	"ick",	&sha_ick,	CK_243X),
1995
	CLK("omap_rng",	"ick",		&rng_ick,	CK_243X),
1996
	CLK("omap-aes",	"ick",	&aes_ick,	CK_243X),
1997 1998
	CLK(NULL,	"pka_ick",	&pka_ick,	CK_243X),
	CLK(NULL,	"usb_fck",	&usb_fck,	CK_243X),
1999
	CLK("musb-omap2430",	"ick",	&usbhs_ick,	CK_243X),
2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014
	CLK("mmci-omap-hs.0", "ick",	&mmchs1_ick,	CK_243X),
	CLK("mmci-omap-hs.0", "fck",	&mmchs1_fck,	CK_243X),
	CLK("mmci-omap-hs.1", "ick",	&mmchs2_ick,	CK_243X),
	CLK("mmci-omap-hs.1", "fck",	&mmchs2_fck,	CK_243X),
	CLK(NULL,	"gpio5_ick",	&gpio5_ick,	CK_243X),
	CLK(NULL,	"gpio5_fck",	&gpio5_fck,	CK_243X),
	CLK(NULL,	"mdm_intc_ick",	&mdm_intc_ick,	CK_243X),
	CLK("mmci-omap-hs.0", "mmchsdb_fck",	&mmchsdb1_fck,	CK_243X),
	CLK("mmci-omap-hs.1", "mmchsdb_fck", 	&mmchsdb2_fck,	CK_243X),
};

/*
 * init code
 */

2015
int __init omap2430_clk_init(void)
2016 2017 2018 2019
{
	const struct prcm_config *prcm;
	struct omap_clk *c;
	u32 clkrate;
2020 2021 2022 2023 2024

	prcm_clksrc_ctrl = OMAP2430_PRCM_CLKSRC_CTRL;
	cm_idlest_pll = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST);
	cpu_mask = RATE_IN_243X;
	rate_table = omap2430_rate_table;
2025 2026 2027

	clk_init(&omap2_clk_functions);

2028 2029
	for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks);
	     c++)
2030 2031 2032 2033
		clk_preinit(c->lk.clk);

	osc_ck.rate = omap2_osc_clk_recalc(&osc_ck);
	propagate_rate(&osc_ck);
2034
	sys_ck.rate = omap2xxx_sys_clk_recalc(&sys_ck);
2035 2036
	propagate_rate(&sys_ck);

2037 2038 2039 2040 2041 2042
	for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks);
	     c++) {
		clkdev_add(&c->lk);
		clk_register(c->lk.clk);
		omap2_init_clk_clkdm(c->lk.clk);
	}
2043

2044 2045 2046
	/* Disable autoidle on all clocks; let the PM code enable it later */
	omap_clk_disable_autoidle_all();

2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060
	/* 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();

2061 2062 2063
	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)) ;
2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077

	/*
	 * 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;
}
2078