clockdomains.h 12.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
/*
 * OMAP2/3 clockdomains
 *
 * Copyright (C) 2008 Texas Instruments, Inc.
 * Copyright (C) 2008 Nokia Corporation
 *
 * Written by Paul Walmsley
 */

#ifndef __ARCH_ARM_MACH_OMAP2_CLOCKDOMAINS_H
#define __ARCH_ARM_MACH_OMAP2_CLOCKDOMAINS_H

13
#include <plat/clockdomain.h>
14 15
#include "cm.h"
#include "prm44xx.h"
16 17 18

/*
 * OMAP2/3-common clockdomains
19 20 21 22 23
 *
 * Even though the 2420 has a single PRCM module from the
 * interconnect's perspective, internally it does appear to have
 * separate PRM and CM clockdomains.  The usual test case is
 * sys_clkout/sys_clkout2.
24 25 26 27 28
 */

/* This is an implicit clockdomain - it is never defined as such in TRM */
static struct clockdomain wkup_clkdm = {
	.name		= "wkup_clkdm",
29
	.pwrdm		= { .name = "wkup_pwrdm" },
30 31 32
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP24XX | CHIP_IS_OMAP3430),
};

33 34 35 36 37 38 39 40 41 42 43 44
static struct clockdomain prm_clkdm = {
	.name		= "prm_clkdm",
	.pwrdm		= { .name = "wkup_pwrdm" },
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP24XX | CHIP_IS_OMAP3430),
};

static struct clockdomain cm_clkdm = {
	.name		= "cm_clkdm",
	.pwrdm		= { .name = "core_pwrdm" },
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP24XX | CHIP_IS_OMAP3430),
};

45 46 47 48 49 50 51 52
/*
 * 2420-only clockdomains
 */

#if defined(CONFIG_ARCH_OMAP2420)

static struct clockdomain mpu_2420_clkdm = {
	.name		= "mpu_clkdm",
53
	.pwrdm		= { .name = "mpu_pwrdm" },
54
	.flags		= CLKDM_CAN_HWSUP,
55
	.clkstctrl_reg  = OMAP2420_CM_REGADDR(MPU_MOD, OMAP2_CM_CLKSTCTRL),
56 57 58 59 60 61
	.clktrctrl_mask = OMAP24XX_AUTOSTATE_MPU_MASK,
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
};

static struct clockdomain iva1_2420_clkdm = {
	.name		= "iva1_clkdm",
62
	.pwrdm		= { .name = "dsp_pwrdm" },
63
	.flags		= CLKDM_CAN_HWSUP_SWSUP,
64 65
	.clkstctrl_reg  = OMAP2420_CM_REGADDR(OMAP24XX_DSP_MOD,
						 OMAP2_CM_CLKSTCTRL),
66 67 68 69
	.clktrctrl_mask = OMAP2420_AUTOSTATE_IVA_MASK,
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
};

70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
static struct clockdomain dsp_2420_clkdm = {
	.name		= "dsp_clkdm",
	.pwrdm		= { .name = "dsp_pwrdm" },
	.flags		= CLKDM_CAN_HWSUP_SWSUP,
	.clkstctrl_reg  = OMAP2420_CM_REGADDR(OMAP24XX_DSP_MOD,
						 OMAP2_CM_CLKSTCTRL),
	.clktrctrl_mask = OMAP24XX_AUTOSTATE_DSP_MASK,
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
};

static struct clockdomain gfx_2420_clkdm = {
	.name		= "gfx_clkdm",
	.pwrdm		= { .name = "gfx_pwrdm" },
	.flags		= CLKDM_CAN_HWSUP_SWSUP,
	.clkstctrl_reg  = OMAP2420_CM_REGADDR(GFX_MOD, OMAP2_CM_CLKSTCTRL),
	.clktrctrl_mask = OMAP24XX_AUTOSTATE_GFX_MASK,
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
};

