clock2430_data.c 62.8 KB
Newer Older
1
/*
2
 * OMAP2430 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 17
#include <linux/kernel.h>
#include <linux/clk.h>
18
#include <linux/list.h>
19

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

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

34 35 36 37
#define OMAP_CM_REGADDR			OMAP2430_CM_REGADDR

/*
 * 2430 clock tree.
38
 *
39 40 41
 * 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.
42 43 44 45 46
 *
 *	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
47
 *	noteworthy that most peripherals have dependencies on multiple clock
48 49 50
 *	domains. Many get their interface clocks from the L4 domain, but get
 *	functional clocks from fixed sources or other core domain derived
 *	clocks.
51
 */
52 53 54 55

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

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

68 69 70
/* 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",
71
	.ops		= &clkops_oscck,
72
	.clkdm_name	= "wkup_clkdm",
73
	.recalc		= &omap2_osc_clk_recalc,
74 75
};

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

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

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

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

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

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

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

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

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

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

/* func_54m_ck */

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

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

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

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

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

204
static const struct clksel_rate func_96m_alt_rates[] = {
205
	{ .div = 1, .val = 1, .flags = RATE_IN_243X },
206 207 208 209 210 211 212 213 214
	{ .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 }
};

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

/* func_48m_ck */

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

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

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

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

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

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

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

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

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

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

};
365

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

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

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

435 436
static const struct clksel dsp_ick_clksel[] = {
	{ .parent = &dsp_fck, .rates = dsp_ick_rates },
437
	{ .parent = NULL }
438 439
};

440 441 442
/* 2430 only - EN_DSP controls both dsp fclk and iclk on 2430 */
static struct clk iva2_1_ick = {
	.name		= "iva2_1_ick",
443
	.ops		= &clkops_omap2_dflt_wait,
444 445
	.parent		= &dsp_fck,
	.clkdm_name	= "dsp_clkdm",
446 447
	.enable_reg	= OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
	.enable_bit	= OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT,
448 449 450 451
	.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,
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472
};

/*
 * 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.
 */
473 474
static const struct clksel_rate core_l3_core_rates[] = {
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
475
	{ .div = 4, .val = 4, .flags = RATE_IN_24XX },
476 477 478 479 480 481 482 483 484
	{ .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 }
};

485 486
static struct clk core_l3_ck = {	/* Used for ick and fck, interconnect */
	.name		= "core_l3_ck",
487
	.ops		= &clkops_null,
488
	.parent		= &core_ck,
489
	.clkdm_name	= "core_l3_clkdm",
490 491 492
	.clksel_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
	.clksel_mask	= OMAP24XX_CLKSEL_L3_MASK,
	.clksel		= core_l3_clksel,
493
	.recalc		= &omap2_clksel_recalc,
494 495 496 497 498
};

/* usb_l4_ick */
static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
499
	{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
500 501 502 503 504 505 506
	{ .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 },
507 508
};

509
/* It is unclear from TRM whether usb_l4_ick is really in L3 or L4 clkdm */
510 511
static struct clk usb_l4_ick = {	/* FS-USB interface clock */
	.name		= "usb_l4_ick",
512
	.ops		= &clkops_omap2_iclk_dflt_wait,
513
	.parent		= &core_l3_ck,
514
	.clkdm_name	= "core_l4_clkdm",
515 516 517 518 519
	.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,
520 521 522
	.recalc		= &omap2_clksel_recalc,
};

523 524 525 526 527 528 529 530
/*
 * 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[] = {
531
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
532 533 534 535 536 537 538 539 540 541 542
	{ .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",
543
	.ops		= &clkops_null,
544 545 546 547 548 549 550 551
	.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,
};

552 553 554 555
/*
 * 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.
556
 * SSI_SSR_FCLK, SSI_SST_FCLK, SSI_L4_ICLK
557 558 559
 *
 * ssr = core/1/2/3/4/5, sst = 1/2 ssr.
 */
560 561
static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
562
	{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
563 564 565 566 567 568 569 570 571 572 573
	{ .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 }
};

574 575
static struct clk ssi_ssr_sst_fck = {
	.name		= "ssi_fck",
576
	.ops		= &clkops_omap2_dflt_wait,
577
	.parent		= &core_ck,
578
	.clkdm_name	= "core_l3_clkdm",
579 580 581 582 583
	.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,
584 585 586
	.recalc		= &omap2_clksel_recalc,
};

587 588 589 590 591 592
/*
 * 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",
593
	.ops		= &clkops_omap2_iclk_dflt_wait,
594 595 596 597 598 599 600
	.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,
};

601

602 603 604 605 606 607 608 609 610 611 612
/*
 * 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.
 *
 */
613 614 615 616 617 618 619

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

620 621
static struct clk gfx_3d_fck = {
	.name		= "gfx_3d_fck",
622
	.ops		= &clkops_omap2_dflt_wait,
623
	.parent		= &core_l3_ck,
624
	.clkdm_name	= "gfx_clkdm",
625 626 627 628 629
	.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,
630
	.recalc		= &omap2_clksel_recalc,
631 632
	.round_rate	= &omap2_clksel_round_rate,
	.set_rate	= &omap2_clksel_set_rate
633 634 635 636
};

static struct clk gfx_2d_fck = {
	.name		= "gfx_2d_fck",
637
	.ops		= &clkops_omap2_dflt_wait,
638
	.parent		= &core_l3_ck,
639
	.clkdm_name	= "gfx_clkdm",
640 641 642 643 644
	.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,
645 646 647
	.recalc		= &omap2_clksel_recalc,
};

648
/* This interface clock does not have a CM_AUTOIDLE bit */
649 650
static struct clk gfx_ick = {
	.name		= "gfx_ick",		/* From l3 */
651
	.ops		= &clkops_omap2_dflt_wait,
652
	.parent		= &core_l3_ck,
653
	.clkdm_name	= "gfx_clkdm",
654 655 656
	.enable_reg	= OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
	.enable_bit	= OMAP_EN_GFX_SHIFT,
	.recalc		= &followparent_recalc,
657 658 659 660 661 662 663
};

/*
 * Modem clock domain (2430)
 *	CLOCKS:
 *		MDM_OSC_CLK
 *		MDM_ICLK
664
 * These clocks are usable in chassis mode only.
665
 */
666 667
static const struct clksel_rate mdm_ick_core_rates[] = {
	{ .div = 1, .val = 1, .flags = RATE_IN_243X },
668
	{ .div = 4, .val = 4, .flags = RATE_IN_243X },
669 670 671 672 673 674 675 676 677 678
	{ .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 }
};

679 680
static struct clk mdm_ick = {		/* used both as a ick and fck */
	.name		= "mdm_ick",
681
	.ops		= &clkops_omap2_iclk_dflt_wait,
682
	.parent		= &core_ck,
683
	.clkdm_name	= "mdm_clkdm",
684 685 686 687 688
	.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,
689 690 691 692 693
	.recalc		= &omap2_clksel_recalc,
};

