clock2430_data.c 60.5 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-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
#include <plat/control.h>
22

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

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_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

/* 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_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 609 610 611 612 613 614 615 616
/*
 * 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,
};

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 664 665
	.recalc		= &omap2_clksel_recalc,
};

static struct clk gfx_ick = {
	.name		= "gfx_ick",		/* From l3 */
666
	.ops		= &clkops_omap2_dflt_wait,
667
	.parent		= &core_l3_ck,
668
	.clkdm_name	= "gfx_clkdm",
669 670 671
	.enable_reg	= OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
	.enable_bit	= OMAP_EN_GFX_SHIFT,
	.recalc		= &followparent_recalc,
672 673 674 675 676 677 678
};

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

694 695
static struct clk mdm_ick = {		/* used both as a ick and fck */
	.name		= "mdm_ick",
696
	.ops		= &clkops_omap2_dflt_wait,
697
	.parent		= &core_ck,
698
	.clkdm_name	= "mdm_clkdm",
699 700 701 702 703
	.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,
704 705 706 707 708
	.recalc		= &omap2_clksel_recalc,
};

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

static struct clk mcspi1_ick = {
1260
	.name		= "mcspi1_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_MCSPI1_SHIFT,
	.recalc		= &followparent_recalc,
1267 1268 1269
};

static struct clk mcspi1_fck = {
1270
	.name		= "mcspi1_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_MCSPI1_SHIFT,
	.recalc		= &followparent_recalc,
1277 1278 1279
};

static struct clk mcspi2_ick = {
1280
	.name		= "mcspi2_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_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_MCSPI2_SHIFT,
	.recalc		= &followparent_recalc,
1287 1288 1289
};

static struct clk mcspi2_fck = {
1290
	.name		= "mcspi2_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, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_MCSPI2_SHIFT,
	.recalc		= &followparent_recalc,
1297 1298 1299
};

static struct clk mcspi3_ick = {
1300
	.name		= "mcspi3_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(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_MCSPI3_SHIFT,
	.recalc		= &followparent_recalc,
1307 1308 1309
};

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

static struct clk uart1_ick = {
	.name		= "uart1_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(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_UART1_SHIFT,
	.recalc		= &followparent_recalc,
1327 1328 1329 1330
};

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

static struct clk mailboxes_ick = {
	.name		= "mailboxes_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_MAILBOXES_SHIFT,
	.recalc		= &followparent_recalc,
1494 1495 1496 1497
};

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

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

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

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

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

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

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

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

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

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

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

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

static struct clk gpmc_fck = {
	.name		= "gpmc_fck",
1626
	.ops		= &clkops_null, /* RMK: missing? */
1627
	.parent		= &core_l3_ck,
1628
	.flags		= ENABLE_ON_INIT,
1629
	.clkdm_name	= "core_l3_clkdm",
1630 1631 1632 1633 1634
	.recalc		= &followparent_recalc,
};

static struct clk sdma_fck = {
	.name		= "sdma_fck",
1635
	.ops		= &clkops_null, /* RMK: missing? */
1636
	.parent		= &core_l3_ck,
1637
	.clkdm_name	= "core_l3_clkdm",
1638 1639 1640 1641 1642
	.recalc		= &followparent_recalc,
};

static struct clk sdma_ick = {
	.name		= "sdma_ick",
1643
	.ops		= &clkops_null, /* RMK: missing? */
1644
	.parent		= &l4_ck,
1645
	.clkdm_name	= "core_l3_clkdm",
1646
	.recalc		= &followparent_recalc,
1647 1648 1649 1650
};

static struct clk sdrc_ick = {
	.name		= "sdrc_ick",
1651
	.ops		= &clkops_omap2_dflt_wait,
1652
	.parent		= &l4_ck,
1653
	.flags		= ENABLE_ON_INIT,
1654
	.clkdm_name	= "core_l4_clkdm",
1655 1656 1657
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
	.enable_bit	= OMAP2430_EN_SDRC_SHIFT,
	.recalc		= &followparent_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
};

static struct clk usbhs_ick = {
	.name		= "usbhs_ick",
1722
	.ops		= &clkops_omap2_dflt_wait,
1723
	.parent		= &core_l3_ck,
1724
	.clkdm_name	= "core_l3_clkdm",
1725 1726 1727
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_USBHS_SHIFT,
	.recalc		= &followparent_recalc,
1728 1729 1730
};

