blob: 8ef26daeed68f966b64fb410e346dc073e940fe3 [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 },
Kevin Hilmanda03ce62011-03-18 14:12:18 -070054 .voltdm = { .name = "mpu_iva" },
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030055};
56
Paul Walmsley98fa3d82010-01-26 20:13:13 -070057static struct powerdomain mpu_3xxx_pwrdm = {
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030058 .name = "mpu_pwrdm",
59 .prcm_offs = MPU_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030060 .pwrsts = PWRSTS_OFF_RET_ON,
61 .pwrsts_logic_ret = PWRSTS_OFF_RET,
Thara Gopinath3863c742009-12-08 16:33:15 -070062 .flags = PWRDM_HAS_MPU_QUIRK,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030063 .banks = 1,
64 .pwrsts_mem_ret = {
65 [0] = PWRSTS_OFF_RET,
66 },
67 .pwrsts_mem_on = {
68 [0] = PWRSTS_OFF_ON,
69 },
Kevin Hilmanda03ce62011-03-18 14:12:18 -070070 .voltdm = { .name = "mpu_iva" },
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030071};
72
Anand Gadiyar58dcfb32010-07-14 13:38:49 +000073/*
74 * The USBTLL Save-and-Restore mechanism is broken on
Lucas De Marchi25985ed2011-03-30 22:57:33 -030075 * 3430s up to ES3.0 and 3630ES1.0. Hence this feature
Anand Gadiyar58dcfb32010-07-14 13:38:49 +000076 * needs to be disabled on these chips.
77 * Refer: 3430 errata ID i459 and 3630 errata ID i579
Jean Pihet447b8da2010-11-17 17:52:11 +000078 *
79 * Note: setting the SAR flag could help for errata ID i478
80 * which applies to 3430 <= ES3.1, but since the SAR feature
81 * is broken, do not use it.
Anand Gadiyar58dcfb32010-07-14 13:38:49 +000082 */
Paul Walmsley98fa3d82010-01-26 20:13:13 -070083static struct powerdomain core_3xxx_pre_es3_1_pwrdm = {
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030084 .name = "core_pwrdm",
85 .prcm_offs = CORE_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030086 .pwrsts = PWRSTS_OFF_RET_ON,
Thara Gopinath4133a442010-02-24 12:05:50 -070087 .pwrsts_logic_ret = PWRSTS_OFF_RET,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030088 .banks = 2,
89 .pwrsts_mem_ret = {
90 [0] = PWRSTS_OFF_RET, /* MEM1RETSTATE */
91 [1] = PWRSTS_OFF_RET, /* MEM2RETSTATE */
92 },
93 .pwrsts_mem_on = {
94 [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
95 [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
96 },
Kevin Hilmanda03ce62011-03-18 14:12:18 -070097 .voltdm = { .name = "core" },
Paul Walmsleyecb24aa2008-08-19 11:08:43 +030098};
99
Paul Walmsley98fa3d82010-01-26 20:13:13 -0700100static struct powerdomain core_3xxx_es3_1_pwrdm = {
Paul Walmsley7eb1afc2009-02-05 20:45:28 -0700101 .name = "core_pwrdm",
102 .prcm_offs = CORE_MOD,
Paul Walmsley7eb1afc2009-02-05 20:45:28 -0700103 .pwrsts = PWRSTS_OFF_RET_ON,
Thara Gopinath4133a442010-02-24 12:05:50 -0700104 .pwrsts_logic_ret = PWRSTS_OFF_RET,
Jean Pihet447b8da2010-11-17 17:52:11 +0000105 /*
106 * Setting the SAR flag for errata ID i478 which applies
107 * to 3430 <= ES3.1
108 */
Paul Walmsley7eb1afc2009-02-05 20:45:28 -0700109 .flags = PWRDM_HAS_HDWR_SAR, /* for USBTLL only */
110 .banks = 2,
111 .pwrsts_mem_ret = {
112 [0] = PWRSTS_OFF_RET, /* MEM1RETSTATE */
113 [1] = PWRSTS_OFF_RET, /* MEM2RETSTATE */
114 },
115 .pwrsts_mem_on = {
116 [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
117 [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
118 },
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700119 .voltdm = { .name = "core" },
Paul Walmsley7eb1afc2009-02-05 20:45:28 -0700120};
121
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300122static struct powerdomain dss_pwrdm = {
123 .name = "dss_pwrdm",
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300124 .prcm_offs = OMAP3430_DSS_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300125 .pwrsts = PWRSTS_OFF_RET_ON,
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700126 .pwrsts_logic_ret = PWRSTS_RET,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300127 .banks = 1,
128 .pwrsts_mem_ret = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700129 [0] = PWRSTS_RET, /* MEMRETSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300130 },
131 .pwrsts_mem_on = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700132 [0] = PWRSTS_ON, /* MEMONSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300133 },
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700134 .voltdm = { .name = "core" },
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300135};
136
Paul Walmsleybe48ea72009-01-27 19:44:28 -0700137/*
138 * Although the 34XX TRM Rev K Table 4-371 notes that retention is a
139 * possible SGX powerstate, the SGX device itself does not support
140 * retention.
141 */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300142static struct powerdomain sgx_pwrdm = {
143 .name = "sgx_pwrdm",
144 .prcm_offs = OMAP3430ES2_SGX_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300145 /* XXX This is accurate for 3430 SGX, but what about GFX? */
Paul Walmsleybe48ea72009-01-27 19:44:28 -0700146 .pwrsts = PWRSTS_OFF_ON,
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700147 .pwrsts_logic_ret = PWRSTS_RET,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300148 .banks = 1,
149 .pwrsts_mem_ret = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700150 [0] = PWRSTS_RET, /* MEMRETSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300151 },
152 .pwrsts_mem_on = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700153 [0] = PWRSTS_ON, /* MEMONSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300154 },
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700155 .voltdm = { .name = "core" },
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300156};
157
158static struct powerdomain cam_pwrdm = {
159 .name = "cam_pwrdm",
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300160 .prcm_offs = OMAP3430_CAM_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300161 .pwrsts = PWRSTS_OFF_RET_ON,
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700162 .pwrsts_logic_ret = PWRSTS_RET,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300163 .banks = 1,
164 .pwrsts_mem_ret = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700165 [0] = PWRSTS_RET, /* MEMRETSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300166 },
167 .pwrsts_mem_on = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700168 [0] = PWRSTS_ON, /* MEMONSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300169 },
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700170 .voltdm = { .name = "core" },
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300171};
172
173static struct powerdomain per_pwrdm = {
174 .name = "per_pwrdm",
175 .prcm_offs = OMAP3430_PER_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300176 .pwrsts = PWRSTS_OFF_RET_ON,
177 .pwrsts_logic_ret = PWRSTS_OFF_RET,
178 .banks = 1,
179 .pwrsts_mem_ret = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700180 [0] = PWRSTS_RET, /* MEMRETSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300181 },
182 .pwrsts_mem_on = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700183 [0] = PWRSTS_ON, /* MEMONSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300184 },
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700185 .voltdm = { .name = "core" },
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300186};
187
188static struct powerdomain emu_pwrdm = {
189 .name = "emu_pwrdm",
190 .prcm_offs = OMAP3430_EMU_MOD,
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700191 .voltdm = { .name = "core" },
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300192};
193
194static struct powerdomain neon_pwrdm = {
195 .name = "neon_pwrdm",
196 .prcm_offs = OMAP3430_NEON_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300197 .pwrsts = PWRSTS_OFF_RET_ON,
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700198 .pwrsts_logic_ret = PWRSTS_RET,
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700199 .voltdm = { .name = "mpu_iva" },
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300200};
201
202static struct powerdomain usbhost_pwrdm = {
203 .name = "usbhost_pwrdm",
204 .prcm_offs = OMAP3430ES2_USBHOST_MOD,
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300205 .pwrsts = PWRSTS_OFF_RET_ON,
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700206 .pwrsts_logic_ret = PWRSTS_RET,
Kalle Jokiniemi867d3202009-04-23 13:58:51 +0300207 /*
208 * REVISIT: Enabling usb host save and restore mechanism seems to
209 * leave the usb host domain permanently in ACTIVE mode after
210 * changing the usb host power domain state from OFF to active once.
211 * Disabling for now.
212 */
213 /*.flags = PWRDM_HAS_HDWR_SAR,*/ /* for USBHOST ctrlr only */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300214 .banks = 1,
215 .pwrsts_mem_ret = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700216 [0] = PWRSTS_RET, /* MEMRETSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300217 },
218 .pwrsts_mem_on = {
Paul Walmsley4cb49fe2011-03-07 19:28:15 -0700219 [0] = PWRSTS_ON, /* MEMONSTATE */
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300220 },
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700221 .voltdm = { .name = "core" },
Paul Walmsleyecb24aa2008-08-19 11:08:43 +0300222};
223
Paul Walmsley46e0ccf2009-01-27 19:44:18 -0700224static struct powerdomain dpll1_pwrdm = {
225 .name = "dpll1_pwrdm",
226 .prcm_offs = MPU_MOD,
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700227 .voltdm = { .name = "mpu_iva" },
Paul Walmsley46e0ccf2009-01-27 19:44:18 -0700228};
229
230static struct powerdomain dpll2_pwrdm = {
231 .name = "dpll2_pwrdm",
232 .prcm_offs = OMAP3430_IVA2_MOD,
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700233 .voltdm = { .name = "mpu_iva" },
Paul Walmsley46e0ccf2009-01-27 19:44:18 -0700234};
235
236static struct powerdomain dpll3_pwrdm = {
237 .name = "dpll3_pwrdm",
238 .prcm_offs = PLL_MOD,
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700239 .voltdm = { .name = "core" },
Paul Walmsley46e0ccf2009-01-27 19:44:18 -0700240};
241
242static struct powerdomain dpll4_pwrdm = {
243 .name = "dpll4_pwrdm",
244 .prcm_offs = PLL_MOD,
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700245 .voltdm = { .name = "core" },
Paul Walmsley46e0ccf2009-01-27 19:44:18 -0700246};
247
248static struct powerdomain dpll5_pwrdm = {
249 .name = "dpll5_pwrdm",
250 .prcm_offs = PLL_MOD,
Kevin Hilmanda03ce62011-03-18 14:12:18 -0700251 .voltdm = { .name = "core" },
Paul Walmsley46e0ccf2009-01-27 19:44:18 -0700252};
253
Paul Walmsley6e014782010-12-21 20:01:20 -0700254/* As powerdomains are added or removed above, this list must also be changed */
Paul Walmsley81794882011-09-14 11:34:21 -0600255static struct powerdomain *powerdomains_omap3430_common[] __initdata = {
Paul Walmsley6e014782010-12-21 20:01:20 -0700256 &wkup_omap2_pwrdm,
Paul Walmsley6e014782010-12-21 20:01:20 -0700257 &iva2_pwrdm,
258 &mpu_3xxx_pwrdm,
259 &neon_pwrdm,
Paul Walmsley6e014782010-12-21 20:01:20 -0700260 &cam_pwrdm,
261 &dss_pwrdm,
262 &per_pwrdm,
263 &emu_pwrdm,
Paul Walmsley6e014782010-12-21 20:01:20 -0700264 &dpll1_pwrdm,
265 &dpll2_pwrdm,
266 &dpll3_pwrdm,
267 &dpll4_pwrdm,
Paul Walmsley6e014782010-12-21 20:01:20 -0700268 NULL
269};
270
Paul Walmsley81794882011-09-14 11:34:21 -0600271static struct powerdomain *powerdomains_omap3430es1[] __initdata = {
272 &gfx_omap2_pwrdm,
273 &core_3xxx_pre_es3_1_pwrdm,
274 NULL
275};
276
277/* also includes 3630ES1.0 */
278static struct powerdomain *powerdomains_omap3430es2_es3_0[] __initdata = {
279 &core_3xxx_pre_es3_1_pwrdm,
280 &sgx_pwrdm,
281 &usbhost_pwrdm,
282 &dpll5_pwrdm,
283 NULL
284};
285
286/* also includes 3630ES1.1+ */
287static struct powerdomain *powerdomains_omap3430es3_1plus[] __initdata = {
288 &core_3xxx_es3_1_pwrdm,
289 &sgx_pwrdm,
290 &usbhost_pwrdm,
291 &dpll5_pwrdm,
292 NULL
293};
Paul Walmsley6e014782010-12-21 20:01:20 -0700294
295void __init omap3xxx_powerdomains_init(void)
296{
Paul Walmsley81794882011-09-14 11:34:21 -0600297 unsigned int rev;
298
299 if (!cpu_is_omap34xx())
300 return;
301
Paul Walmsley129c65e2011-09-14 16:01:21 -0600302 pwrdm_register_platform_funcs(&omap3_pwrdm_operations);
Paul Walmsley81794882011-09-14 11:34:21 -0600303 pwrdm_register_pwrdms(powerdomains_omap3430_common);
304
305 rev = omap_rev();
306
307 if (rev == OMAP3430_REV_ES1_0)
308 pwrdm_register_pwrdms(powerdomains_omap3430es1);
309 else if (rev == OMAP3430_REV_ES2_0 || rev == OMAP3430_REV_ES2_1 ||
310 rev == OMAP3430_REV_ES3_0 || rev == OMAP3630_REV_ES1_0)
311 pwrdm_register_pwrdms(powerdomains_omap3430es2_es3_0);
312 else if (rev == OMAP3430_REV_ES3_1 || rev == OMAP3430_REV_ES3_1_2 ||
313 rev == OMAP3517_REV_ES1_0 || rev == OMAP3517_REV_ES1_1 ||
314 rev == OMAP3630_REV_ES1_1 || rev == OMAP3630_REV_ES1_2)
315 pwrdm_register_pwrdms(powerdomains_omap3430es3_1plus);
316 else
317 WARN(1, "OMAP3 powerdomain init: unknown chip type\n");
318
Paul Walmsley129c65e2011-09-14 16:01:21 -0600319 pwrdm_complete_init();
Paul Walmsley6e014782010-12-21 20:01:20 -0700320}