static struct clk mdm_osc_ck = {
	.name		= "mdm_osc_ck",
694
	.ops		= &clkops_omap2_mdmclk_dflt_wait,
695
	.parent		= &osc_ck,
696
	.clkdm_name	= "mdm_clkdm",
697 698 699
	.enable_reg	= OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_FCLKEN),
	.enable_bit	= OMAP2430_EN_OSC_SHIFT,
	.recalc		= &followparent_recalc,
700 701 702 703 704 705 706 707 708 709
};

/*
 * DSS clock domain
 * CLOCKs:
 * DSS_L4_ICLK, DSS_L3_ICLK,
 * DSS_CLK1, DSS_CLK2, DSS_54MHz_CLK
 *
 * DSS is both initiator and target.
 */
710 711 712
/* XXX Add RATE_NOT_VALIDATED */

static const struct clksel_rate dss1_fck_sys_rates[] = {
713
	{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
714 715 716 717 718 719 720 721 722 723 724 725 726
	{ .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 },
727
	{ .div = 16, .val = 16, .flags = RATE_IN_24XX },
728 729 730 731 732 733 734 735 736
	{ .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 },
};

737 738
static struct clk dss_ick = {		/* Enables both L3,L4 ICLK's */
	.name		= "dss_ick",
739
	.ops		= &clkops_omap2_iclk_dflt,
740
	.parent		= &l4_ck,	/* really both l3 and l4 */
741
	.clkdm_name	= "dss_clkdm",
742 743 744
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_DSS1_SHIFT,
	.recalc		= &followparent_recalc,
745 746 747 748
};

static struct clk dss1_fck = {
	.name		= "dss1_fck",
749
	.ops		= &clkops_omap2_dflt,
750
	.parent		= &core_ck,		/* Core or sys */
751
	.clkdm_name	= "dss_clkdm",
752 753 754 755 756 757
	.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,
758
	.recalc		= &omap2_clksel_recalc,
759 760 761
};

static const struct clksel_rate dss2_fck_sys_rates[] = {
762
	{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
763 764 765 766
	{ .div = 0 }
};

static const struct clksel_rate dss2_fck_48m_rates[] = {
767
	{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
768 769 770 771 772 773 774
	{ .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 }
775 776 777 778
};

static struct clk dss2_fck = {		/* Alt clk used in power management */
	.name		= "dss2_fck",
779
	.ops		= &clkops_omap2_dflt,
780
	.parent		= &sys_ck,		/* fixed at sys_ck or 48MHz */
781
	.clkdm_name	= "dss_clkdm",
782 783 784 785 786 787
	.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,
788
	.recalc		= &omap2_clksel_recalc,
789 790 791 792
};

static struct clk dss_54m_fck = {	/* Alt clk used in power management */
	.name		= "dss_54m_fck",	/* 54m tv clk */
793
	.ops		= &clkops_omap2_dflt_wait,
794
	.parent		= &func_54m_ck,
795
	.clkdm_name	= "dss_clkdm",
796 797 798
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_TV_SHIFT,
	.recalc		= &followparent_recalc,
799 800
};

801 802 803 804 805 806 807 808
static struct clk wu_l4_ick = {
	.name		= "wu_l4_ick",
	.ops		= &clkops_null,
	.parent		= &sys_ck,
	.clkdm_name	= "wkup_clkdm",
	.recalc		= &followparent_recalc,
};

809 810 811 812 813 814
/*
 * 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.
 */
815
static const struct clksel_rate gpt_alt_rates[] = {
816
	{ .div = 1, .val = 2, .flags = RATE_IN_24XX },
817 818 819 820 821 822 823 824 825 826
	{ .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 },
};

827 828
static struct clk gpt1_ick = {
	.name		= "gpt1_ick",
829
	.ops		= &clkops_omap2_iclk_dflt_wait,
830 831
	.parent		= &wu_l4_ick,
	.clkdm_name	= "wkup_clkdm",
832 833 834
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_GPT1_SHIFT,
	.recalc		= &followparent_recalc,
835 836 837 838
};

static struct clk gpt1_fck = {
	.name		= "gpt1_fck",
839
	.ops		= &clkops_omap2_dflt_wait,
840
	.parent		= &func_32k_ck,
841
	.clkdm_name	= "core_l4_clkdm",
842 843 844 845 846 847 848 849 850
	.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
851 852 853 854
};

static struct clk gpt2_ick = {
	.name		= "gpt2_ick",
855
	.ops		= &clkops_omap2_iclk_dflt_wait,
856
	.parent		= &l4_ck,
857
	.clkdm_name	= "core_l4_clkdm",
858 859 860
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT2_SHIFT,
	.recalc		= &followparent_recalc,
861 862 863 864
};

static struct clk gpt2_fck = {
	.name		= "gpt2_fck",
865
	.ops		= &clkops_omap2_dflt_wait,
866
	.parent		= &func_32k_ck,
867
	.clkdm_name	= "core_l4_clkdm",
868 869 870 871 872 873 874
	.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,
875 876 877 878
};

static struct clk gpt3_ick = {
	.name		= "gpt3_ick",
879
	.ops		= &clkops_omap2_iclk_dflt_wait,
880
	.parent		= &l4_ck,
881
	.clkdm_name	= "core_l4_clkdm",
882 883 884
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT3_SHIFT,
	.recalc		= &followparent_recalc,
885 886 887 888
};

static struct clk gpt3_fck = {
	.name		= "gpt3_fck",
889
	.ops		= &clkops_omap2_dflt_wait,
890
	.parent		= &func_32k_ck,
891
	.clkdm_name	= "core_l4_clkdm",
892 893 894 895 896 897 898
	.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,
899 900 901 902
};

static struct clk gpt4_ick = {
	.name		= "gpt4_ick",
903
	.ops		= &clkops_omap2_iclk_dflt_wait,
904
	.parent		= &l4_ck,
905
	.clkdm_name	= "core_l4_clkdm",
906 907 908
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT4_SHIFT,
	.recalc		= &followparent_recalc,
909 910 911 912
};

static struct clk gpt4_fck = {
	.name		= "gpt4_fck",
913
	.ops		= &clkops_omap2_dflt_wait,
914
	.parent		= &func_32k_ck,
915
	.clkdm_name	= "core_l4_clkdm",
916 917 918 919 920 921 922
	.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,
923 924 925 926
};

static struct clk gpt5_ick = {
	.name		= "gpt5_ick",
927
	.ops		= &clkops_omap2_iclk_dflt_wait,
928
	.parent		= &l4_ck,
929
	.clkdm_name	= "core_l4_clkdm",
930 931 932
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT5_SHIFT,
	.recalc		= &followparent_recalc,
933 934 935 936
};

static struct clk gpt5_fck = {
	.name		= "gpt5_fck",
937
	.ops		= &clkops_omap2_dflt_wait,
938
	.parent		= &func_32k_ck,
939
	.clkdm_name	= "core_l4_clkdm",
940 941 942 943 944 945 946
	.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,
947 948 949 950
};

static struct clk gpt6_ick = {
	.name		= "gpt6_ick",
951
	.ops		= &clkops_omap2_iclk_dflt_wait,
952
	.parent		= &l4_ck,
953
	.clkdm_name	= "core_l4_clkdm",
954 955 956
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT6_SHIFT,
	.recalc		= &followparent_recalc,
957 958 959 960
};

static struct clk gpt6_fck = {
	.name		= "gpt6_fck",
961
	.ops		= &clkops_omap2_dflt_wait,
962
	.parent		= &func_32k_ck,
963
	.clkdm_name	= "core_l4_clkdm",
964 965 966 967 968 969 970
	.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,
971 972 973 974
};

static struct clk gpt7_ick = {
	.name		= "gpt7_ick",
975
	.ops		= &clkops_omap2_iclk_dflt_wait,
976
	.parent		= &l4_ck,
977
	.clkdm_name	= "core_l4_clkdm",
978 979 980
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT7_SHIFT,
	.recalc		= &followparent_recalc,
981 982 983 984
};

static struct clk gpt7_fck = {
	.name		= "gpt7_fck",
985
	.ops		= &clkops_omap2_dflt_wait,
986
	.parent		= &func_32k_ck,
987
	.clkdm_name	= "core_l4_clkdm",
988 989 990 991 992 993 994
	.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,
995 996 997 998
};

static struct clk gpt8_ick = {
	.name		= "gpt8_ick",
999
	.ops		= &clkops_omap2_iclk_dflt_wait,
1000
	.parent		= &l4_ck,
1001
	.clkdm_name	= "core_l4_clkdm",
1002 1003 1004
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT8_SHIFT,
	.recalc		= &followparent_recalc,
1005 1006 1007 1008
};

static struct clk gpt8_fck = {
	.name		= "gpt8_fck",
1009
	.ops		= &clkops_omap2_dflt_wait,
1010
	.parent		= &func_32k_ck,
1011
	.clkdm_name	= "core_l4_clkdm",
1012 1013 1014 1015 1016 1017 1018
	.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,
1019 1020 1021 1022
};

static struct clk gpt9_ick = {
	.name		= "gpt9_ick",
1023
	.ops		= &clkops_omap2_iclk_dflt_wait,
1024
	.parent		= &l4_ck,
1025
	.clkdm_name	= "core_l4_clkdm",
1026 1027 1028
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT9_SHIFT,
	.recalc		= &followparent_recalc,
1029 1030 1031 1032
};

static struct clk gpt9_fck = {
	.name		= "gpt9_fck",
1033
	.ops		= &clkops_omap2_dflt_wait,
1034
	.parent		= &func_32k_ck,
1035
	.clkdm_name	= "core_l4_clkdm",
1036 1037 1038 1039 1040 1041 1042
	.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,
1043 1044 1045 1046
};

static struct clk gpt10_ick = {
	.name		= "gpt10_ick",
1047
	.ops		= &clkops_omap2_iclk_dflt_wait,
1048
	.parent		= &l4_ck,
1049
	.clkdm_name	= "core_l4_clkdm",
1050 1051 1052
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT10_SHIFT,
	.recalc		= &followparent_recalc,
1053 1054 1055 1056
};

static struct clk gpt10_fck = {
	.name		= "gpt10_fck",
1057
	.ops		= &clkops_omap2_dflt_wait,
1058
	.parent		= &func_32k_ck,
1059
	.clkdm_name	= "core_l4_clkdm",
1060 1061 1062 1063 1064 1065 1066
	.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,
1067 1068 1069 1070
};

static struct clk gpt11_ick = {
	.name		= "gpt11_ick",
1071
	.ops		= &clkops_omap2_iclk_dflt_wait,
1072
	.parent		= &l4_ck,
1073
	.clkdm_name	= "core_l4_clkdm",
1074 1075 1076
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT11_SHIFT,
	.recalc		= &followparent_recalc,
1077 1078 1079 1080
};

static struct clk gpt11_fck = {
	.name		= "gpt11_fck",
1081
	.ops		= &clkops_omap2_dflt_wait,
1082
	.parent		= &func_32k_ck,
1083
	.clkdm_name	= "core_l4_clkdm",
1084 1085 1086 1087 1088 1089 1090
	.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,
1091 1092 1093 1094
};

static struct clk gpt12_ick = {
	.name		= "gpt12_ick",
1095
	.ops		= &clkops_omap2_iclk_dflt_wait,
1096
	.parent		= &l4_ck,
1097
	.clkdm_name	= "core_l4_clkdm",
1098 1099 1100
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_GPT12_SHIFT,
	.recalc		= &followparent_recalc,
1101 1102 1103 1104
};

static struct clk gpt12_fck = {
	.name		= "gpt12_fck",
1105
	.ops		= &clkops_omap2_dflt_wait,
1106
	.parent		= &secure_32k_ck,
1107
	.clkdm_name	= "core_l4_clkdm",
1108 1109 1110 1111 1112 1113 1114
	.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,
1115 1116 1117
};

static struct clk mcbsp1_ick = {
1118
	.name		= "mcbsp1_ick",
1119
	.ops		= &clkops_omap2_iclk_dflt_wait,
1120
	.parent		= &l4_ck,
1121
	.clkdm_name	= "core_l4_clkdm",
1122 1123 1124
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_MCBSP1_SHIFT,
	.recalc		= &followparent_recalc,
1125 1126
};

1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142
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 }
};

1143
static struct clk mcbsp1_fck = {
1144
	.name		= "mcbsp1_fck",
1145
	.ops		= &clkops_omap2_dflt_wait,
1146
	.parent		= &func_96m_ck,
1147
	.init		= &omap2_init_clksel_parent,
1148
	.clkdm_name	= "core_l4_clkdm",
1149 1150
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_MCBSP1_SHIFT,
1151 1152 1153 1154
	.clksel_reg	= OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
	.clksel_mask	= OMAP2_MCBSP1_CLKS_MASK,
	.clksel		= mcbsp_fck_clksel,
	.recalc		= &omap2_clksel_recalc,
1155 1156 1157
};

static struct clk mcbsp2_ick = {
1158
	.name		= "mcbsp2_ick",
1159
	.ops		= &clkops_omap2_iclk_dflt_wait,
1160
	.parent		= &l4_ck,
1161
	.clkdm_name	= "core_l4_clkdm",
1162 1163 1164
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_MCBSP2_SHIFT,
	.recalc		= &followparent_recalc,
1165 1166 1167
};

static struct clk mcbsp2_fck = {
1168
	.name		= "mcbsp2_fck",
1169
	.ops		= &clkops_omap2_dflt_wait,
1170
	.parent		= &func_96m_ck,
1171
	.init		= &omap2_init_clksel_parent,
1172
	.clkdm_name	= "core_l4_clkdm",
1173 1174
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_MCBSP2_SHIFT,
1175 1176 1177 1178
	.clksel_reg	= OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
	.clksel_mask	= OMAP2_MCBSP2_CLKS_MASK,
	.clksel		= mcbsp_fck_clksel,
	.recalc		= &omap2_clksel_recalc,
1179 1180 1181
};

static struct clk mcbsp3_ick = {
1182
	.name		= "mcbsp3_ick",
1183
	.ops		= &clkops_omap2_iclk_dflt_wait,
1184
	.parent		= &l4_ck,
1185
	.clkdm_name	= "core_l4_clkdm",
1186 1187 1188
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_MCBSP3_SHIFT,
	.recalc		= &followparent_recalc,
1189 1190 1191
};

static struct clk mcbsp3_fck = {
1192
	.name		= "mcbsp3_fck",
1193
	.ops		= &clkops_omap2_dflt_wait,
1194
	.parent		= &func_96m_ck,
1195
	.init		= &omap2_init_clksel_parent,
1196
	.clkdm_name	= "core_l4_clkdm",
1197 1198
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_MCBSP3_SHIFT,
1199 1200 1201 1202
	.clksel_reg	= OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
	.clksel_mask	= OMAP2_MCBSP3_CLKS_MASK,
	.clksel		= mcbsp_fck_clksel,
	.recalc		= &omap2_clksel_recalc,
1203 1204 1205
};

static struct clk mcbsp4_ick = {
1206
	.name		= "mcbsp4_ick",
1207
	.ops		= &clkops_omap2_iclk_dflt_wait,
1208
	.parent		= &l4_ck,
1209
	.clkdm_name	= "core_l4_clkdm",
1210 1211 1212
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_MCBSP4_SHIFT,
	.recalc		= &followparent_recalc,
1213 1214 1215
};

static struct clk mcbsp4_fck = {
1216
	.name		= "mcbsp4_fck",
1217
	.ops		= &clkops_omap2_dflt_wait,
1218
	.parent		= &func_96m_ck,
1219
	.init		= &omap2_init_clksel_parent,
1220
	.clkdm_name	= "core_l4_clkdm",
1221 1222
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_MCBSP4_SHIFT,
1223 1224 1225 1226
	.clksel_reg	= OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
	.clksel_mask	= OMAP2_MCBSP4_CLKS_MASK,
	.clksel		= mcbsp_fck_clksel,
	.recalc		= &omap2_clksel_recalc,
1227 1228 1229
};

static struct clk mcbsp5_ick = {
1230
	.name		= "mcbsp5_ick",
1231
	.ops		= &clkops_omap2_iclk_dflt_wait,
1232
	.parent		= &l4_ck,
1233
	.clkdm_name	= "core_l4_clkdm",
1234 1235 1236
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_MCBSP5_SHIFT,
	.recalc		= &followparent_recalc,
1237 1238 1239
};

static struct clk mcbsp5_fck = {
1240
	.name		= "mcbsp5_fck",
1241
	.ops		= &clkops_omap2_dflt_wait,
1242
	.parent		= &func_96m_ck,
1243
	.init		= &omap2_init_clksel_parent,
1244
	.clkdm_name	= "core_l4_clkdm",
1245 1246
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_MCBSP5_SHIFT,
1247 1248 1249 1250
	.clksel_reg	= OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
	.clksel_mask	= OMAP2_MCBSP5_CLKS_MASK,
	.clksel		= mcbsp_fck_clksel,
	.recalc		= &omap2_clksel_recalc,
1251 1252 1253
};

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

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

static struct clk mcspi2_ick = {
1274
	.name		= "mcspi2_ick",
1275
	.ops		= &clkops_omap2_iclk_dflt_wait,
1276
	.parent		= &l4_ck,
1277
	.clkdm_name	= "core_l4_clkdm",
1278 1279 1280
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_MCSPI2_SHIFT,
	.recalc		= &followparent_recalc,
1281 1282 1283
};

static struct clk mcspi2_fck = {
1284
	.name		= "mcspi2_fck",
1285
	.ops		= &clkops_omap2_dflt_wait,
1286
	.parent		= &func_48m_ck,
1287
	.clkdm_name	= "core_l4_clkdm",
1288 1289 1290
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_MCSPI2_SHIFT,
	.recalc		= &followparent_recalc,
1291 1292 1293
};

static struct clk mcspi3_ick = {
1294
	.name		= "mcspi3_ick",
1295
	.ops		= &clkops_omap2_iclk_dflt_wait,
1296
	.parent		= &l4_ck,
1297
	.clkdm_name	= "core_l4_clkdm",
1298 1299 1300
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_MCSPI3_SHIFT,
	.recalc		= &followparent_recalc,
1301 1302 1303
};

static struct clk mcspi3_fck = {
1304
	.name		= "mcspi3_fck",
1305
	.ops		= &clkops_omap2_dflt_wait,
1306
	.parent		= &func_48m_ck,
1307
	.clkdm_name	= "core_l4_clkdm",
1308 1309 1310
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_MCSPI3_SHIFT,
	.recalc		= &followparent_recalc,
1311 1312 1313 1314
};

static struct clk uart1_ick = {
	.name		= "uart1_ick",
1315
	.ops		= &clkops_omap2_iclk_dflt_wait,
1316
	.parent		= &l4_ck,
1317
	.clkdm_name	= "core_l4_clkdm",
1318 1319 1320
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_UART1_SHIFT,
	.recalc		= &followparent_recalc,
1321 1322 1323 1324
};

static struct clk uart1_fck = {
	.name		= "uart1_fck",
1325
	.ops		= &clkops_omap2_dflt_wait,
1326
	.parent		= &func_48m_ck,
1327
	.clkdm_name	= "core_l4_clkdm",
1328 1329 1330
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_UART1_SHIFT,
	.recalc		= &followparent_recalc,
1331 1332 1333 1334
};

static struct clk uart2_ick = {
	.name		= "uart2_ick",
1335
	.ops		= &clkops_omap2_iclk_dflt_wait,
1336
	.parent		= &l4_ck,
1337
	.clkdm_name	= "core_l4_clkdm",
1338 1339 1340
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_UART2_SHIFT,
	.recalc		= &followparent_recalc,
1341 1342 1343 1344
};

static struct clk uart2_fck = {
	.name		= "uart2_fck",
1345
	.ops		= &clkops_omap2_dflt_wait,
1346
	.parent		= &func_48m_ck,
1347
	.clkdm_name	= "core_l4_clkdm",
1348 1349 1350
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_UART2_SHIFT,
	.recalc		= &followparent_recalc,
1351 1352 1353 1354
};

static struct clk uart3_ick = {
	.name		= "uart3_ick",
1355
	.ops		= &clkops_omap2_iclk_dflt_wait,
1356
	.parent		= &l4_ck,
1357
	.clkdm_name	= "core_l4_clkdm",
1358 1359 1360
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP24XX_EN_UART3_SHIFT,
	.recalc		= &followparent_recalc,
1361 1362 1363 1364
};

static struct clk uart3_fck = {
	.name		= "uart3_fck",
1365
	.ops		= &clkops_omap2_dflt_wait,
1366
	.parent		= &func_48m_ck,
1367
	.clkdm_name	= "core_l4_clkdm",
1368 1369 1370
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP24XX_EN_UART3_SHIFT,
	.recalc		= &followparent_recalc,
1371 1372 1373 1374
};

static struct clk gpios_ick = {
	.name		= "gpios_ick",
1375
	.ops		= &clkops_omap2_iclk_dflt_wait,
1376 1377
	.parent		= &wu_l4_ick,
	.clkdm_name	= "wkup_clkdm",
1378 1379 1380
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_GPIOS_SHIFT,
	.recalc		= &followparent_recalc,
1381 1382 1383 1384
};

static struct clk gpios_fck = {
	.name		= "gpios_fck",
1385
	.ops		= &clkops_omap2_dflt_wait,
1386
	.parent		= &func_32k_ck,
1387
	.clkdm_name	= "wkup_clkdm",
1388 1389 1390
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
	.enable_bit	= OMAP24XX_EN_GPIOS_SHIFT,
	.recalc		= &followparent_recalc,
1391 1392 1393 1394
};

static struct clk mpu_wdt_ick = {
	.name		= "mpu_wdt_ick",
1395
	.ops		= &clkops_omap2_iclk_dflt_wait,
1396 1397
	.parent		= &wu_l4_ick,
	.clkdm_name	= "wkup_clkdm",
1398 1399 1400
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_MPU_WDT_SHIFT,
	.recalc		= &followparent_recalc,
1401 1402 1403 1404
};

static struct clk mpu_wdt_fck = {
	.name		= "mpu_wdt_fck",
1405
	.ops		= &clkops_omap2_dflt_wait,
1406
	.parent		= &func_32k_ck,
1407
	.clkdm_name	= "wkup_clkdm",
1408 1409 1410
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
	.enable_bit	= OMAP24XX_EN_MPU_WDT_SHIFT,
	.recalc		= &followparent_recalc,
1411 1412 1413 1414
};

static struct clk sync_32k_ick = {
	.name		= "sync_32k_ick",
1415
	.ops		= &clkops_omap2_iclk_dflt_wait,
1416
	.flags		= ENABLE_ON_INIT,
1417 1418
	.parent		= &wu_l4_ick,
	.clkdm_name	= "wkup_clkdm",
1419 1420 1421
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_32KSYNC_SHIFT,
	.recalc		= &followparent_recalc,
1422
};
1423

1424 1425
static struct clk wdt1_ick = {
	.name		= "wdt1_ick",
1426
	.ops		= &clkops_omap2_iclk_dflt_wait,
1427 1428
	.parent		= &wu_l4_ick,
	.clkdm_name	= "wkup_clkdm",
1429 1430 1431
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_WDT1_SHIFT,
	.recalc		= &followparent_recalc,
1432
};
1433

1434 1435
static struct clk omapctrl_ick = {
	.name		= "omapctrl_ick",
1436
	.ops		= &clkops_omap2_iclk_dflt_wait,
1437
	.flags		= ENABLE_ON_INIT,
1438 1439
	.parent		= &wu_l4_ick,
	.clkdm_name	= "wkup_clkdm",
1440 1441 1442
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP24XX_EN_OMAPCTRL_SHIFT,
	.recalc		= &followparent_recalc,
1443
};
1444

1445 1446
static struct clk icr_ick = {
	.name		= "icr_ick",
1447
	.ops		= &clkops_omap2_iclk_dflt_wait,
1448 1449
	.parent		= &wu_l4_ick,
	.clkdm_name	= "wkup_clkdm",
1450 1451 1452
	.enable_reg	= OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
	.enable_bit	= OMAP2430_EN_ICR_SHIFT,
	.recalc		= &followparent_recalc,
1453 1454 1455 1456
};

static struct clk cam_ick = {
	.name		= "cam_ick",
1457
	.ops		= &clkops_omap2_iclk_dflt,
1458
	.parent		= &l4_ck,
1459
	.clkdm_name	= "core_l4_clkdm",
1460 1461 1462
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_CAM_SHIFT,
	.recalc		= &followparent_recalc,
1463 1464
};

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

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

static struct clk wdt4_ick = {
	.name		= "wdt4_ick",
1492
	.ops		= &clkops_omap2_iclk_dflt_wait,
1493
	.parent		= &l4_ck,
1494
	.clkdm_name	= "core_l4_clkdm",
1495 1496 1497
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_WDT4_SHIFT,
	.recalc		= &followparent_recalc,
1498 1499 1500 1501
};

static struct clk wdt4_fck = {
	.name		= "wdt4_fck",
1502
	.ops		= &clkops_omap2_dflt_wait,
1503
	.parent		= &func_32k_ck,
1504
	.clkdm_name	= "core_l4_clkdm",
1505 1506 1507
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_WDT4_SHIFT,
	.recalc		= &followparent_recalc,
1508 1509 1510 1511
};

static struct clk mspro_ick = {
	.name		= "mspro_ick",
1512
	.ops		= &clkops_omap2_iclk_dflt_wait,
1513
	.parent		= &l4_ck,
1514
	.clkdm_name	= "core_l4_clkdm",
1515 1516 1517
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_MSPRO_SHIFT,
	.recalc		= &followparent_recalc,
1518 1519 1520 1521
};

static struct clk mspro_fck = {
	.name		= "mspro_fck",
1522
	.ops		= &clkops_omap2_dflt_wait,
1523
	.parent		= &func_96m_ck,
1524
	.clkdm_name	= "core_l4_clkdm",
1525 1526 1527
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_MSPRO_SHIFT,
	.recalc		= &followparent_recalc,
1528 1529 1530 1531
};

static struct clk fac_ick = {
	.name		= "fac_ick",
1532
	.ops		= &clkops_omap2_iclk_dflt_wait,
1533
	.parent		= &l4_ck,
1534
	.clkdm_name	= "core_l4_clkdm",
1535 1536 1537
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_FAC_SHIFT,
	.recalc		= &followparent_recalc,
1538 1539 1540 1541
};

static struct clk fac_fck = {
	.name		= "fac_fck",
1542
	.ops		= &clkops_omap2_dflt_wait,
1543
	.parent		= &func_12m_ck,
1544
	.clkdm_name	= "core_l4_clkdm",
1545 1546 1547
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_FAC_SHIFT,
	.recalc		= &followparent_recalc,
1548 1549 1550 1551
};

static struct clk hdq_ick = {
	.name		= "hdq_ick",
1552
	.ops		= &clkops_omap2_iclk_dflt_wait,
1553
	.parent		= &l4_ck,
1554
	.clkdm_name	= "core_l4_clkdm",
1555 1556 1557
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
	.enable_bit	= OMAP24XX_EN_HDQ_SHIFT,
	.recalc		= &followparent_recalc,
1558 1559 1560 1561
};

static struct clk hdq_fck = {
	.name		= "hdq_fck",
1562
	.ops		= &clkops_omap2_dflt_wait,
1563
	.parent		= &func_12m_ck,
1564
	.clkdm_name	= "core_l4_clkdm",
1565 1566 1567
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
	.enable_bit	= OMAP24XX_EN_HDQ_SHIFT,
	.recalc		= &followparent_recalc,
1568 1569
};

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

static struct clk i2chs2_fck = {
1585
	.name		= "i2chs2_fck",
1586
	.ops		= &clkops_omap2430_i2chs_wait,
1587
	.parent		= &func_96m_ck,
1588
	.clkdm_name	= "core_l4_clkdm",
1589 1590 1591
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_I2CHS2_SHIFT,
	.recalc		= &followparent_recalc,
1592 1593
};

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

static struct clk i2chs1_fck = {
1609
	.name		= "i2chs1_fck",
1610
	.ops		= &clkops_omap2430_i2chs_wait,
1611
	.parent		= &func_96m_ck,
1612
	.clkdm_name	= "core_l4_clkdm",
1613 1614 1615 1616 1617
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_I2CHS1_SHIFT,
	.recalc		= &followparent_recalc,
};

1618 1619 1620 1621
/*
 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
 * accesses derived from this data.
 */
1622 1623
static struct clk gpmc_fck = {
	.name		= "gpmc_fck",
1624
	.ops		= &clkops_omap2_iclk_idle_only,
1625
	.parent		= &core_l3_ck,
1626
	.flags		= ENABLE_ON_INIT,
1627
	.clkdm_name	= "core_l3_clkdm",
1628 1629
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
	.enable_bit	= OMAP24XX_AUTO_GPMC_SHIFT,
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
	.recalc		= &followparent_recalc,
};

1641 1642 1643 1644
/*
 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
 * accesses derived from this data.
 */
1645 1646
static struct clk sdma_ick = {
	.name		= "sdma_ick",
1647
	.ops		= &clkops_omap2_iclk_idle_only,
1648
	.parent		= &core_l3_ck,
1649
	.clkdm_name	= "core_l3_clkdm",
1650 1651
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
	.enable_bit	= OMAP24XX_AUTO_SDMA_SHIFT,
1652
	.recalc		= &followparent_recalc,
1653 1654 1655 1656
};

static struct clk sdrc_ick = {
	.name		= "sdrc_ick",
1657
	.ops		= &clkops_omap2_iclk_idle_only,
1658
	.parent		= &core_l3_ck,
1659
	.flags		= ENABLE_ON_INIT,
1660
	.clkdm_name	= "core_l3_clkdm",
1661 1662 1663
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
	.enable_bit	= OMAP2430_EN_SDRC_SHIFT,
	.recalc		= &followparent_recalc,
1664 1665 1666 1667
};

static struct clk des_ick = {
	.name		= "des_ick",
1668
	.ops		= &clkops_omap2_iclk_dflt_wait,
1669
	.parent		= &l4_ck,
1670
	.clkdm_name	= "core_l4_clkdm",
1671 1672 1673
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
	.enable_bit	= OMAP24XX_EN_DES_SHIFT,
	.recalc		= &followparent_recalc,
1674 1675 1676 1677
};

static struct clk sha_ick = {
	.name		= "sha_ick",
1678
	.ops		= &clkops_omap2_iclk_dflt_wait,
1679
	.parent		= &l4_ck,
1680
	.clkdm_name	= "core_l4_clkdm",
1681 1682 1683
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
	.enable_bit	= OMAP24XX_EN_SHA_SHIFT,
	.recalc		= &followparent_recalc,
1684 1685 1686 1687
};

static struct clk rng_ick = {
	.name		= "rng_ick",
1688
	.ops		= &clkops_omap2_iclk_dflt_wait,
1689
	.parent		= &l4_ck,
1690
	.clkdm_name	= "core_l4_clkdm",
1691 1692 1693
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
	.enable_bit	= OMAP24XX_EN_RNG_SHIFT,
	.recalc		= &followparent_recalc,
1694 1695 1696 1697
};

static struct clk aes_ick = {
	.name		= "aes_ick",
1698
	.ops		= &clkops_omap2_iclk_dflt_wait,
1699
	.parent		= &l4_ck,
1700
	.clkdm_name	= "core_l4_clkdm",
1701 1702 1703
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
	.enable_bit	= OMAP24XX_EN_AES_SHIFT,
	.recalc		= &followparent_recalc,
1704 1705 1706 1707
};

static struct clk pka_ick = {
	.name		= "pka_ick",
1708
	.ops		= &clkops_omap2_iclk_dflt_wait,
1709
	.parent		= &l4_ck,
1710
	.clkdm_name	= "core_l4_clkdm",
1711 1712 1713
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
	.enable_bit	= OMAP24XX_EN_PKA_SHIFT,
	.recalc		= &followparent_recalc,
1714 1715 1716 1717
};

static struct clk usb_fck = {
	.name		= "usb_fck",
1718
	.ops		= &clkops_omap2_dflt_wait,
1719
	.parent		= &func_48m_ck,
1720
	.clkdm_name	= "core_l3_clkdm",
1721 1722 1723
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP24XX_EN_USB_SHIFT,
	.recalc		= &followparent_recalc,
1724 1725 1726 1727
};

static struct clk usbhs_ick = {
	.name		= "usbhs_ick",
1728
	.ops		= &clkops_omap2_iclk_dflt_wait,
1729
	.parent		= &core_l3_ck,
1730
	.clkdm_name	= "core_l3_clkdm",
1731 1732 1733
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_USBHS_SHIFT,
	.recalc		= &followparent_recalc,
1734 1735 1736
};

static struct clk mmchs1_ick = {
1737
	.name		= "mmchs1_ick",
1738
	.ops		= &clkops_omap2_iclk_dflt_wait,
1739
	.parent		= &l4_ck,
1740
	.clkdm_name	= "core_l4_clkdm",
1741 1742 1743
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_MMCHS1_SHIFT,
	.recalc		= &followparent_recalc,
1744 1745 1746
};

static struct clk mmchs1_fck = {
1747
	.name		= "mmchs1_fck",
1748
	.ops		= &clkops_omap2_dflt_wait,
1749
	.parent		= &func_96m_ck,
1750
	.clkdm_name	= "core_l4_clkdm",
1751 1752 1753
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_MMCHS1_SHIFT,
	.recalc		= &followparent_recalc,
1754 1755 1756
};

static struct clk mmchs2_ick = {
1757
	.name		= "mmchs2_ick",
1758
	.ops		= &clkops_omap2_iclk_dflt_wait,
1759
	.parent		= &l4_ck,
1760
	.clkdm_name	= "core_l4_clkdm",
1761 1762 1763
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_MMCHS2_SHIFT,
	.recalc		= &followparent_recalc,
1764 1765 1766
};

static struct clk mmchs2_fck = {
1767
	.name		= "mmchs2_fck",
1768
	.ops		= &clkops_omap2_dflt_wait,
1769
	.parent		= &func_96m_ck,
1770
	.clkdm_name	= "core_l4_clkdm",
1771 1772 1773
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_MMCHS2_SHIFT,
	.recalc		= &followparent_recalc,
1774 1775 1776 1777
};

static struct clk gpio5_ick = {
	.name		= "gpio5_ick",
1778
	.ops		= &clkops_omap2_iclk_dflt_wait,
1779
	.parent		= &l4_ck,
1780
	.clkdm_name	= "core_l4_clkdm",
1781 1782 1783
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_GPIO5_SHIFT,
	.recalc		= &followparent_recalc,
1784 1785 1786 1787
};

static struct clk gpio5_fck = {
	.name		= "gpio5_fck",
1788
	.ops		= &clkops_omap2_dflt_wait,
1789
	.parent		= &func_32k_ck,
1790
	.clkdm_name	= "core_l4_clkdm",
1791 1792 1793
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_GPIO5_SHIFT,
	.recalc		= &followparent_recalc,
1794 1795 1796 1797
};

static struct clk mdm_intc_ick = {
	.name		= "mdm_intc_ick",
1798
	.ops		= &clkops_omap2_iclk_dflt_wait,
1799
	.parent		= &l4_ck,
1800
	.clkdm_name	= "core_l4_clkdm",
1801 1802 1803
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
	.enable_bit	= OMAP2430_EN_MDM_INTC_SHIFT,
	.recalc		= &followparent_recalc,
1804 1805 1806
};

static struct clk mmchsdb1_fck = {
1807
	.name		= "mmchsdb1_fck",
1808
	.ops		= &clkops_omap2_dflt_wait,
1809
	.parent		= &func_32k_ck,
1810
	.clkdm_name	= "core_l4_clkdm",
1811 1812 1813
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_MMCHSDB1_SHIFT,
	.recalc		= &followparent_recalc,
1814 1815 1816
};

static struct clk mmchsdb2_fck = {
1817
	.name		= "mmchsdb2_fck",
1818
	.ops		= &clkops_omap2_dflt_wait,
1819
	.parent		= &func_32k_ck,
1820
	.clkdm_name	= "core_l4_clkdm",
1821 1822 1823
	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
	.enable_bit	= OMAP2430_EN_MMCHSDB2_SHIFT,
	.recalc		= &followparent_recalc,
1824
};
1825

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

1849 1850 1851 1852 1853

/*
 * clkdev integration
 */

1854
static struct omap_clk omap2430_clks[] = {
1855
	/* external root sources */
1856 1857 1858 1859 1860
	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),
1861 1862 1863 1864 1865 1866
	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),