static struct clockdomain core_l3_2420_clkdm = {
	.name		= "core_l3_clkdm",
	.pwrdm		= { .name = "core_pwrdm" },
	.flags		= CLKDM_CAN_HWSUP,
	.clkstctrl_reg  = OMAP2420_CM_REGADDR(CORE_MOD, OMAP2_CM_CLKSTCTRL),
	.clktrctrl_mask = OMAP24XX_AUTOSTATE_L3_MASK,
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
};

static struct clockdomain core_l4_2420_clkdm = {
	.name		= "core_l4_clkdm",
	.pwrdm		= { .name = "core_pwrdm" },
	.flags		= CLKDM_CAN_HWSUP,
	.clkstctrl_reg  = OMAP2420_CM_REGADDR(CORE_MOD, OMAP2_CM_CLKSTCTRL),
	.clktrctrl_mask = OMAP24XX_AUTOSTATE_L4_MASK,
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
};

static struct clockdomain dss_2420_clkdm = {
	.name		= "dss_clkdm",
	.pwrdm		= { .name = "core_pwrdm" },
	.flags		= CLKDM_CAN_HWSUP,
	.clkstctrl_reg  = OMAP2420_CM_REGADDR(CORE_MOD, OMAP2_CM_CLKSTCTRL),
	.clktrctrl_mask = OMAP24XX_AUTOSTATE_DSS_MASK,
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2420),
};

#endif   /* CONFIG_ARCH_OMAP2420 */
117 118 119 120 121 122 123 124 125 126


/*
 * 2430-only clockdomains
 */

#if defined(CONFIG_ARCH_OMAP2430)

static struct clockdomain mpu_2430_clkdm = {
	.name		= "mpu_clkdm",
127
	.pwrdm		= { .name = "mpu_pwrdm" },
128
	.flags		= CLKDM_CAN_HWSUP_SWSUP,
129 130
	.clkstctrl_reg  = OMAP2430_CM_REGADDR(MPU_MOD,
						 OMAP2_CM_CLKSTCTRL),
131 132 133 134 135 136
	.clktrctrl_mask = OMAP24XX_AUTOSTATE_MPU_MASK,
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
};

static struct clockdomain mdm_clkdm = {
	.name		= "mdm_clkdm",
137
	.pwrdm		= { .name = "mdm_pwrdm" },
138
	.flags		= CLKDM_CAN_HWSUP_SWSUP,
139 140
	.clkstctrl_reg  = OMAP2430_CM_REGADDR(OMAP2430_MDM_MOD,
						 OMAP2_CM_CLKSTCTRL),
141 142 143 144
	.clktrctrl_mask = OMAP2430_AUTOSTATE_MDM_MASK,
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
};

145
static struct clockdomain dsp_2430_clkdm = {
146
	.name		= "dsp_clkdm",
147
	.pwrdm		= { .name = "dsp_pwrdm" },
148
	.flags		= CLKDM_CAN_HWSUP_SWSUP,
149 150
	.clkstctrl_reg  = OMAP2430_CM_REGADDR(OMAP24XX_DSP_MOD,
						 OMAP2_CM_CLKSTCTRL),
151
	.clktrctrl_mask = OMAP24XX_AUTOSTATE_DSP_MASK,
152
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
153 154
};

155
static struct clockdomain gfx_2430_clkdm = {
156
	.name		= "gfx_clkdm",
157
	.pwrdm		= { .name = "gfx_pwrdm" },
158
	.flags		= CLKDM_CAN_HWSUP_SWSUP,
159
	.clkstctrl_reg  = OMAP2430_CM_REGADDR(GFX_MOD, OMAP2_CM_CLKSTCTRL),
160
	.clktrctrl_mask = OMAP24XX_AUTOSTATE_GFX_MASK,
161
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
162 163
};

