clock2420_data.c 58.0 KB
Newer Older
1
/*
2
 * OMAP2420 clock data
3
 *
4 5
 * Copyright (C) 2005-2009 Texas Instruments, Inc.
 * 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
#include <linux/kernel.h>
17
#include <linux/io.h>
18
#include <linux/clk.h>
19
#include <linux/list.h>
20

21
#include <plat/hardware.h>
22
#include <plat/clkdev_omap.h>
23

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

35 36 37 38
#define OMAP_CM_REGADDR                 OMAP2420_CM_REGADDR

/*
 * 2420 clock tree.
39
 *
40 41 42
 * NOTE:In many cases here we are assigning a 'default' parent. In
 *	many cases the parent is selectable. The set parent calls will
 *	also switch sources.
43 44 45 46 47
 *
 *	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
48
 *	noteworthy that most peripherals have dependencies on multiple clock
49 50 51
 *	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		= 32768,
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
	.max_divider		= 16,
119 120
};

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

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

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

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

/* func_54m_ck */

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

static const struct clksel_rate func_54m_alt_rates[] = {
169
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
170 171 172 173 174 175 176 177 178
	{ .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 },
};

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

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

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

/* func_48m_ck */

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

static const struct clksel_rate func_48m_alt_rates[] = {
215
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
216 217 218 219 220 221 222
	{ .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 }
223 224 225 226
};

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

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