1867
	/* internal analog sources */
1868 1869 1870
	CLK(NULL,	"dpll_ck",	&dpll_ck,	CK_243X),
	CLK(NULL,	"apll96_ck",	&apll96_ck,	CK_243X),
	CLK(NULL,	"apll54_ck",	&apll54_ck,	CK_243X),
1871
	/* internal prcm root sources */
1872 1873
	CLK(NULL,	"func_54m_ck",	&func_54m_ck,	CK_243X),
	CLK(NULL,	"core_ck",	&core_ck,	CK_243X),
1874 1875 1876 1877 1878
	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),
1879 1880 1881 1882 1883 1884 1885
	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),
1886
	/* mpu domain clocks */
1887
	CLK(NULL,	"mpu_ck",	&mpu_ck,	CK_243X),
1888
	/* dsp domain clocks */
1889
	CLK(NULL,	"dsp_fck",	&dsp_fck,	CK_243X),
1890 1891
	CLK(NULL,	"iva2_1_ick",	&iva2_1_ick,	CK_243X),
	/* GFX domain clocks */
1892 1893 1894
	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),
1895 1896 1897 1898
	/* Modem domain clocks */
	CLK(NULL,	"mdm_ick",	&mdm_ick,	CK_243X),
	CLK(NULL,	"mdm_osc_ck",	&mdm_osc_ck,	CK_243X),
	/* DSS domain clocks */