164
static struct clockdomain core_l3_2430_clkdm = {
165
	.name		= "core_l3_clkdm",
166
	.pwrdm		= { .name = "core_pwrdm" },
167
	.flags		= CLKDM_CAN_HWSUP,
168
	.clkstctrl_reg  = OMAP2430_CM_REGADDR(CORE_MOD, OMAP2_CM_CLKSTCTRL),
169
	.clktrctrl_mask = OMAP24XX_AUTOSTATE_L3_MASK,
170
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
171 172
};

173
static struct clockdomain core_l4_2430_clkdm = {
174
	.name		= "core_l4_clkdm",
175
	.pwrdm		= { .name = "core_pwrdm" },
176
	.flags		= CLKDM_CAN_HWSUP,
177
	.clkstctrl_reg  = OMAP2430_CM_REGADDR(CORE_MOD, OMAP2_CM_CLKSTCTRL),
178
	.clktrctrl_mask = OMAP24XX_AUTOSTATE_L4_MASK,
179
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
180 181
};

182
static struct clockdomain dss_2430_clkdm = {
183
	.name		= "dss_clkdm",
184
	.pwrdm		= { .name = "core_pwrdm" },
185
	.flags		= CLKDM_CAN_HWSUP,
186
	.clkstctrl_reg  = OMAP2430_CM_REGADDR(CORE_MOD, OMAP2_CM_CLKSTCTRL),
187
	.clktrctrl_mask = OMAP24XX_AUTOSTATE_DSS_MASK,
188
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP2430),
189 190
};

191
#endif    /* CONFIG_ARCH_OMAP2430 */
192 193 194 195 196 197 198 199 200 201


/*
 * 34xx clockdomains
 */

#if defined(CONFIG_ARCH_OMAP34XX)

static struct clockdomain mpu_34xx_clkdm = {
	.name		= "mpu_clkdm",
202
	.pwrdm		= { .name = "mpu_pwrdm" },
203
	.flags		= CLKDM_CAN_HWSUP | CLKDM_CAN_FORCE_WAKEUP,
204
	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(MPU_MOD, OMAP2_CM_CLKSTCTRL),
205 206 207 208 209 210
	.clktrctrl_mask = OMAP3430_CLKTRCTRL_MPU_MASK,
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
};

static struct clockdomain neon_clkdm = {
	.name		= "neon_clkdm",
211
	.pwrdm		= { .name = "neon_pwrdm" },
212
	.flags		= CLKDM_CAN_HWSUP_SWSUP,
213 214
	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(OMAP3430_NEON_MOD,
						 OMAP2_CM_CLKSTCTRL),
215 216 217 218 219 220
	.clktrctrl_mask = OMAP3430_CLKTRCTRL_NEON_MASK,
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
};

static struct clockdomain iva2_clkdm = {
	.name		= "iva2_clkdm",
221
	.pwrdm		= { .name = "iva2_pwrdm" },
222
	.flags		= CLKDM_CAN_HWSUP_SWSUP,
223 224
	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(OMAP3430_IVA2_MOD,
						 OMAP2_CM_CLKSTCTRL),
225 226 227 228 229 230
	.clktrctrl_mask = OMAP3430_CLKTRCTRL_IVA2_MASK,
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
};

static struct clockdomain gfx_3430es1_clkdm = {
	.name		= "gfx_clkdm",
231
	.pwrdm		= { .name = "gfx_pwrdm" },
232
	.flags		= CLKDM_CAN_HWSUP_SWSUP,
233
	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(GFX_MOD, OMAP2_CM_CLKSTCTRL),
234 235 236 237 238 239
	.clktrctrl_mask = OMAP3430ES1_CLKTRCTRL_GFX_MASK,
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430ES1),
};

static struct clockdomain sgx_clkdm = {
	.name		= "sgx_clkdm",
240
	.pwrdm		= { .name = "sgx_pwrdm" },
241
	.flags		= CLKDM_CAN_HWSUP_SWSUP,
242 243
	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(OMAP3430ES2_SGX_MOD,
						 OMAP2_CM_CLKSTCTRL),
244
	.clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_SGX_MASK,
245
	.omap_chip	= OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2),