static struct clk mmchs1_ick = {
1731
	.name		= "mmchs1_ick",
1732
	.ops		= &clkops_omap2_dflt_wait,
1733
	.parent		= &l4_ck,
1734
	.clkdm_name	= "core_l4_clkdm",
1735 1736 1737
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_MMCHS1_SHIFT,
	.recalc		= &followparent_recalc,
1738 1739 1740
};

static struct clk mmchs1_fck = {
1741
	.name		= "mmchs1_fck",
1742
	.ops		= &clkops_omap2_dflt_wait,
1743
	.parent		= &func_96m_ck,
1744
	.clkdm_name	= "core_l3_clkdm",
1745 1746 1747
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_MMCHS1_SHIFT,
	.recalc		= &followparent_recalc,
1748 1749 1750
};

static struct clk mmchs2_ick = {
1751
	.name		= "mmchs2_ick",
1752
	.ops		= &clkops_omap2_dflt_wait,
1753
	.parent		= &l4_ck,
1754
	.clkdm_name	= "core_l4_clkdm",
1755 1756 1757
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_MMCHS2_SHIFT,
	.recalc		= &followparent_recalc,
1758 1759 1760
};

static struct clk mmchs2_fck = {
1761
	.name		= "mmchs2_fck",
1762
	.ops		= &clkops_omap2_dflt_wait,
1763
	.parent		= &func_96m_ck,
1764 1765 1766
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_MMCHS2_SHIFT,
	.recalc		= &followparent_recalc,
1767 1768 1769 1770
};

static struct clk gpio5_ick = {
	.name		= "gpio5_ick",
1771
	.ops		= &clkops_omap2_dflt_wait,
1772
	.parent		= &l4_ck,
1773
	.clkdm_name	= "core_l4_clkdm",
1774 1775 1776
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_GPIO5_SHIFT,
	.recalc		= &followparent_recalc,
1777 1778 1779 1780
};

static struct clk gpio5_fck = {
	.name		= "gpio5_fck",
1781
	.ops		= &clkops_omap2_dflt_wait,
1782
	.parent		= &func_32k_ck,
1783
	.clkdm_name	= "core_l4_clkdm",
1784 1785 1786
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_GPIO5_SHIFT,
	.recalc		= &followparent_recalc,
1787 1788 1789 1790
};

static struct clk mdm_intc_ick = {
	.name		= "mdm_intc_ick",
1791
	.ops		= &clkops_omap2_dflt_wait,
1792
	.parent		= &l4_ck,
1793
	.clkdm_name	= "core_l4_clkdm",
1794 1795 1796
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_MDM_INTC_SHIFT,
	.recalc		= &followparent_recalc,
1797 1798 1799
};

static struct clk mmchsdb1_fck = {
1800
	.name		= "mmchsdb1_fck",
1801
	.ops		= &clkops_omap2_dflt_wait,
1802
	.parent		= &func_32k_ck,
1803
	.clkdm_name	= "core_l4_clkdm",
1804 1805 1806
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_MMCHSDB1_SHIFT,
	.recalc		= &followparent_recalc,
1807 1808 1809
};

static struct clk mmchsdb2_fck = {
1810
	.name		= "mmchsdb2_fck",
1811
	.ops		= &clkops_omap2_dflt_wait,
1812
	.parent		= &func_32k_ck,
1813
	.clkdm_name	= "core_l4_clkdm",
1814 1815 1816
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_MMCHSDB2_SHIFT,
	.recalc		= &followparent_recalc,
1817
};
1818

1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834
/*
 * 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",
1835
	.ops		= &clkops_null,
1836
	.parent		= &mpu_ck,	/* Indexed by mpu speed, no parent */
1837
	.recalc		= &omap2_table_mpu_recalc,	/* sets are keyed on mpu rate */
1838 1839 1840
	.set_rate	= &omap2_select_table_rate,
	.round_rate	= &omap2_round_to_table_rate,
};
1841

1842 1843 1844 1845 1846

/*
 * clkdev integration
 */

1847
static struct omap_clk omap2430_clks[] = {
1848
	/* external root sources */
1849 1850 1851 1852 1853
	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),
1854 1855 1856 1857 1858 1859
	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),
1860
	/* internal analog sources */
1861 1862 1863
	CLK(NULL,	"dpll_ck",	&dpll_ck,	CK_243X),
	CLK(NULL,	"apll96_ck",	&apll96_ck,	CK_243X),
	CLK(NULL,	"apll54_ck",	&apll54_ck,	CK_243X),