1899
	CLK("omapdss_dss",	"ick",		&dss_ick,	CK_243X),
1900 1901 1902
	CLK(NULL,	"dss1_fck",		&dss1_fck,	CK_243X),
	CLK(NULL,	"dss2_fck",	&dss2_fck,	CK_243X),
	CLK(NULL,	"dss_54m_fck",	&dss_54m_fck,	CK_243X),
1903
	/* L3 domain clocks */
1904 1905 1906
	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),
1907
	/* L4 domain clocks */
1908 1909
	CLK(NULL,	"l4_ck",	&l4_ck,		CK_243X),
	CLK(NULL,	"ssi_l4_ick",	&ssi_l4_ick,	CK_243X),
1910
	CLK(NULL,	"wu_l4_ick",	&wu_l4_ick,	CK_243X),
1911
	/* virtual meta-group clock */
1912
	CLK(NULL,	"virt_prcm_set", &virt_prcm_set, CK_243X),
1913
	/* general l4 interface ck, multi-parent functional clk */
1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938
	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),
1939
	CLK(NULL,	"mcbsp1_fck",	&mcbsp1_fck,	CK_243X),
1940
	CLK("omap-mcbsp.2", "ick",	&mcbsp2_ick,	CK_243X),
1941
	CLK(NULL,	"mcbsp2_fck",	&mcbsp2_fck,	CK_243X),