246 247
};

248 249 250 251 252 253 254
/*
 * The die-to-die clockdomain was documented in the 34xx ES1 TRM, but
 * then that information was removed from the 34xx ES2+ TRM.  It is
 * unclear whether the core is still there, but the clockdomain logic
 * is there, and must be programmed to an appropriate state if the
 * CORE clockdomain is to become inactive.
 */
255 256
static struct clockdomain d2d_clkdm = {
	.name		= "d2d_clkdm",
257
	.pwrdm		= { .name = "core_pwrdm" },
258
	.flags		= CLKDM_CAN_HWSUP_SWSUP,
259
	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(CORE_MOD, OMAP2_CM_CLKSTCTRL),
260
	.clktrctrl_mask = OMAP3430ES1_CLKTRCTRL_D2D_MASK,
261
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
262 263 264 265
};

static struct clockdomain core_l3_34xx_clkdm = {
	.name		= "core_l3_clkdm",
266
	.pwrdm		= { .name = "core_pwrdm" },
267
	.flags		= CLKDM_CAN_HWSUP,
268
	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(CORE_MOD, OMAP2_CM_CLKSTCTRL),
269 270 271 272 273 274
	.clktrctrl_mask = OMAP3430_CLKTRCTRL_L3_MASK,
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
};

static struct clockdomain core_l4_34xx_clkdm = {
	.name		= "core_l4_clkdm",
275
	.pwrdm		= { .name = "core_pwrdm" },
276
	.flags		= CLKDM_CAN_HWSUP,
277
	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(CORE_MOD, OMAP2_CM_CLKSTCTRL),
278 279 280 281 282 283
	.clktrctrl_mask = OMAP3430_CLKTRCTRL_L4_MASK,
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
};

static struct clockdomain dss_34xx_clkdm = {
	.name		= "dss_clkdm",
284
	.pwrdm		= { .name = "dss_pwrdm" },
285
	.flags		= CLKDM_CAN_HWSUP_SWSUP,
286 287
	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(OMAP3430_DSS_MOD,
						 OMAP2_CM_CLKSTCTRL),
288 289 290 291 292 293
	.clktrctrl_mask = OMAP3430_CLKTRCTRL_DSS_MASK,
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
};

static struct clockdomain cam_clkdm = {
	.name		= "cam_clkdm",
294
	.pwrdm		= { .name = "cam_pwrdm" },
295
	.flags		= CLKDM_CAN_HWSUP_SWSUP,
296 297
	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(OMAP3430_CAM_MOD,
						 OMAP2_CM_CLKSTCTRL),
298 299 300 301 302 303
	.clktrctrl_mask = OMAP3430_CLKTRCTRL_CAM_MASK,
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
};

static struct clockdomain usbhost_clkdm = {
	.name		= "usbhost_clkdm",
304
	.pwrdm		= { .name = "usbhost_pwrdm" },
305
	.flags		= CLKDM_CAN_HWSUP_SWSUP,
306 307
	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(OMAP3430ES2_USBHOST_MOD,
						 OMAP2_CM_CLKSTCTRL),
308
	.clktrctrl_mask = OMAP3430ES2_CLKTRCTRL_USBHOST_MASK,
309
	.omap_chip	= OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2),
310 311 312 313
};

static struct clockdomain per_clkdm = {
	.name		= "per_clkdm",
314
	.pwrdm		= { .name = "per_pwrdm" },
315
	.flags		= CLKDM_CAN_HWSUP_SWSUP,
316 317
	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(OMAP3430_PER_MOD,
						 OMAP2_CM_CLKSTCTRL),
318 319 320 321
	.clktrctrl_mask = OMAP3430_CLKTRCTRL_PER_MASK,
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
};

322 323 324 325
/*
 * Disable hw supervised mode for emu_clkdm, because emu_pwrdm is
 * switched of even if sdti is in use
 */