/* Secure timer, only available in secure mode */
static struct clk wdt1_osc_ck = {
	.name		= "ck_wdt1_osc",
251
	.ops		= &clkops_null, /* RMK: missing? */
252
	.parent		= &osc_ck,
253 254 255 256 257 258 259 260 261 262 263 264
	.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[] = {
265
	{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
266 267 268 269
	{ .div = 0 }
};

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

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

static const struct clksel_rate common_clkout_src_54m_rates[] = {
280
	{ .div = 1, .val = 3, .flags = RATE_IN_24XX },
281 282 283 284 285 286 287 288 289 290 291 292 293
	{ .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",
294
	.ops		= &clkops_omap2_dflt,
295
	.parent		= &func_54m_ck,
296
	.clkdm_name	= "wkup_clkdm",
297
	.enable_reg	= OMAP2420_PRCM_CLKOUT_CTRL,
298 299
	.enable_bit	= OMAP24XX_CLKOUT_EN_SHIFT,
	.init		= &omap2_init_clksel_parent,
300
	.clksel_reg	= OMAP2420_PRCM_CLKOUT_CTRL,
301 302 303 304 305 306 307 308
	.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[] = {
309
	{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
310 311 312 313 314 315 316 317 318 319
	{ .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 }
320 321 322 323
};

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

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

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

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

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

};
381

382 383 384 385 386 387 388 389 390 391
/*
 * 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
 *
 */
392
static const struct clksel_rate mpu_core_rates[] = {
393
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
394 395 396 397 398 399 400 401 402 403 404 405
	{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
	{ .div = 4, .val = 4, .flags = RATE_IN_242X },
	{ .div = 6, .val = 6, .flags = RATE_IN_242X },
	{ .div = 8, .val = 8, .flags = RATE_IN_242X },
	{ .div = 0 },
};

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

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

418
/*
419
 * DSP (2420-UMA+IVA1) clock domain
420 421
 * Clocks:
 *	2420: UMA_FCLK, UMA_ICLK, IVA_MPU, IVA_COP
422 423 424 425 426
 *
 * 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.
427
 */
428
static const struct clksel_rate dsp_fck_core_rates[] = {
429
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445
	{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
	{ .div = 3, .val = 3, .flags = RATE_IN_24XX },
	{ .div = 4, .val = 4, .flags = RATE_IN_24XX },
	{ .div = 6, .val = 6, .flags = RATE_IN_242X },
	{ .div = 8, .val = 8, .flags = RATE_IN_242X },
	{ .div = 12, .val = 12, .flags = RATE_IN_242X },
	{ .div = 0 },
};

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

static struct clk dsp_fck = {
	.name		= "dsp_fck",
446
	.ops		= &clkops_omap2_dflt_wait,
447
	.parent		= &core_ck,
448
	.clkdm_name	= "dsp_clkdm",
449 450 451 452 453
	.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,
454 455 456
	.recalc		= &omap2_clksel_recalc,
};

457 458
static const struct clksel dsp_ick_clksel[] = {
	{ .parent = &dsp_fck, .rates = dsp_ick_rates },
459
	{ .parent = NULL }
460 461 462 463
};

static struct clk dsp_ick = {
	.name		= "dsp_ick",	 /* apparently ipi and isp */
464
	.ops		= &clkops_omap2_iclk_dflt_wait,
465 466
	.parent		= &dsp_fck,
	.clkdm_name	= "dsp_clkdm",
467 468
	.enable_reg	= OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP2420_EN_DSP_IPI_SHIFT,	      /* for ipi */
469 470 471 472
	.clksel_reg	= OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
	.clksel_mask	= OMAP24XX_CLKSEL_DSP_IF_MASK,
	.clksel		= dsp_ick_clksel,
	.recalc		= &omap2_clksel_recalc,
473 474
};

475 476 477 478 479
/*
 * The IVA1 is an ARM7 core on the 2420 that has nothing to do with
 * the C54x, but which is contained in the DSP powerdomain.  Does not
 * exist on later OMAPs.
 */
480 481
static struct clk iva1_ifck = {
	.name		= "iva1_ifck",
482
	.ops		= &clkops_omap2_dflt_wait,
483
	.parent		= &core_ck,
484
	.clkdm_name	= "iva1_clkdm",
485 486 487 488 489
	.enable_reg	= OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
	.enable_bit	= OMAP2420_EN_IVA_COP_SHIFT,
	.clksel_reg	= OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
	.clksel_mask	= OMAP2420_CLKSEL_IVA_MASK,
	.clksel		= dsp_fck_clksel,
490 491 492 493 494 495
	.recalc		= &omap2_clksel_recalc,
};

/* IVA1 mpu/int/i/f clocks are /2 of parent */
static struct clk iva1_mpu_int_ifck = {
	.name		= "iva1_mpu_int_ifck",
496
	.ops		= &clkops_omap2_dflt_wait,
497
	.parent		= &iva1_ifck,
498
	.clkdm_name	= "iva1_clkdm",
499 500 501
	.enable_reg	= OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
	.enable_bit	= OMAP2420_EN_IVA_MPU_SHIFT,
	.fixed_div	= 2,
502
	.recalc		= &omap_fixed_divisor_recalc,
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523
};

/*
 * 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.
 */
524 525 526
static const struct clksel_rate core_l3_core_rates[] = {
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
	{ .div = 2, .val = 2, .flags = RATE_IN_242X },
527
	{ .div = 4, .val = 4, .flags = RATE_IN_24XX },
528 529 530 531 532 533 534 535 536 537 538 539
	{ .div = 6, .val = 6, .flags = RATE_IN_24XX },
	{ .div = 8, .val = 8, .flags = RATE_IN_242X },
	{ .div = 12, .val = 12, .flags = RATE_IN_242X },
	{ .div = 16, .val = 16, .flags = RATE_IN_242X },
	{ .div = 0 }
};

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

540 541
static struct clk core_l3_ck = {	/* Used for ick and fck, interconnect */
	.name		= "core_l3_ck",
542
	.ops		= &clkops_null,
543
	.parent		= &core_ck,
544
	.clkdm_name	= "core_l3_clkdm",
545 546 547
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
	.clksel_mask	= OMAP24XX_CLKSEL_L3_MASK,
	.clksel		= core_l3_clksel,
548
	.recalc		= &omap2_clksel_recalc,
549 550 551 552 553
};

/* usb_l4_ick */
static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
554
	{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
555 556 557 558 559 560 561
	{ .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 },
562 563
};

564
/* It is unclear from TRM whether usb_l4_ick is really in L3 or L4 clkdm */
565 566
static struct clk usb_l4_ick = {	/* FS-USB interface clock */
	.name		= "usb_l4_ick",
567
	.ops		= &clkops_omap2_iclk_dflt_wait,
568
	.parent		= &core_l3_ck,
569
	.clkdm_name	= "core_l4_clkdm",
570 571 572 573 574
	.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,
575 576 577
	.recalc		= &omap2_clksel_recalc,
};

578 579 580 581 582 583 584 585
/*
 * 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[] = {
586
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
587 588 589 590 591 592 593 594 595 596 597
	{ .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",
598
	.ops		= &clkops_null,
599 600 601 602 603 604 605 606
	.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,
};

607 608 609 610
/*
 * 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.
611
 * SSI_SSR_FCLK, SSI_SST_FCLK, SSI_L4_ICLK
612 613 614
 *
 * ssr = core/1/2/3/4/5, sst = 1/2 ssr.
 */
615 616
static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
617
	{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
618 619 620 621 622 623 624 625 626 627 628 629
	{ .div = 3, .val = 3, .flags = RATE_IN_24XX },
	{ .div = 4, .val = 4, .flags = RATE_IN_24XX },
	{ .div = 6, .val = 6, .flags = RATE_IN_242X },
	{ .div = 8, .val = 8, .flags = RATE_IN_242X },
	{ .div = 0 }
};

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

630 631
static struct clk ssi_ssr_sst_fck = {
	.name		= "ssi_fck",
632
	.ops		= &clkops_omap2_dflt_wait,
633
	.parent		= &core_ck,
634
	.clkdm_name	= "core_l3_clkdm",
635 636 637 638 639
	.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,
640 641 642
	.recalc		= &omap2_clksel_recalc,
};

643 644 645 646 647 648
/*
 * 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",
649
	.ops		= &clkops_omap2_iclk_dflt_wait,
650 651 652 653 654 655 656
	.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,
};

657

658 659 660 661 662 663 664 665 666 667 668
/*
 * 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.
 *
 */
669 670 671 672 673 674 675

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

676 677
static struct clk gfx_3d_fck = {
	.name		= "gfx_3d_fck",
678
	.ops		= &clkops_omap2_dflt_wait,
679
	.parent		= &core_l3_ck,
680
	.clkdm_name	= "gfx_clkdm",
681 682 683 684 685
	.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,
686
	.recalc		= &omap2_clksel_recalc,
687 688
	.round_rate	= &omap2_clksel_round_rate,
	.set_rate	= &omap2_clksel_set_rate
689 690 691 692
};

static struct clk gfx_2d_fck = {
	.name		= "gfx_2d_fck",
693
	.ops		= &clkops_omap2_dflt_wait,
694
	.parent		= &core_l3_ck,
695
	.clkdm_name	= "gfx_clkdm",
696 697 698 699 700
	.enable_reg	= OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
	.enable_bit	= OMAP24XX_EN_2D_SHIFT,
	.clksel_reg	= OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
	.clksel_mask	= OMAP_CLKSEL_GFX_MASK,
	.clksel		= gfx_fck_clksel,
701 702 703
	.recalc		= &omap2_clksel_recalc,
};

704
/* This interface clock does not have a CM_AUTOIDLE bit */
705 706
static struct clk gfx_ick = {
	.name		= "gfx_ick",		/* From l3 */
707
	.ops		= &clkops_omap2_dflt_wait,
708
	.parent		= &core_l3_ck,
709
	.clkdm_name	= "gfx_clkdm",
710 711 712
	.enable_reg	= OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
	.enable_bit	= OMAP_EN_GFX_SHIFT,
	.recalc		= &followparent_recalc,
713 714 715 716 717 718 719 720 721 722
};

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

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

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

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

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

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

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

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

814 815 816 817 818 819 820 821
static struct clk wu_l4_ick = {
	.name		= "wu_l4_ick",
	.ops		= &clkops_null,
	.parent		= &sys_ck,
	.clkdm_name	= "wkup_clkdm",
	.recalc		= &followparent_recalc,
};

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

840 841
static struct clk gpt1_ick = {
	.name		= "gpt1_ick",
842
	.ops		= &clkops_omap2_iclk_dflt_wait,
843 844
	.parent		= &wu_l4_ick,
	.clkdm_name	= "wkup_clkdm",
845 846 847
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_GPT1_SHIFT,
	.recalc		= &followparent_recalc,
848 849 850 851
};

static struct clk gpt1_fck = {
	.name		= "gpt1_fck",
852
	.ops		= &clkops_omap2_dflt_wait,
853
	.parent		= &func_32k_ck,
854
	.clkdm_name	= "core_l4_clkdm",
855 856 857 858 859 860 861 862 863
	.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
864 865 866 867
};

static struct clk gpt2_ick = {
	.name		= "gpt2_ick",
868
	.ops		= &clkops_omap2_iclk_dflt_wait,
869
	.parent		= &l4_ck,
870
	.clkdm_name	= "core_l4_clkdm",
871 872 873
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT2_SHIFT,
	.recalc		= &followparent_recalc,
874 875 876 877
};

static struct clk gpt2_fck = {
	.name		= "gpt2_fck",
878
	.ops		= &clkops_omap2_dflt_wait,
879
	.parent		= &func_32k_ck,
880
	.clkdm_name	= "core_l4_clkdm",
881 882 883 884 885 886 887
	.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,
888 889 890 891
};

static struct clk gpt3_ick = {
	.name		= "gpt3_ick",
892
	.ops		= &clkops_omap2_iclk_dflt_wait,
893
	.parent		= &l4_ck,
894
	.clkdm_name	= "core_l4_clkdm",
895 896 897
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT3_SHIFT,
	.recalc		= &followparent_recalc,
898 899 900 901
};

static struct clk gpt3_fck = {
	.name		= "gpt3_fck",
902
	.ops		= &clkops_omap2_dflt_wait,
903
	.parent		= &func_32k_ck,
904
	.clkdm_name	= "core_l4_clkdm",
905 906 907 908 909 910 911
	.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,
912 913 914 915
};

static struct clk gpt4_ick = {
	.name		= "gpt4_ick",
916
	.ops		= &clkops_omap2_iclk_dflt_wait,
917
	.parent		= &l4_ck,
918
	.clkdm_name	= "core_l4_clkdm",
919 920 921
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT4_SHIFT,
	.recalc		= &followparent_recalc,
922 923 924 925
};

static struct clk gpt4_fck = {
	.name		= "gpt4_fck",
926
	.ops		= &clkops_omap2_dflt_wait,
927
	.parent		= &func_32k_ck,
928
	.clkdm_name	= "core_l4_clkdm",
929 930 931 932 933 934 935
	.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,
936 937 938 939
};

static struct clk gpt5_ick = {
	.name		= "gpt5_ick",
940
	.ops		= &clkops_omap2_iclk_dflt_wait,
941
	.parent		= &l4_ck,
942
	.clkdm_name	= "core_l4_clkdm",
943 944 945
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT5_SHIFT,
	.recalc		= &followparent_recalc,
946 947 948 949
};

static struct clk gpt5_fck = {
	.name		= "gpt5_fck",
950
	.ops		= &clkops_omap2_dflt_wait,
951
	.parent		= &func_32k_ck,
952
	.clkdm_name	= "core_l4_clkdm",
953 954 955 956 957 958 959
	.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,
960 961 962 963
};

static struct clk gpt6_ick = {
	.name		= "gpt6_ick",
964
	.ops		= &clkops_omap2_iclk_dflt_wait,
965
	.parent		= &l4_ck,
966
	.clkdm_name	= "core_l4_clkdm",
967 968 969
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT6_SHIFT,
	.recalc		= &followparent_recalc,
970 971 972 973
};

static struct clk gpt6_fck = {
	.name		= "gpt6_fck",
974
	.ops		= &clkops_omap2_dflt_wait,
975
	.parent		= &func_32k_ck,
976
	.clkdm_name	= "core_l4_clkdm",
977 978 979 980 981 982 983
	.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,
984 985 986 987
};

static struct clk gpt7_ick = {
	.name		= "gpt7_ick",
988
	.ops		= &clkops_omap2_iclk_dflt_wait,
989
	.parent		= &l4_ck,
990
	.clkdm_name	= "core_l4_clkdm",
991 992 993
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT7_SHIFT,
	.recalc		= &followparent_recalc,
994 995 996 997
};

static struct clk gpt7_fck = {
	.name		= "gpt7_fck",
998
	.ops		= &clkops_omap2_dflt_wait,
999
	.parent		= &func_32k_ck,
1000
	.clkdm_name	= "core_l4_clkdm",
1001 1002 1003 1004 1005 1006 1007
	.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,
1008 1009 1010 1011
};

static struct clk gpt8_ick = {
	.name		= "gpt8_ick",
1012
	.ops		= &clkops_omap2_iclk_dflt_wait,
1013
	.parent		= &l4_ck,
1014
	.clkdm_name	= "core_l4_clkdm",
1015 1016 1017
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT8_SHIFT,
	.recalc		= &followparent_recalc,
1018 1019 1020 1021
};

static struct clk gpt8_fck = {
	.name		= "gpt8_fck",
1022
	.ops		= &clkops_omap2_dflt_wait,
1023
	.parent		= &func_32k_ck,
1024
	.clkdm_name	= "core_l4_clkdm",
1025 1026 1027 1028 1029 1030 1031
	.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,
1032 1033 1034 1035
};

static struct clk gpt9_ick = {
	.name		= "gpt9_ick",
1036
	.ops		= &clkops_omap2_iclk_dflt_wait,
1037
	.parent		= &l4_ck,
1038
	.clkdm_name	= "core_l4_clkdm",
1039 1040 1041
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT9_SHIFT,
	.recalc		= &followparent_recalc,
1042 1043 1044 1045
};

static struct clk gpt9_fck = {
	.name		= "gpt9_fck",
1046
	.ops		= &clkops_omap2_dflt_wait,
1047
	.parent		= &func_32k_ck,
1048
	.clkdm_name	= "core_l4_clkdm",
1049 1050 1051 1052 1053 1054 1055
	.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,
1056 1057 1058 1059
};

static struct clk gpt10_ick = {
	.name		= "gpt10_ick",
1060
	.ops		= &clkops_omap2_iclk_dflt_wait,
1061
	.parent		= &l4_ck,
1062
	.clkdm_name	= "core_l4_clkdm",
1063 1064 1065
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT10_SHIFT,
	.recalc		= &followparent_recalc,
1066 1067 1068 1069
};

static struct clk gpt10_fck = {
	.name		= "gpt10_fck",
1070
	.ops		= &clkops_omap2_dflt_wait,
1071
	.parent		= &func_32k_ck,
1072
	.clkdm_name	= "core_l4_clkdm",
1073 1074 1075 1076 1077 1078 1079
	.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,
1080 1081 1082 1083
};

static struct clk gpt11_ick = {
	.name		= "gpt11_ick",
1084
	.ops		= &clkops_omap2_iclk_dflt_wait,
1085
	.parent		= &l4_ck,
1086
	.clkdm_name	= "core_l4_clkdm",
1087 1088 1089
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT11_SHIFT,
	.recalc		= &followparent_recalc,
1090 1091 1092 1093
};

static struct clk gpt11_fck = {
	.name		= "gpt11_fck",
1094
	.ops		= &clkops_omap2_dflt_wait,
1095
	.parent		= &func_32k_ck,
1096
	.clkdm_name	= "core_l4_clkdm",
1097 1098 1099 1100 1101 1102 1103
	.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,
1104 1105 1106 1107
};

static struct clk gpt12_ick = {
	.name		= "gpt12_ick",
1108
	.ops		= &clkops_omap2_iclk_dflt_wait,
1109
	.parent		= &l4_ck,
1110
	.clkdm_name	= "core_l4_clkdm",
1111 1112 1113
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT12_SHIFT,
	.recalc		= &followparent_recalc,
1114 1115 1116 1117
};

static struct clk gpt12_fck = {
	.name		= "gpt12_fck",
1118
	.ops		= &clkops_omap2_dflt_wait,
1119
	.parent		= &secure_32k_ck,
1120
	.clkdm_name	= "core_l4_clkdm",
1121 1122 1123 1124 1125 1126 1127
	.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,
1128 1129 1130
};

static struct clk mcbsp1_ick = {
1131
	.name		= "mcbsp1_ick",
1132
	.ops		= &clkops_omap2_iclk_dflt_wait,
1133
	.parent		= &l4_ck,
1134
	.clkdm_name	= "core_l4_clkdm",
1135 1136 1137
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_MCBSP1_SHIFT,
	.recalc		= &followparent_recalc,
1138 1139
};

1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155
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 }
};

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

static struct clk mcbsp2_ick = {
1171
	.name		= "mcbsp2_ick",
1172
	.ops		= &clkops_omap2_iclk_dflt_wait,
1173
	.parent		= &l4_ck,
1174
	.clkdm_name	= "core_l4_clkdm",
1175 1176 1177
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_MCBSP2_SHIFT,
	.recalc		= &followparent_recalc,
1178 1179 1180
};

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

static struct clk mcspi1_ick = {
1195
	.name		= "mcspi1_ick",
1196
	.ops		= &clkops_omap2_iclk_dflt_wait,
1197
	.parent		= &l4_ck,
1198
	.clkdm_name	= "core_l4_clkdm",
1199 1200 1201
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_MCSPI1_SHIFT,
	.recalc		= &followparent_recalc,
1202 1203 1204
};

static struct clk mcspi1_fck = {
1205
	.name		= "mcspi1_fck",
1206
	.ops		= &clkops_omap2_dflt_wait,
1207
	.parent		= &func_48m_ck,
1208
	.clkdm_name	= "core_l4_clkdm",
1209 1210 1211
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_MCSPI1_SHIFT,
	.recalc		= &followparent_recalc,
1212 1213 1214
};

static struct clk mcspi2_ick = {
1215
	.name		= "mcspi2_ick",
1216
	.ops		= &clkops_omap2_iclk_dflt_wait,
1217
	.parent		= &l4_ck,
1218
	.clkdm_name	= "core_l4_clkdm",
1219 1220 1221
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_MCSPI2_SHIFT,
	.recalc		= &followparent_recalc,
1222 1223 1224
};

static struct clk mcspi2_fck = {
1225
	.name		= "mcspi2_fck",
1226
	.ops		= &clkops_omap2_dflt_wait,
1227
	.parent		= &func_48m_ck,
1228
	.clkdm_name	= "core_l4_clkdm",
1229 1230 1231
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_MCSPI2_SHIFT,
	.recalc		= &followparent_recalc,
1232 1233 1234 1235
};

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

static struct clk uart1_fck = {
	.name		= "uart1_fck",
1246
	.ops		= &clkops_omap2_dflt_wait,
1247
	.parent		= &func_48m_ck,
1248
	.clkdm_name	= "core_l4_clkdm",
1249 1250 1251
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_UART1_SHIFT,
	.recalc		= &followparent_recalc,
1252 1253 1254 1255
};

static struct clk uart2_ick = {
	.name		= "uart2_ick",
1256
	.ops		= &clkops_omap2_iclk_dflt_wait,
1257
	.parent		= &l4_ck,
1258
	.clkdm_name	= "core_l4_clkdm",
1259 1260 1261
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_UART2_SHIFT,
	.recalc		= &followparent_recalc,
1262 1263 1264 1265
};

static struct clk uart2_fck = {
	.name		= "uart2_fck",
1266
	.ops		= &clkops_omap2_dflt_wait,
1267
	.parent		= &func_48m_ck,
1268
	.clkdm_name	= "core_l4_clkdm",
1269 1270 1271
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_UART2_SHIFT,
	.recalc		= &followparent_recalc,
1272 1273 1274 1275
};

static struct clk uart3_ick = {
	.name		= "uart3_ick",
1276
	.ops		= &clkops_omap2_iclk_dflt_wait,
1277
	.parent		= &l4_ck,
1278
	.clkdm_name	= "core_l4_clkdm",
1279 1280 1281
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP24XX_EN_UART3_SHIFT,
	.recalc		= &followparent_recalc,
1282 1283 1284 1285
};

static struct clk uart3_fck = {
	.name		= "uart3_fck",
1286
	.ops		= &clkops_omap2_dflt_wait,
1287
	.parent		= &func_48m_ck,
1288
	.clkdm_name	= "core_l4_clkdm",
1289 1290 1291
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP24XX_EN_UART3_SHIFT,
	.recalc		= &followparent_recalc,
1292 1293 1294 1295
};

static struct clk gpios_ick = {
	.name		= "gpios_ick",
1296
	.ops		= &clkops_omap2_iclk_dflt_wait,
1297 1298
	.parent		= &wu_l4_ick,
	.clkdm_name	= "wkup_clkdm",
1299 1300 1301
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_GPIOS_SHIFT,
	.recalc		= &followparent_recalc,
1302 1303 1304 1305
};

static struct clk gpios_fck = {
	.name		= "gpios_fck",
1306
	.ops		= &clkops_omap2_dflt_wait,
1307
	.parent		= &func_32k_ck,
1308
	.clkdm_name	= "wkup_clkdm",
1309 1310 1311
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
	.enable_bit	= OMAP24XX_EN_GPIOS_SHIFT,
	.recalc		= &followparent_recalc,
1312 1313 1314 1315
};

static struct clk mpu_wdt_ick = {
	.name		= "mpu_wdt_ick",
1316
	.ops		= &clkops_omap2_iclk_dflt_wait,
1317 1318
	.parent		= &wu_l4_ick,
	.clkdm_name	= "wkup_clkdm",
1319 1320 1321
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_MPU_WDT_SHIFT,
	.recalc		= &followparent_recalc,
1322 1323 1324 1325
};

static struct clk mpu_wdt_fck = {
	.name		= "mpu_wdt_fck",
1326
	.ops		= &clkops_omap2_dflt_wait,
1327
	.parent		= &func_32k_ck,
1328
	.clkdm_name	= "wkup_clkdm",
1329 1330 1331
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
	.enable_bit	= OMAP24XX_EN_MPU_WDT_SHIFT,
	.recalc		= &followparent_recalc,
1332 1333 1334 1335
};

static struct clk sync_32k_ick = {
	.name		= "sync_32k_ick",
1336
	.ops		= &clkops_omap2_iclk_dflt_wait,
1337 1338
	.parent		= &wu_l4_ick,
	.clkdm_name	= "wkup_clkdm",
1339
	.flags		= ENABLE_ON_INIT,
1340 1341 1342
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_32KSYNC_SHIFT,
	.recalc		= &followparent_recalc,
1343
};
1344

1345 1346
static struct clk wdt1_ick = {
	.name		= "wdt1_ick",
1347
	.ops		= &clkops_omap2_iclk_dflt_wait,
1348 1349
	.parent		= &wu_l4_ick,
	.clkdm_name	= "wkup_clkdm",
1350 1351 1352
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_WDT1_SHIFT,
	.recalc		= &followparent_recalc,
1353
};
1354

1355 1356
static struct clk omapctrl_ick = {
	.name		= "omapctrl_ick",
1357
	.ops		= &clkops_omap2_iclk_dflt_wait,
1358 1359
	.parent		= &wu_l4_ick,
	.clkdm_name	= "wkup_clkdm",
1360
	.flags		= ENABLE_ON_INIT,
1361 1362 1363
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_OMAPCTRL_SHIFT,
	.recalc		= &followparent_recalc,
1364
};
1365

1366 1367
static struct clk cam_ick = {
	.name		= "cam_ick",
1368
	.ops		= &clkops_omap2_iclk_dflt,
1369
	.parent		= &l4_ck,
1370
	.clkdm_name	= "core_l4_clkdm",
1371 1372 1373
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_CAM_SHIFT,
	.recalc		= &followparent_recalc,
1374 1375
};

1376 1377 1378 1379 1380
/*
 * 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.
 */
1381 1382
static struct clk cam_fck = {
	.name		= "cam_fck",
1383
	.ops		= &clkops_omap2_dflt,
1384
	.parent		= &func_96m_ck,
1385
	.clkdm_name	= "core_l3_clkdm",
1386 1387 1388
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_CAM_SHIFT,
	.recalc		= &followparent_recalc,
1389 1390 1391 1392
};

static struct clk mailboxes_ick = {
	.name		= "mailboxes_ick",
1393
	.ops		= &clkops_omap2_iclk_dflt_wait,
1394
	.parent		= &l4_ck,
1395
	.clkdm_name	= "core_l4_clkdm",
1396 1397 1398
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_MAILBOXES_SHIFT,
	.recalc		= &followparent_recalc,
1399 1400 1401 1402
};

static struct clk wdt4_ick = {
	.name		= "wdt4_ick",
1403
	.ops		= &clkops_omap2_iclk_dflt_wait,
1404
	.parent		= &l4_ck,
1405
	.clkdm_name	= "core_l4_clkdm",
1406 1407 1408
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_WDT4_SHIFT,
	.recalc		= &followparent_recalc,
1409 1410 1411 1412
};

static struct clk wdt4_fck = {
	.name		= "wdt4_fck",
1413
	.ops		= &clkops_omap2_dflt_wait,
1414
	.parent		= &func_32k_ck,
1415
	.clkdm_name	= "core_l4_clkdm",
1416 1417 1418
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_WDT4_SHIFT,
	.recalc		= &followparent_recalc,
1419 1420 1421 1422
};

static struct clk wdt3_ick = {
	.name		= "wdt3_ick",
1423
	.ops		= &clkops_omap2_iclk_dflt_wait,
1424
	.parent		= &l4_ck,
1425
	.clkdm_name	= "core_l4_clkdm",
1426 1427 1428
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP2420_EN_WDT3_SHIFT,
	.recalc		= &followparent_recalc,
1429 1430 1431 1432
};

static struct clk wdt3_fck = {
	.name		= "wdt3_fck",
1433
	.ops		= &clkops_omap2_dflt_wait,
1434
	.parent		= &func_32k_ck,
1435
	.clkdm_name	= "core_l4_clkdm",
1436 1437 1438
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP2420_EN_WDT3_SHIFT,
	.recalc		= &followparent_recalc,
1439 1440 1441 1442
};

static struct clk mspro_ick = {
	.name		= "mspro_ick",
1443
	.ops		= &clkops_omap2_iclk_dflt_wait,
1444
	.parent		= &l4_ck,
1445
	.clkdm_name	= "core_l4_clkdm",
1446 1447 1448
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_MSPRO_SHIFT,
	.recalc		= &followparent_recalc,
1449 1450 1451 1452
};

static struct clk mspro_fck = {
	.name		= "mspro_fck",
1453
	.ops		= &clkops_omap2_dflt_wait,
1454
	.parent		= &func_96m_ck,
1455
	.clkdm_name	= "core_l4_clkdm",
1456 1457 1458
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_MSPRO_SHIFT,
	.recalc		= &followparent_recalc,
1459 1460 1461 1462
};

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

static struct clk mmc_fck = {
	.name		= "mmc_fck",
1473
	.ops		= &clkops_omap2_dflt_wait,
1474
	.parent		= &func_96m_ck,
1475
	.clkdm_name	= "core_l4_clkdm",
1476 1477 1478
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP2420_EN_MMC_SHIFT,
	.recalc		= &followparent_recalc,
1479 1480 1481 1482
};

static struct clk fac_ick = {
	.name		= "fac_ick",
1483
	.ops		= &clkops_omap2_iclk_dflt_wait,
1484
	.parent		= &l4_ck,
1485
	.clkdm_name	= "core_l4_clkdm",
1486 1487 1488
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_FAC_SHIFT,
	.recalc		= &followparent_recalc,
1489 1490 1491 1492
};

static struct clk fac_fck = {
	.name		= "fac_fck",
1493
	.ops		= &clkops_omap2_dflt_wait,
1494
	.parent		= &func_12m_ck,
1495
	.clkdm_name	= "core_l4_clkdm",
1496 1497 1498
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_FAC_SHIFT,
	.recalc		= &followparent_recalc,
1499 1500 1501 1502
};

static struct clk eac_ick = {
	.name		= "eac_ick",
1503
	.ops		= &clkops_omap2_iclk_dflt_wait,
1504
	.parent		= &l4_ck,
1505
	.clkdm_name	= "core_l4_clkdm",
1506 1507 1508
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP2420_EN_EAC_SHIFT,
	.recalc		= &followparent_recalc,
1509 1510 1511 1512
};

static struct clk eac_fck = {
	.name		= "eac_fck",
1513
	.ops		= &clkops_omap2_dflt_wait,
1514
	.parent		= &func_96m_ck,
1515
	.clkdm_name	= "core_l4_clkdm",
1516 1517 1518
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP2420_EN_EAC_SHIFT,
	.recalc		= &followparent_recalc,
1519 1520 1521 1522
};

static struct clk hdq_ick = {
	.name		= "hdq_ick",
1523
	.ops		= &clkops_omap2_iclk_dflt_wait,
1524
	.parent		= &l4_ck,
1525
	.clkdm_name	= "core_l4_clkdm",
1526 1527 1528
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_HDQ_SHIFT,
	.recalc		= &followparent_recalc,
1529 1530 1531 1532
};

static struct clk hdq_fck = {
	.name		= "hdq_fck",
1533
	.ops		= &clkops_omap2_dflt_wait,
1534
	.parent		= &func_12m_ck,
1535
	.clkdm_name	= "core_l4_clkdm",
1536 1537 1538
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_HDQ_SHIFT,
	.recalc		= &followparent_recalc,
1539 1540 1541
};

static struct clk i2c2_ick = {
1542
	.name		= "i2c2_ick",
1543
	.ops		= &clkops_omap2_iclk_dflt_wait,
1544
	.parent		= &l4_ck,
1545
	.clkdm_name	= "core_l4_clkdm",
1546 1547 1548
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP2420_EN_I2C2_SHIFT,
	.recalc		= &followparent_recalc,
1549 1550 1551
};

static struct clk i2c2_fck = {
1552
	.name		= "i2c2_fck",
1553
	.ops		= &clkops_omap2_dflt_wait,
1554
	.parent		= &func_12m_ck,
1555
	.clkdm_name	= "core_l4_clkdm",
1556 1557 1558
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP2420_EN_I2C2_SHIFT,
	.recalc		= &followparent_recalc,
1559 1560 1561
};

static struct clk i2c1_ick = {
1562
	.name		= "i2c1_ick",
1563
	.ops		= &clkops_omap2_iclk_dflt_wait,
1564
	.parent		= &l4_ck,
1565
	.clkdm_name	= "core_l4_clkdm",
1566 1567 1568
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP2420_EN_I2C1_SHIFT,
	.recalc		= &followparent_recalc,
1569 1570 1571
};

static struct clk i2c1_fck = {
1572
	.name		= "i2c1_fck",
1573
	.ops		= &clkops_omap2_dflt_wait,
1574
	.parent		= &func_12m_ck,
1575
	.clkdm_name	= "core_l4_clkdm",
1576 1577 1578
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP2420_EN_I2C1_SHIFT,
	.recalc		= &followparent_recalc,
1579 1580
};

1581 1582 1583 1584
/*
 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
 * accesses derived from this data.
 */
1585 1586
static struct clk gpmc_fck = {
	.name		= "gpmc_fck",
1587
	.ops		= &clkops_omap2_iclk_idle_only,
1588
	.parent		= &core_l3_ck,
1589
	.flags		= ENABLE_ON_INIT,
1590
	.clkdm_name	= "core_l3_clkdm",
1591 1592
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
	.enable_bit	= OMAP24XX_AUTO_GPMC_SHIFT,
1593 1594 1595 1596 1597
	.recalc		= &followparent_recalc,
};

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

1604 1605 1606 1607
/*
 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
 * accesses derived from this data.
 */
1608 1609
static struct clk sdma_ick = {
	.name		= "sdma_ick",
1610
	.ops		= &clkops_omap2_iclk_idle_only,
1611
	.parent		= &core_l3_ck,
1612
	.clkdm_name	= "core_l3_clkdm",
1613 1614
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
	.enable_bit	= OMAP24XX_AUTO_SDMA_SHIFT,
1615
	.recalc		= &followparent_recalc,
1616 1617
};

P
Paul Walmsley 已提交
1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632
/*
 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
 * accesses derived from this data.
 */
static struct clk sdrc_ick = {
	.name		= "sdrc_ick",
	.ops		= &clkops_omap2_iclk_idle_only,
	.parent		= &core_l3_ck,
	.flags		= ENABLE_ON_INIT,
	.clkdm_name	= "core_l3_clkdm",
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
	.enable_bit	= OMAP24XX_AUTO_SDRC_SHIFT,
	.recalc		= &followparent_recalc,
};

1633 1634
static struct clk vlynq_ick = {
	.name		= "vlynq_ick",
1635
	.ops		= &clkops_omap2_iclk_dflt_wait,
1636
	.parent		= &core_l3_ck,
1637
	.clkdm_name	= "core_l3_clkdm",
1638 1639 1640 1641 1642 1643
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP2420_EN_VLYNQ_SHIFT,
	.recalc		= &followparent_recalc,
};

static const struct clksel_rate vlynq_fck_96m_rates[] = {
1644
	{ .div = 1, .val = 0, .flags = RATE_IN_242X },
1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656
	{ .div = 0 }
};

static const struct clksel_rate vlynq_fck_core_rates[] = {
	{ .div = 1, .val = 1, .flags = RATE_IN_242X },
	{ .div = 2, .val = 2, .flags = RATE_IN_242X },
	{ .div = 3, .val = 3, .flags = RATE_IN_242X },
	{ .div = 4, .val = 4, .flags = RATE_IN_242X },
	{ .div = 6, .val = 6, .flags = RATE_IN_242X },
	{ .div = 8, .val = 8, .flags = RATE_IN_242X },
	{ .div = 9, .val = 9, .flags = RATE_IN_242X },
	{ .div = 12, .val = 12, .flags = RATE_IN_242X },
1657
	{ .div = 16, .val = 16, .flags = RATE_IN_242X },
1658 1659 1660 1661 1662 1663 1664 1665
	{ .div = 18, .val = 18, .flags = RATE_IN_242X },
	{ .div = 0 }
};

static const struct clksel vlynq_fck_clksel[] = {
	{ .parent = &func_96m_ck, .rates = vlynq_fck_96m_rates },
	{ .parent = &core_ck,	  .rates = vlynq_fck_core_rates },
	{ .parent = NULL }
1666 1667 1668 1669
};

static struct clk vlynq_fck = {
	.name		= "vlynq_fck",
1670
	.ops		= &clkops_omap2_dflt_wait,
1671
	.parent		= &func_96m_ck,
1672
	.clkdm_name	= "core_l3_clkdm",
1673 1674 1675 1676 1677 1678 1679
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP2420_EN_VLYNQ_SHIFT,
	.init		= &omap2_init_clksel_parent,
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
	.clksel_mask	= OMAP2420_CLKSEL_VLYNQ_MASK,
	.clksel		= vlynq_fck_clksel,
	.recalc		= &omap2_clksel_recalc,
1680 1681 1682 1683
};

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

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

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

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

static struct clk pka_ick = {
	.name		= "pka_ick",
1724
	.ops		= &clkops_omap2_iclk_dflt_wait,
1725
	.parent		= &l4_ck,
1726
	.clkdm_name	= "core_l4_clkdm",
1727 1728 1729
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
	.enable_bit	= OMAP24XX_EN_PKA_SHIFT,
	.recalc		= &followparent_recalc,
1730 1731 1732 1733
};

static struct clk usb_fck = {
	.name		= "usb_fck",
1734
	.ops		= &clkops_omap2_dflt_wait,
1735
	.parent		= &func_48m_ck,
1736
	.clkdm_name	= "core_l3_clkdm",
1737 1738 1739
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP24XX_EN_USB_SHIFT,
	.recalc		= &followparent_recalc,
1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757
};

/*
 * 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",
1758
	.ops		= &clkops_null,
1759
	.parent		= &mpu_ck,	/* Indexed by mpu speed, no parent */
1760
	.recalc		= &omap2_table_mpu_recalc,	/* sets are keyed on mpu rate */
1761 1762 1763
	.set_rate	= &omap2_select_table_rate,
	.round_rate	= &omap2_round_to_table_rate,
};
1764

1765 1766 1767 1768 1769

/*
 * clkdev integration
 */

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

/*
 * init code
 */

1909
int __init omap2420_clk_init(void)
1910 1911 1912 1913
{
	const struct prcm_config *prcm;
	struct omap_clk *c;
	u32 clkrate;
1914 1915 1916 1917 1918

	prcm_clksrc_ctrl = OMAP2420_PRCM_CLKSRC_CTRL;
	cm_idlest_pll = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST);
	cpu_mask = RATE_IN_242X;
	rate_table = omap2420_rate_table;
1919 1920 1921

	clk_init(&omap2_clk_functions);

1922 1923
	for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks);
	     c++)
1924 1925 1926 1927
		clk_preinit(c->lk.clk);

	osc_ck.rate = omap2_osc_clk_recalc(&osc_ck);
	propagate_rate(&osc_ck);
1928
	sys_ck.rate = omap2xxx_sys_clk_recalc(&sys_ck);
1929 1930
	propagate_rate(&sys_ck);

1931 1932 1933 1934 1935 1936
	for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks);
	     c++) {
		clkdev_add(&c->lk);
		clk_register(c->lk.clk);
		omap2_init_clk_clkdm(c->lk.clk);
	}
1937

1938 1939 1940
	/* Disable autoidle on all clocks; let the PM code enable it later */
	omap_clk_disable_autoidle_all();

1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954
	/* 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();

1955 1956 1957
	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)) ;
1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971

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