1942
	CLK("omap-mcbsp.3", "ick",	&mcbsp3_ick,	CK_243X),
1943
	CLK(NULL,	"mcbsp3_fck",	&mcbsp3_fck,	CK_243X),
1944
	CLK("omap-mcbsp.4", "ick",	&mcbsp4_ick,	CK_243X),
1945
	CLK(NULL,	"mcbsp4_fck",	&mcbsp4_fck,	CK_243X),
1946
	CLK("omap-mcbsp.5", "ick",	&mcbsp5_ick,	CK_243X),
1947
	CLK(NULL,	"mcbsp5_fck",	&mcbsp5_fck,	CK_243X),
1948
	CLK("omap2_mcspi.1", "ick",	&mcspi1_ick,	CK_243X),
1949
	CLK(NULL,	"mcspi1_fck",	&mcspi1_fck,	CK_243X),
1950
	CLK("omap2_mcspi.2", "ick",	&mcspi2_ick,	CK_243X),
1951
	CLK(NULL,	"mcspi2_fck",	&mcspi2_fck,	CK_243X),
1952
	CLK("omap2_mcspi.3", "ick",	&mcspi3_ick,	CK_243X),
1953
	CLK(NULL,	"mcspi3_fck",	&mcspi3_fck,	CK_243X),