326 327
static struct clockdomain emu_clkdm = {
	.name		= "emu_clkdm",
328
	.pwrdm		= { .name = "emu_pwrdm" },
329
	.flags		= /* CLKDM_CAN_ENABLE_AUTO |  */CLKDM_CAN_SWSUP,
330 331
	.clkstctrl_reg	= OMAP34XX_CM_REGADDR(OMAP3430_EMU_MOD,
						 OMAP2_CM_CLKSTCTRL),
332 333 334 335
	.clktrctrl_mask = OMAP3430_CLKTRCTRL_EMU_MASK,
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
};

336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362
static struct clockdomain dpll1_clkdm = {
	.name		= "dpll1_clkdm",
	.pwrdm		= { .name = "dpll1_pwrdm" },
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
};

static struct clockdomain dpll2_clkdm = {
	.name		= "dpll2_clkdm",
	.pwrdm		= { .name = "dpll2_pwrdm" },
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
};

static struct clockdomain dpll3_clkdm = {
	.name		= "dpll3_clkdm",
	.pwrdm		= { .name = "dpll3_pwrdm" },
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
};

static struct clockdomain dpll4_clkdm = {
	.name		= "dpll4_clkdm",
	.pwrdm		= { .name = "dpll4_pwrdm" },
	.omap_chip	= OMAP_CHIP_INIT(CHIP_IS_OMAP3430),
};

static struct clockdomain dpll5_clkdm = {
	.name		= "dpll5_clkdm",
	.pwrdm		= { .name = "dpll5_pwrdm" },
363
	.omap_chip	= OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES2),
364 365
};

366 367 368 369 370 371 372 373
#endif   /* CONFIG_ARCH_OMAP34XX */

/*
 * Clockdomain-powerdomain hwsup dependencies (34XX only)
 */

static struct clkdm_pwrdm_autodep clkdm_pwrdm_autodeps[] = {
	{
374
		.pwrdm	   = { .name = "mpu_pwrdm" },
375 376 377
		.omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
	},
	{
378
		.pwrdm	   = { .name = "iva2_pwrdm" },
379 380
		.omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430)
	},
381 382 383
	{
		.pwrdm	   = { .name = NULL },
	}
384 385 386 387 388 389 390 391 392
};

/*
 *
 */

static struct clockdomain *clockdomains_omap[] = {

	&wkup_clkdm,
393 394
	&cm_clkdm,
	&prm_clkdm,
395 396 397 398

#ifdef CONFIG_ARCH_OMAP2420
	&mpu_2420_clkdm,
	&iva1_2420_clkdm,
399 400 401 402 403
	&dsp_2420_clkdm,
	&gfx_2420_clkdm,
	&core_l3_2420_clkdm,
	&core_l4_2420_clkdm,
	&dss_2420_clkdm,
404 405 406 407 408
#endif

#ifdef CONFIG_ARCH_OMAP2430
	&mpu_2430_clkdm,
	&mdm_clkdm,
409 410 411 412 413
	&dsp_2430_clkdm,
	&gfx_2430_clkdm,
	&core_l3_2430_clkdm,
	&core_l4_2430_clkdm,
	&dss_2430_clkdm,
414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429
#endif

#ifdef CONFIG_ARCH_OMAP34XX
	&mpu_34xx_clkdm,
	&neon_clkdm,
	&iva2_clkdm,
	&gfx_3430es1_clkdm,
	&sgx_clkdm,
	&d2d_clkdm,
	&core_l3_34xx_clkdm,
	&core_l4_34xx_clkdm,
	&dss_34xx_clkdm,
	&cam_clkdm,
	&usbhost_clkdm,
	&per_clkdm,
	&emu_clkdm,
430 431 432 433 434
	&dpll1_clkdm,
	&dpll2_clkdm,
	&dpll3_clkdm,
	&dpll4_clkdm,
	&dpll5_clkdm,
435 436 437 438 439 440
#endif

	NULL,
};

#endif