1864
	/* internal prcm root sources */
1865 1866
	CLK(NULL,	"func_54m_ck",	&func_54m_ck,	CK_243X),
	CLK(NULL,	"core_ck",	&core_ck,	CK_243X),
1867 1868 1869 1870 1871
	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),
1872 1873 1874 1875 1876 1877 1878
	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),
1879
	/* mpu domain clocks */
1880
	CLK(NULL,	"mpu_ck",	&mpu_ck,	CK_243X),
1881
	/* dsp domain clocks */
1882 1883
	CLK(NULL,	"dsp_fck",	&dsp_fck,	CK_243X),
	CLK(NULL,	"dsp_irate_ick", &dsp_irate_ick, CK_243X),
1884 1885
	CLK(NULL,	"iva2_1_ick",	&iva2_1_ick,	CK_243X),
	/* GFX domain clocks */
1886 1887 1888
	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),
1889 1890 1891 1892
	/* Modem domain clocks */
	CLK(NULL,	"mdm_ick",	&mdm_ick,	CK_243X),
	CLK(NULL,	"mdm_osc_ck",	&mdm_osc_ck,	CK_243X),
	/* DSS domain clocks */
1893 1894 1895 1896
	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),
1897
	/* L3 domain clocks */
1898 1899 1900
	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),
1901
	/* L4 domain clocks */
1902 1903
	CLK(NULL,	"l4_ck",	&l4_ck,		CK_243X),
	CLK(NULL,	"ssi_l4_ick",	&ssi_l4_ick,	CK_243X),
1904
	/* virtual meta-group clock */
1905
	CLK(NULL,	"virt_prcm_set", &virt_prcm_set, CK_243X),
1906
	/* general l4 interface ck, multi-parent functional clk */
1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934
	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),
1935 1936 1937 1938 1939 1940
	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),
1941 1942 1943 1944
	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),
1945 1946
	CLK("omap2_mcspi.3", "ick",	&mcspi3_ick,	CK_243X),
	CLK("omap2_mcspi.3", "fck",	&mcspi3_fck,	CK_243X),
1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959
	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),
1960
	CLK(NULL,	"icr_ick",	&icr_ick,	CK_243X),
1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972
	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),
	CLK("i2c_omap.1", "ick",	&i2c1_ick,	CK_243X),
1973
	CLK("i2c_omap.1", "fck",	&i2chs1_fck,	CK_243X),
1974
	CLK("i2c_omap.2", "ick",	&i2c2_ick,	CK_243X),
1975
	CLK("i2c_omap.2", "fck",	&i2chs2_fck,	CK_243X),
1976 1977 1978
	CLK(NULL,	"gpmc_fck",	&gpmc_fck,	CK_243X),
	CLK(NULL,	"sdma_fck",	&sdma_fck,	CK_243X),
	CLK(NULL,	"sdma_ick",	&sdma_ick,	CK_243X),
1979
	CLK(NULL,	"sdrc_ick",	&sdrc_ick,	CK_243X),
1980
	CLK(NULL,	"des_ick",	&des_ick,	CK_243X),
1981
	CLK("omap-sham",	"ick",	&sha_ick,	CK_243X),
1982
	CLK("omap_rng",	"ick",		&rng_ick,	CK_243X),
1983
	CLK("omap-aes",	"ick",	&aes_ick,	CK_243X),
1984 1985
	CLK(NULL,	"pka_ick",	&pka_ick,	CK_243X),
	CLK(NULL,	"usb_fck",	&usb_fck,	CK_243X),
1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001
	CLK("musb_hdrc",	"ick",	&usbhs_ick,	CK_243X),
	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
 */

2002
int __init omap2430_clk_init(void)
2003 2004 2005 2006
{
	const struct prcm_config *prcm;
	struct omap_clk *c;
	u32 clkrate;
2007 2008 2009 2010 2011

	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;
2012 2013 2014

	clk_init(&omap2_clk_functions);

2015 2016
	for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks);
	     c++)
2017 2018 2019 2020
		clk_preinit(c->lk.clk);

	osc_ck.rate = omap2_osc_clk_recalc(&osc_ck);
	propagate_rate(&osc_ck);
2021
	sys_ck.rate = omap2xxx_sys_clk_recalc(&sys_ck);
2022 2023
	propagate_rate(&sys_ck);

2024 2025 2026 2027 2028 2029
	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);
	}
2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044

	/* 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();

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

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