1954 1955 1956 1957 1958 1959 1960 1961 1962
	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),
1963
	CLK(NULL,	"mpu_wdt_fck",	&mpu_wdt_fck,	CK_243X),
1964 1965 1966
	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),
1967
	CLK(NULL,	"icr_ick",	&icr_ick,	CK_243X),
1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978
	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),
1979
	CLK("omap_i2c.1", "ick",	&i2c1_ick,	CK_243X),
1980
	CLK(NULL,	"i2chs1_fck",	&i2chs1_fck,	CK_243X),
1981
	CLK("omap_i2c.2", "ick",	&i2c2_ick,	CK_243X),
1982
	CLK(NULL,	"i2chs2_fck",	&i2chs2_fck,	CK_243X),
1983 1984 1985
	CLK(NULL,	"gpmc_fck",	&gpmc_fck,	CK_243X),
	CLK(NULL,	"sdma_fck",	&sdma_fck,	CK_243X),
	CLK(NULL,	"sdma_ick",	&sdma_ick,	CK_243X),
1986
	CLK(NULL,	"sdrc_ick",	&sdrc_ick,	CK_243X),
1987
	CLK(NULL,	"des_ick",	&des_ick,	CK_243X),
1988
	CLK("omap-sham",	"ick",	&sha_ick,	CK_243X),
