blob: e4f3a7d6ecfcafb3167f2f7d5ff96ace6eab82c2 [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>
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030016
Paul Walmsley81794882011-09-14 11:34:21 -060017#include <plat/cpu.h>
18
Paul Walmsley72e06d02010-12-21 21:05:16 -070019#include "powerdomain.h"
Paul Walmsley6e014782010-12-21 20:01:20 -070020#include "powerdomains2xxx_3xxx_data.h"
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030021
22#include "prcm-common.h"
Paul Walmsley59fb6592010-12-21 15:30:55 -070023#include "prm2xxx_3xxx.h"
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030024#include "prm-regbits-34xx.h"
Paul Walmsley59fb6592010-12-21 15:30:55 -070025#include "cm2xxx_3xxx.h"
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030026#include "cm-regbits-34xx.h"
27
28/*
29 * 34XX-specific powerdomains, dependencies
30 */
31
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030032/*
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030033 * Powerdomains
34 */
35
36static struct powerdomain iva2_pwrdm = {
37 .name = "iva2_pwrdm",
38 .prcm_offs = OMAP3430_IVA2_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030039 .pwrsts = PWRSTS_OFF_RET_ON,
40 .pwrsts_logic_ret = PWRSTS_OFF_RET,
41 .banks = 4,
42 .pwrsts_mem_ret = {
43 [0] = PWRSTS_OFF_RET,
44 [1] = PWRSTS_OFF_RET,
45 [2] = PWRSTS_OFF_RET,
46 [3] = PWRSTS_OFF_RET,
47 },
48 .pwrsts_mem_on = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -070049 [0] = PWRSTS_ON,
50 [1] = PWRSTS_ON,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030051 [2] = PWRSTS_OFF_ON,
Paul Walmsley4cb49fe2011-03-07 19:28:15 -070052 [3] = PWRSTS_ON,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030053 },
54};
55
Paul Walmsley98fa3d82010-01-26 20:13:13 -070056static struct powerdomain mpu_3xxx_pwrdm = {
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030057 .name = "mpu_pwrdm",
58 .prcm_offs = MPU_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030059 .pwrsts = PWRSTS_OFF_RET_ON,
60 .pwrsts_logic_ret = PWRSTS_OFF_RET,
Thara Gopinath3863c742009-12-08 16:33:15 -070061 .flags = PWRDM_HAS_MPU_QUIRK,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030062 .banks = 1,
63 .pwrsts_mem_ret = {
64 [0] = PWRSTS_OFF_RET,
65 },
66 .pwrsts_mem_on = {
67 [0] = PWRSTS_OFF_ON,
68 },
69};
70
Anand Gadiyar58dcfb32010-07-14 13:38:49 +000071/*
72 * The USBTLL Save-and-Restore mechanism is broken on
Lucas De Marchi25985ed2011-03-30 22:57:33 -030073 * 3430s up to ES3.0 and 3630ES1.0. Hence this feature
Anand Gadiyar58dcfb32010-07-14 13:38:49 +000074 * needs to be disabled on these chips.
75 * Refer: 3430 errata ID i459 and 3630 errata ID i579
Jean Pihet447b8da2010-11-17 17:52:11 +000076 *
77 * Note: setting the SAR flag could help for errata ID i478
78 * which applies to 3430 <= ES3.1, but since the SAR feature
79 * is broken, do not use it.
Anand Gadiyar58dcfb32010-07-14 13:38:49 +000080 */
Paul Walmsley98fa3d82010-01-26 20:13:13 -070081static struct powerdomain core_3xxx_pre_es3_1_pwrdm = {
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030082 .name = "core_pwrdm",
83 .prcm_offs = CORE_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030084 .pwrsts = PWRSTS_OFF_RET_ON,
Thara Gopinath4133a442010-02-24 12:05:50 -070085 .pwrsts_logic_ret = PWRSTS_OFF_RET,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030086 .banks = 2,
87 .pwrsts_mem_ret = {
88 [0] = PWRSTS_OFF_RET, /* MEM1RETSTATE */
89 [1] = PWRSTS_OFF_RET, /* MEM2RETSTATE */
90 },
91 .pwrsts_mem_on = {
92 [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
93 [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
94 },
95};
96
Paul Walmsley98fa3d82010-01-26 20:13:13 -070097static struct powerdomain core_3xxx_es3_1_pwrdm = {
Paul Walmsley7eb1afc2009-02-05 20:45:28 -070098 .name = "core_pwrdm",
99 .prcm_offs = CORE_MOD,
Paul Walmsley7eb1afc2009-02-05 20:45:28 -0700100 .pwrsts = PWRSTS_OFF_RET_ON,
Thara Gopinath4133a442010-02-24 12:05:50 -0700101 .pwrsts_logic_ret = PWRSTS_OFF_RET,
Jean Pihet447b8da2010-11-17 17:52:11 +0000102 /*
103 * Setting the SAR flag for errata ID i478 which applies
104 * to 3430 <= ES3.1
105 */
Paul Walmsley7eb1afc2009-02-05 20:45:28 -0700106 .flags = PWRDM_HAS_HDWR_SAR, /* for USBTLL only */
107 .banks = 2,
108 .pwrsts_mem_ret = {
109 [0] = PWRSTS_OFF_RET, /* MEM1RETSTATE */
110 [1] = PWRSTS_OFF_RET, /* MEM2RETSTATE */
111 },
112 .pwrsts_mem_on = {
113 [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
114 [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
115 },
116};
117
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300118static struct powerdomain dss_pwrdm = {
119 .name = "dss_pwrdm",
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300120 .prcm_offs = OMAP3430_DSS_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300121 .pwrsts = PWRSTS_OFF_RET_ON,
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700122 .pwrsts_logic_ret = PWRSTS_RET,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300123 .banks = 1,
124 .pwrsts_mem_ret = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700125 [0] = PWRSTS_RET, /* MEMRETSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300126 },
127 .pwrsts_mem_on = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700128 [0] = PWRSTS_ON, /* MEMONSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300129 },
130};
131
Paul Walmsleybe48ea72009-01-27 19:44:28 -0700132/*
133 * Although the 34XX TRM Rev K Table 4-371 notes that retention is a
134 * possible SGX powerstate, the SGX device itself does not support
135 * retention.
136 */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300137static struct powerdomain sgx_pwrdm = {
138 .name = "sgx_pwrdm",
139 .prcm_offs = OMAP3430ES2_SGX_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300140 /* XXX This is accurate for 3430 SGX, but what about GFX? */
Paul Walmsleybe48ea72009-01-27 19:44:28 -0700141 .pwrsts = PWRSTS_OFF_ON,
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700142 .pwrsts_logic_ret = PWRSTS_RET,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300143 .banks = 1,
144 .pwrsts_mem_ret = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700145 [0] = PWRSTS_RET, /* MEMRETSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300146 },
147 .pwrsts_mem_on = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700148 [0] = PWRSTS_ON, /* MEMONSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300149 },
150};
151
152static struct powerdomain cam_pwrdm = {
153 .name = "cam_pwrdm",
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300154 .prcm_offs = OMAP3430_CAM_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300155 .pwrsts = PWRSTS_OFF_RET_ON,
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700156 .pwrsts_logic_ret = PWRSTS_RET,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300157 .banks = 1,
158 .pwrsts_mem_ret = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700159 [0] = PWRSTS_RET, /* MEMRETSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300160 },
161 .pwrsts_mem_on = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700162 [0] = PWRSTS_ON, /* MEMONSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300163 },
164};
165
166static struct powerdomain per_pwrdm = {
167 .name = "per_pwrdm",
168 .prcm_offs = OMAP3430_PER_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300169 .pwrsts = PWRSTS_OFF_RET_ON,
170 .pwrsts_logic_ret = PWRSTS_OFF_RET,
171 .banks = 1,
172 .pwrsts_mem_ret = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700173 [0] = PWRSTS_RET, /* MEMRETSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300174 },
175 .pwrsts_mem_on = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700176 [0] = PWRSTS_ON, /* MEMONSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300177 },
178};
179
180static struct powerdomain emu_pwrdm = {
181 .name = "emu_pwrdm",
182 .prcm_offs = OMAP3430_EMU_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300183};
184
185static struct powerdomain neon_pwrdm = {
186 .name = "neon_pwrdm",
187 .prcm_offs = OMAP3430_NEON_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300188 .pwrsts = PWRSTS_OFF_RET_ON,
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700189 .pwrsts_logic_ret = PWRSTS_RET,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300190};
191
192static struct powerdomain usbhost_pwrdm = {
193 .name = "usbhost_pwrdm",
194 .prcm_offs = OMAP3430ES2_USBHOST_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300195 .pwrsts = PWRSTS_OFF_RET_ON,
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700196 .pwrsts_logic_ret = PWRSTS_RET,
Kalle Jokiniemi867d3202009-04-23 13:58:51 +0300197 /*
198 * REVISIT: Enabling usb host save and restore mechanism seems to
199 * leave the usb host domain permanently in ACTIVE mode after
200 * changing the usb host power domain state from OFF to active once.
201 * Disabling for now.
202 */
203 /*.flags = PWRDM_HAS_HDWR_SAR,*/ /* for USBHOST ctrlr only */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300204 .banks = 1,
205 .pwrsts_mem_ret = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700206 [0] = PWRSTS_RET, /* MEMRETSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300207 },
208 .pwrsts_mem_on = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700209 [0] = PWRSTS_ON, /* MEMONSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300210 },
211};
212
Paul Walmsley46e0ccf2009-01-27 19:44:18 -0700213static struct powerdomain dpll1_pwrdm = {
214 .name = "dpll1_pwrdm",
215 .prcm_offs = MPU_MOD,
Paul Walmsley46e0ccf2009-01-27 19:44:18 -0700216};
217
218static struct powerdomain dpll2_pwrdm = {
219 .name = "dpll2_pwrdm",
220 .prcm_offs = OMAP3430_IVA2_MOD,
Paul Walmsley46e0ccf2009-01-27 19:44:18 -0700221};
222
223static struct powerdomain dpll3_pwrdm = {
224 .name = "dpll3_pwrdm",
225 .prcm_offs = PLL_MOD,
Paul Walmsley46e0ccf2009-01-27 19:44:18 -0700226};
227
228static struct powerdomain dpll4_pwrdm = {
229 .name = "dpll4_pwrdm",
230 .prcm_offs = PLL_MOD,
Paul Walmsley46e0ccf2009-01-27 19:44:18 -0700231};
232
233static struct powerdomain dpll5_pwrdm = {
234 .name = "dpll5_pwrdm",
235 .prcm_offs = PLL_MOD,
Paul Walmsley46e0ccf2009-01-27 19:44:18 -0700236};
237
Paul Walmsley6e014782010-12-21 20:01:20 -0700238/* As powerdomains are added or removed above, this list must also be changed */
Paul Walmsley81794882011-09-14 11:34:21 -0600239static struct powerdomain *powerdomains_omap3430_common[] __initdata = {
Paul Walmsley6e014782010-12-21 20:01:20 -0700240 &wkup_omap2_pwrdm,
Paul Walmsley6e014782010-12-21 20:01:20 -0700241 &iva2_pwrdm,
242 &mpu_3xxx_pwrdm,
243 &neon_pwrdm,
Paul Walmsley6e014782010-12-21 20:01:20 -0700244 &cam_pwrdm,
245 &dss_pwrdm,
246 &per_pwrdm,
247 &emu_pwrdm,
Paul Walmsley6e014782010-12-21 20:01:20 -0700248 &dpll1_pwrdm,
249 &dpll2_pwrdm,
250 &dpll3_pwrdm,
251 &dpll4_pwrdm,
Paul Walmsley6e014782010-12-21 20:01:20 -0700252 NULL
253};
254
Paul Walmsley81794882011-09-14 11:34:21 -0600255static struct powerdomain *powerdomains_omap3430es1[] __initdata = {
256 &gfx_omap2_pwrdm,
257 &core_3xxx_pre_es3_1_pwrdm,
258 NULL
259};
260
261/* also includes 3630ES1.0 */
262static struct powerdomain *powerdomains_omap3430es2_es3_0[] __initdata = {
263 &core_3xxx_pre_es3_1_pwrdm,
264 &sgx_pwrdm,
265 &usbhost_pwrdm,
266 &dpll5_pwrdm,
267 NULL
268};
269
270/* also includes 3630ES1.1+ */
271static struct powerdomain *powerdomains_omap3430es3_1plus[] __initdata = {
272 &core_3xxx_es3_1_pwrdm,
273 &sgx_pwrdm,
274 &usbhost_pwrdm,
275 &dpll5_pwrdm,
276 NULL
277};
Paul Walmsley6e014782010-12-21 20:01:20 -0700278
279void __init omap3xxx_powerdomains_init(void)
280{
Paul Walmsley81794882011-09-14 11:34:21 -0600281 unsigned int rev;
282
283 if (!cpu_is_omap34xx())
284 return;
285
Paul Walmsley129c65e2011-09-14 16:01:21 -0600286 pwrdm_register_platform_funcs(&omap3_pwrdm_operations);
Paul Walmsley81794882011-09-14 11:34:21 -0600287 pwrdm_register_pwrdms(powerdomains_omap3430_common);
288
289 rev = omap_rev();
290
291 if (rev == OMAP3430_REV_ES1_0)
292 pwrdm_register_pwrdms(powerdomains_omap3430es1);
293 else if (rev == OMAP3430_REV_ES2_0 || rev == OMAP3430_REV_ES2_1 ||
294 rev == OMAP3430_REV_ES3_0 || rev == OMAP3630_REV_ES1_0)
295 pwrdm_register_pwrdms(powerdomains_omap3430es2_es3_0);
296 else if (rev == OMAP3430_REV_ES3_1 || rev == OMAP3430_REV_ES3_1_2 ||
297 rev == OMAP3517_REV_ES1_0 || rev == OMAP3517_REV_ES1_1 ||
298 rev == OMAP3630_REV_ES1_1 || rev == OMAP3630_REV_ES1_2)
299 pwrdm_register_pwrdms(powerdomains_omap3430es3_1plus);
300 else
301 WARN(1, "OMAP3 powerdomain init: unknown chip type\n");
302
Paul Walmsley129c65e2011-09-14 16:01:21 -0600303 pwrdm_complete_init();
Paul Walmsley6e014782010-12-21 20:01:20 -0700304}