blob: b7ea468eea326aa02537572139b9cc50da183b81 [file] [log] [blame]
Paul Walmsleyecb24aa2008-08-19 11:08:43 +03001/*
Paul Walmsley98fa3d82010-01-26 20:13:13 -07002 * OMAP3 powerdomain definitions
Paul Walmsleyecb24aa2008-08-19 11:08:43 +03003 *
Paul Walmsley81794882011-09-14 11:34:21 -06004 * Copyright (C) 2007-2008, 2011 Texas Instruments, Inc.
Paul Walmsley4cb49fe2011-03-07 19:28:15 -07005 * Copyright (C) 2007-2011 Nokia Corporation
Paul Walmsleyecb24aa2008-08-19 11:08:43 +03006 *
Paul Walmsley6e014782010-12-21 20:01:20 -07007 * Paul Walmsley, Jouni Högander
Paul Walmsleyecb24aa2008-08-19 11:08:43 +03008 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
Paul Walmsley6e014782010-12-21 20:01:20 -070014#include <linux/kernel.h>
15#include <linux/init.h>
Tony Lindgrend9a5f4d2012-03-07 17:28:01 -080016#include <linux/bug.h>
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030017
Paul Walmsley81794882011-09-14 11:34:21 -060018#include <plat/cpu.h>
19
Paul Walmsley72e06d02010-12-21 21:05:16 -070020#include "powerdomain.h"
Paul Walmsley6e014782010-12-21 20:01:20 -070021#include "powerdomains2xxx_3xxx_data.h"
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030022
23#include "prcm-common.h"
Paul Walmsley59fb6592010-12-21 15:30:55 -070024#include "prm2xxx_3xxx.h"
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030025#include "prm-regbits-34xx.h"
Paul Walmsley59fb6592010-12-21 15:30:55 -070026#include "cm2xxx_3xxx.h"
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030027#include "cm-regbits-34xx.h"
28
29/*
30 * 34XX-specific powerdomains, dependencies
31 */
32
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030033/*
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030034 * Powerdomains
35 */
36
37static struct powerdomain iva2_pwrdm = {
38 .name = "iva2_pwrdm",
39 .prcm_offs = OMAP3430_IVA2_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030040 .pwrsts = PWRSTS_OFF_RET_ON,
41 .pwrsts_logic_ret = PWRSTS_OFF_RET,
42 .banks = 4,
43 .pwrsts_mem_ret = {
44 [0] = PWRSTS_OFF_RET,
45 [1] = PWRSTS_OFF_RET,
46 [2] = PWRSTS_OFF_RET,
47 [3] = PWRSTS_OFF_RET,
48 },
49 .pwrsts_mem_on = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -070050 [0] = PWRSTS_ON,
51 [1] = PWRSTS_ON,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030052 [2] = PWRSTS_OFF_ON,
Paul Walmsley4cb49fe2011-03-07 19:28:15 -070053 [3] = PWRSTS_ON,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030054 },
Kevin Hilmanda03ce62011-03-18 14:12:18 -070055 .voltdm = { .name = "mpu_iva" },
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030056};
57
Paul Walmsley98fa3d82010-01-26 20:13:13 -070058static struct powerdomain mpu_3xxx_pwrdm = {
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030059 .name = "mpu_pwrdm",
60 .prcm_offs = MPU_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030061 .pwrsts = PWRSTS_OFF_RET_ON,
62 .pwrsts_logic_ret = PWRSTS_OFF_RET,
Thara Gopinath3863c742009-12-08 16:33:15 -070063 .flags = PWRDM_HAS_MPU_QUIRK,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030064 .banks = 1,
65 .pwrsts_mem_ret = {
66 [0] = PWRSTS_OFF_RET,
67 },
68 .pwrsts_mem_on = {
69 [0] = PWRSTS_OFF_ON,
70 },
Kevin Hilmanda03ce62011-03-18 14:12:18 -070071 .voltdm = { .name = "mpu_iva" },
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030072};
73
Anand Gadiyar58dcfb32010-07-14 13:38:49 +000074/*
75 * The USBTLL Save-and-Restore mechanism is broken on
Lucas De Marchi25985ed2011-03-30 22:57:33 -030076 * 3430s up to ES3.0 and 3630ES1.0. Hence this feature
Anand Gadiyar58dcfb32010-07-14 13:38:49 +000077 * needs to be disabled on these chips.
78 * Refer: 3430 errata ID i459 and 3630 errata ID i579
Jean Pihet447b8da2010-11-17 17:52:11 +000079 *
80 * Note: setting the SAR flag could help for errata ID i478
81 * which applies to 3430 <= ES3.1, but since the SAR feature
82 * is broken, do not use it.
Anand Gadiyar58dcfb32010-07-14 13:38:49 +000083 */
Paul Walmsley98fa3d82010-01-26 20:13:13 -070084static struct powerdomain core_3xxx_pre_es3_1_pwrdm = {
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030085 .name = "core_pwrdm",
86 .prcm_offs = CORE_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030087 .pwrsts = PWRSTS_OFF_RET_ON,
Thara Gopinath4133a442010-02-24 12:05:50 -070088 .pwrsts_logic_ret = PWRSTS_OFF_RET,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030089 .banks = 2,
90 .pwrsts_mem_ret = {
91 [0] = PWRSTS_OFF_RET, /* MEM1RETSTATE */
92 [1] = PWRSTS_OFF_RET, /* MEM2RETSTATE */
93 },
94 .pwrsts_mem_on = {
95 [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
96 [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
97 },
Kevin Hilmanda03ce62011-03-18 14:12:18 -070098 .voltdm = { .name = "core" },
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030099};
100
Paul Walmsley98fa3d82010-01-26 20:13:13 -0700101static struct powerdomain core_3xxx_es3_1_pwrdm = {
Paul Walmsley7eb1afc2009-02-05 20:45:28 -0700102 .name = "core_pwrdm",
103 .prcm_offs = CORE_MOD,
Paul Walmsley7eb1afc2009-02-05 20:45:28 -0700104 .pwrsts = PWRSTS_OFF_RET_ON,
Thara Gopinath4133a442010-02-24 12:05:50 -0700105 .pwrsts_logic_ret = PWRSTS_OFF_RET,
Jean Pihet447b8da2010-11-17 17:52:11 +0000106 /*
107 * Setting the SAR flag for errata ID i478 which applies
108 * to 3430 <= ES3.1
109 */
Paul Walmsley7eb1afc2009-02-05 20:45:28 -0700110 .flags = PWRDM_HAS_HDWR_SAR, /* for USBTLL only */
111 .banks = 2,
112 .pwrsts_mem_ret = {
113 [0] = PWRSTS_OFF_RET, /* MEM1RETSTATE */
114 [1] = PWRSTS_OFF_RET, /* MEM2RETSTATE */
115 },
116 .pwrsts_mem_on = {
117 [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
118 [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
119 },
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700120 .voltdm = { .name = "core" },
Paul Walmsley7eb1afc2009-02-05 20:45:28 -0700121};
122
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300123static struct powerdomain dss_pwrdm = {
124 .name = "dss_pwrdm",
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300125 .prcm_offs = OMAP3430_DSS_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300126 .pwrsts = PWRSTS_OFF_RET_ON,
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700127 .pwrsts_logic_ret = PWRSTS_RET,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300128 .banks = 1,
129 .pwrsts_mem_ret = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700130 [0] = PWRSTS_RET, /* MEMRETSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300131 },
132 .pwrsts_mem_on = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700133 [0] = PWRSTS_ON, /* MEMONSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300134 },
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700135 .voltdm = { .name = "core" },
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300136};
137
Paul Walmsleybe48ea72009-01-27 19:44:28 -0700138/*
139 * Although the 34XX TRM Rev K Table 4-371 notes that retention is a
140 * possible SGX powerstate, the SGX device itself does not support
141 * retention.
142 */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300143static struct powerdomain sgx_pwrdm = {
144 .name = "sgx_pwrdm",
145 .prcm_offs = OMAP3430ES2_SGX_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300146 /* XXX This is accurate for 3430 SGX, but what about GFX? */
Paul Walmsleybe48ea72009-01-27 19:44:28 -0700147 .pwrsts = PWRSTS_OFF_ON,
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700148 .pwrsts_logic_ret = PWRSTS_RET,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300149 .banks = 1,
150 .pwrsts_mem_ret = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700151 [0] = PWRSTS_RET, /* MEMRETSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300152 },
153 .pwrsts_mem_on = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700154 [0] = PWRSTS_ON, /* MEMONSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300155 },
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700156 .voltdm = { .name = "core" },
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300157};
158
159static struct powerdomain cam_pwrdm = {
160 .name = "cam_pwrdm",
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300161 .prcm_offs = OMAP3430_CAM_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300162 .pwrsts = PWRSTS_OFF_RET_ON,
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700163 .pwrsts_logic_ret = PWRSTS_RET,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300164 .banks = 1,
165 .pwrsts_mem_ret = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700166 [0] = PWRSTS_RET, /* MEMRETSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300167 },
168 .pwrsts_mem_on = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700169 [0] = PWRSTS_ON, /* MEMONSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300170 },
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700171 .voltdm = { .name = "core" },
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300172};
173
174static struct powerdomain per_pwrdm = {
175 .name = "per_pwrdm",
176 .prcm_offs = OMAP3430_PER_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300177 .pwrsts = PWRSTS_OFF_RET_ON,
178 .pwrsts_logic_ret = PWRSTS_OFF_RET,
179 .banks = 1,
180 .pwrsts_mem_ret = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700181 [0] = PWRSTS_RET, /* MEMRETSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300182 },
183 .pwrsts_mem_on = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700184 [0] = PWRSTS_ON, /* MEMONSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300185 },
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700186 .voltdm = { .name = "core" },
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300187};
188
189static struct powerdomain emu_pwrdm = {
190 .name = "emu_pwrdm",
191 .prcm_offs = OMAP3430_EMU_MOD,
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700192 .voltdm = { .name = "core" },
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300193};
194
195static struct powerdomain neon_pwrdm = {
196 .name = "neon_pwrdm",
197 .prcm_offs = OMAP3430_NEON_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300198 .pwrsts = PWRSTS_OFF_RET_ON,
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700199 .pwrsts_logic_ret = PWRSTS_RET,
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700200 .voltdm = { .name = "mpu_iva" },
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300201};
202
203static struct powerdomain usbhost_pwrdm = {
204 .name = "usbhost_pwrdm",
205 .prcm_offs = OMAP3430ES2_USBHOST_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300206 .pwrsts = PWRSTS_OFF_RET_ON,
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700207 .pwrsts_logic_ret = PWRSTS_RET,
Kalle Jokiniemi867d3202009-04-23 13:58:51 +0300208 /*
209 * REVISIT: Enabling usb host save and restore mechanism seems to
210 * leave the usb host domain permanently in ACTIVE mode after
211 * changing the usb host power domain state from OFF to active once.
212 * Disabling for now.
213 */
214 /*.flags = PWRDM_HAS_HDWR_SAR,*/ /* for USBHOST ctrlr only */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300215 .banks = 1,
216 .pwrsts_mem_ret = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700217 [0] = PWRSTS_RET, /* MEMRETSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300218 },
219 .pwrsts_mem_on = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700220 [0] = PWRSTS_ON, /* MEMONSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300221 },
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700222 .voltdm = { .name = "core" },
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300223};
224
Paul Walmsley46e0ccf2009-01-27 19:44:18 -0700225static struct powerdomain dpll1_pwrdm = {
226 .name = "dpll1_pwrdm",
227 .prcm_offs = MPU_MOD,
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700228 .voltdm = { .name = "mpu_iva" },
Paul Walmsley46e0ccf2009-01-27 19:44:18 -0700229};
230
231static struct powerdomain dpll2_pwrdm = {
232 .name = "dpll2_pwrdm",
233 .prcm_offs = OMAP3430_IVA2_MOD,
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700234 .voltdm = { .name = "mpu_iva" },
Paul Walmsley46e0ccf2009-01-27 19:44:18 -0700235};
236
237static struct powerdomain dpll3_pwrdm = {
238 .name = "dpll3_pwrdm",
239 .prcm_offs = PLL_MOD,
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700240 .voltdm = { .name = "core" },
Paul Walmsley46e0ccf2009-01-27 19:44:18 -0700241};
242
243static struct powerdomain dpll4_pwrdm = {
244 .name = "dpll4_pwrdm",
245 .prcm_offs = PLL_MOD,
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700246 .voltdm = { .name = "core" },
Paul Walmsley46e0ccf2009-01-27 19:44:18 -0700247};
248
249static struct powerdomain dpll5_pwrdm = {
250 .name = "dpll5_pwrdm",
251 .prcm_offs = PLL_MOD,
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700252 .voltdm = { .name = "core" },
Paul Walmsley46e0ccf2009-01-27 19:44:18 -0700253};
254
Paul Walmsley6e014782010-12-21 20:01:20 -0700255/* As powerdomains are added or removed above, this list must also be changed */
Paul Walmsley81794882011-09-14 11:34:21 -0600256static struct powerdomain *powerdomains_omap3430_common[] __initdata = {
Paul Walmsley6e014782010-12-21 20:01:20 -0700257 &wkup_omap2_pwrdm,
Paul Walmsley6e014782010-12-21 20:01:20 -0700258 &iva2_pwrdm,
259 &mpu_3xxx_pwrdm,
260 &neon_pwrdm,
Paul Walmsley6e014782010-12-21 20:01:20 -0700261 &cam_pwrdm,
262 &dss_pwrdm,
263 &per_pwrdm,
264 &emu_pwrdm,
Paul Walmsley6e014782010-12-21 20:01:20 -0700265 &dpll1_pwrdm,
266 &dpll2_pwrdm,
267 &dpll3_pwrdm,
268 &dpll4_pwrdm,
Paul Walmsley6e014782010-12-21 20:01:20 -0700269 NULL
270};
271
Paul Walmsley81794882011-09-14 11:34:21 -0600272static struct powerdomain *powerdomains_omap3430es1[] __initdata = {
273 &gfx_omap2_pwrdm,
274 &core_3xxx_pre_es3_1_pwrdm,
275 NULL
276};
277
278/* also includes 3630ES1.0 */
279static struct powerdomain *powerdomains_omap3430es2_es3_0[] __initdata = {
280 &core_3xxx_pre_es3_1_pwrdm,
281 &sgx_pwrdm,
282 &usbhost_pwrdm,
283 &dpll5_pwrdm,
284 NULL
285};
286
287/* also includes 3630ES1.1+ */
288static struct powerdomain *powerdomains_omap3430es3_1plus[] __initdata = {
289 &core_3xxx_es3_1_pwrdm,
290 &sgx_pwrdm,
291 &usbhost_pwrdm,
292 &dpll5_pwrdm,
293 NULL
294};
Paul Walmsley6e014782010-12-21 20:01:20 -0700295
296void __init omap3xxx_powerdomains_init(void)
297{
Paul Walmsley81794882011-09-14 11:34:21 -0600298 unsigned int rev;
299
300 if (!cpu_is_omap34xx())
301 return;
302
Paul Walmsley129c65e2011-09-14 16:01:21 -0600303 pwrdm_register_platform_funcs(&omap3_pwrdm_operations);
Paul Walmsley81794882011-09-14 11:34:21 -0600304 pwrdm_register_pwrdms(powerdomains_omap3430_common);
305
306 rev = omap_rev();
307
308 if (rev == OMAP3430_REV_ES1_0)
309 pwrdm_register_pwrdms(powerdomains_omap3430es1);
310 else if (rev == OMAP3430_REV_ES2_0 || rev == OMAP3430_REV_ES2_1 ||
311 rev == OMAP3430_REV_ES3_0 || rev == OMAP3630_REV_ES1_0)
312 pwrdm_register_pwrdms(powerdomains_omap3430es2_es3_0);
313 else if (rev == OMAP3430_REV_ES3_1 || rev == OMAP3430_REV_ES3_1_2 ||
314 rev == OMAP3517_REV_ES1_0 || rev == OMAP3517_REV_ES1_1 ||
315 rev == OMAP3630_REV_ES1_1 || rev == OMAP3630_REV_ES1_2)
316 pwrdm_register_pwrdms(powerdomains_omap3430es3_1plus);
317 else
318 WARN(1, "OMAP3 powerdomain init: unknown chip type\n");
319
Paul Walmsley129c65e2011-09-14 16:01:21 -0600320 pwrdm_complete_init();
Paul Walmsley6e014782010-12-21 20:01:20 -0700321}