1989
	CLK("omap_rng",	"ick",		&rng_ick,	CK_243X),
1990
	CLK("omap-aes",	"ick",	&aes_ick,	CK_243X),
1991 1992
	CLK(NULL,	"pka_ick",	&pka_ick,	CK_243X),
	CLK(NULL,	"usb_fck",	&usb_fck,	CK_243X),
1993
	CLK("musb-omap2430",	"ick",	&usbhs_ick,	CK_243X),
1994
	CLK("omap_hsmmc.0", "ick",	&mmchs1_ick,	CK_243X),
1995
	CLK(NULL,	"mmchs1_fck",	&mmchs1_fck,	CK_243X),
1996
	CLK("omap_hsmmc.1", "ick",	&mmchs2_ick,	CK_243X),
1997
	CLK(NULL,	"mmchs2_fck",	&mmchs2_fck,	CK_243X),
1998 1999 2000
	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),
2001 2002
	CLK("omap_hsmmc.0", "mmchsdb_fck",	&mmchsdb1_fck,	CK_243X),
	CLK("omap_hsmmc.1", "mmchsdb_fck",	&mmchsdb2_fck,	CK_243X),
2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038
	CLK("omap_timer.1",	"32k_ck",  &func_32k_ck,   CK_243X),
	CLK("omap_timer.2",	"32k_ck",  &func_32k_ck,   CK_243X),
	CLK("omap_timer.3",	"32k_ck",  &func_32k_ck,   CK_243X),
	CLK("omap_timer.4",	"32k_ck",  &func_32k_ck,   CK_243X),
	CLK("omap_timer.5",	"32k_ck",  &func_32k_ck,   CK_243X),
	CLK("omap_timer.6",	"32k_ck",  &func_32k_ck,   CK_243X),
	CLK("omap_timer.7",	"32k_ck",  &func_32k_ck,   CK_243X),
	CLK("omap_timer.8",	"32k_ck",  &func_32k_ck,   CK_243X),
	CLK("omap_timer.9",	"32k_ck",  &func_32k_ck,   CK_243X),
	CLK("omap_timer.10",	"32k_ck",  &func_32k_ck,   CK_243X),
	CLK("omap_timer.11",	"32k_ck",  &func_32k_ck,   CK_243X),
	CLK("omap_timer.12",	"32k_ck",  &func_32k_ck,   CK_243X),
	CLK("omap_timer.1",	"sys_ck",	&sys_ck,	CK_243X),
	CLK("omap_timer.2",	"sys_ck",	&sys_ck,	CK_243X),
	CLK("omap_timer.3",	"sys_ck",	&sys_ck,	CK_243X),
	CLK("omap_timer.4",	"sys_ck",	&sys_ck,	CK_243X),
	CLK("omap_timer.5",	"sys_ck",	&sys_ck,	CK_243X),
	CLK("omap_timer.6",	"sys_ck",	&sys_ck,	CK_243X),
	CLK("omap_timer.7",	"sys_ck",	&sys_ck,	CK_243X),
	CLK("omap_timer.8",	"sys_ck",	&sys_ck,	CK_243X),
	CLK("omap_timer.9",	"sys_ck",	&sys_ck,	CK_243X),
	CLK("omap_timer.10",	"sys_ck",	&sys_ck,	CK_243X),
	CLK("omap_timer.11",	"sys_ck",	&sys_ck,	CK_243X),
	CLK("omap_timer.12",	"sys_ck",	&sys_ck,	CK_243X),
	CLK("omap_timer.1",	"alt_ck",	&alt_ck,	CK_243X),
	CLK("omap_timer.2",	"alt_ck",	&alt_ck,	CK_243X),
	CLK("omap_timer.3",	"alt_ck",	&alt_ck,	CK_243X),
	CLK("omap_timer.4",	"alt_ck",	&alt_ck,	CK_243X),
	CLK("omap_timer.5",	"alt_ck",	&alt_ck,	CK_243X),
	CLK("omap_timer.6",	"alt_ck",	&alt_ck,	CK_243X),
	CLK("omap_timer.7",	"alt_ck",	&alt_ck,	CK_243X),
	CLK("omap_timer.8",	"alt_ck",	&alt_ck,	CK_243X),
	CLK("omap_timer.9",	"alt_ck",	&alt_ck,	CK_243X),
	CLK("omap_timer.10",	"alt_ck",	&alt_ck,	CK_243X),
	CLK("omap_timer.11",	"alt_ck",	&alt_ck,	CK_243X),
	CLK("omap_timer.12",	"alt_ck",	&alt_ck,	CK_243X),
2039 2040 2041 2042 2043 2044
};

/*
 * init code
 */

2045
int __init omap2430_clk_init(void)
2046 2047 2048 2049
{
	const struct prcm_config *prcm;
	struct omap_clk *c;
	u32 clkrate;
2050 2051 2052 2053 2054

	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;
2055 2056 2057

	clk_init(&omap2_clk_functions);

2058 2059
	for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks);
	     c++)
2060 2061 2062 2063
		clk_preinit(c->lk.clk);

	osc_ck.rate = omap2_osc_clk_recalc(&osc_ck);
	propagate_rate(&osc_ck);
2064
	sys_ck.rate = omap2xxx_sys_clk_recalc(&sys_ck);
2065 2066
	propagate_rate(&sys_ck);

2067 2068 2069 2070 2071 2072
	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);
	}
2073

2074 2075 2076
	/* Disable autoidle on all clocks; let the PM code enable it later */
	omap_clk_disable_autoidle_all();

2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090
	/* 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();

2091 2092 2093
	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)) ;
2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107

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