1*d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
26e01478aSPaul Walmsley /*
36e01478aSPaul Walmsley * OMAP3 powerdomain definitions
46e01478aSPaul Walmsley *
58179488aSPaul Walmsley * Copyright (C) 2007-2008, 2011 Texas Instruments, Inc.
64cb49fecSPaul Walmsley * Copyright (C) 2007-2011 Nokia Corporation
76e01478aSPaul Walmsley *
86e01478aSPaul Walmsley * Paul Walmsley, Jouni Högander
96e01478aSPaul Walmsley */
106e01478aSPaul Walmsley
116e01478aSPaul Walmsley #include <linux/kernel.h>
126e01478aSPaul Walmsley #include <linux/init.h>
13d9a5f4ddSTony Lindgren #include <linux/bug.h>
146e01478aSPaul Walmsley
15dbc04161STony Lindgren #include "soc.h"
1672e06d08SPaul Walmsley #include "powerdomain.h"
176e01478aSPaul Walmsley #include "powerdomains2xxx_3xxx_data.h"
186e01478aSPaul Walmsley #include "prcm-common.h"
1959fb659bSPaul Walmsley #include "prm2xxx_3xxx.h"
206e01478aSPaul Walmsley #include "prm-regbits-34xx.h"
2159fb659bSPaul Walmsley #include "cm2xxx_3xxx.h"
226e01478aSPaul Walmsley #include "cm-regbits-34xx.h"
236e01478aSPaul Walmsley
246e01478aSPaul Walmsley /*
256e01478aSPaul Walmsley * 34XX-specific powerdomains, dependencies
266e01478aSPaul Walmsley */
276e01478aSPaul Walmsley
286e01478aSPaul Walmsley /*
296e01478aSPaul Walmsley * Powerdomains
306e01478aSPaul Walmsley */
316e01478aSPaul Walmsley
326e01478aSPaul Walmsley static struct powerdomain iva2_pwrdm = {
336e01478aSPaul Walmsley .name = "iva2_pwrdm",
346e01478aSPaul Walmsley .prcm_offs = OMAP3430_IVA2_MOD,
356e01478aSPaul Walmsley .pwrsts = PWRSTS_OFF_RET_ON,
366e01478aSPaul Walmsley .pwrsts_logic_ret = PWRSTS_OFF_RET,
376e01478aSPaul Walmsley .banks = 4,
386e01478aSPaul Walmsley .pwrsts_mem_ret = {
396e01478aSPaul Walmsley [0] = PWRSTS_OFF_RET,
406e01478aSPaul Walmsley [1] = PWRSTS_OFF_RET,
416e01478aSPaul Walmsley [2] = PWRSTS_OFF_RET,
426e01478aSPaul Walmsley [3] = PWRSTS_OFF_RET,
436e01478aSPaul Walmsley },
446e01478aSPaul Walmsley .pwrsts_mem_on = {
454cb49fecSPaul Walmsley [0] = PWRSTS_ON,
464cb49fecSPaul Walmsley [1] = PWRSTS_ON,
476e01478aSPaul Walmsley [2] = PWRSTS_OFF_ON,
484cb49fecSPaul Walmsley [3] = PWRSTS_ON,
496e01478aSPaul Walmsley },
50da03ce65SKevin Hilman .voltdm = { .name = "mpu_iva" },
516e01478aSPaul Walmsley };
526e01478aSPaul Walmsley
536e01478aSPaul Walmsley static struct powerdomain mpu_3xxx_pwrdm = {
546e01478aSPaul Walmsley .name = "mpu_pwrdm",
556e01478aSPaul Walmsley .prcm_offs = MPU_MOD,
566e01478aSPaul Walmsley .pwrsts = PWRSTS_OFF_RET_ON,
576e01478aSPaul Walmsley .pwrsts_logic_ret = PWRSTS_OFF_RET,
586e01478aSPaul Walmsley .flags = PWRDM_HAS_MPU_QUIRK,
596e01478aSPaul Walmsley .banks = 1,
606e01478aSPaul Walmsley .pwrsts_mem_ret = {
616e01478aSPaul Walmsley [0] = PWRSTS_OFF_RET,
626e01478aSPaul Walmsley },
636e01478aSPaul Walmsley .pwrsts_mem_on = {
646e01478aSPaul Walmsley [0] = PWRSTS_OFF_ON,
656e01478aSPaul Walmsley },
66da03ce65SKevin Hilman .voltdm = { .name = "mpu_iva" },
676e01478aSPaul Walmsley };
686e01478aSPaul Walmsley
69ff7ad7e4SMark A. Greer static struct powerdomain mpu_am35x_pwrdm = {
70ff7ad7e4SMark A. Greer .name = "mpu_pwrdm",
71ff7ad7e4SMark A. Greer .prcm_offs = MPU_MOD,
72ff7ad7e4SMark A. Greer .pwrsts = PWRSTS_ON,
73ff7ad7e4SMark A. Greer .pwrsts_logic_ret = PWRSTS_ON,
74ff7ad7e4SMark A. Greer .flags = PWRDM_HAS_MPU_QUIRK,
75ff7ad7e4SMark A. Greer .banks = 1,
76ff7ad7e4SMark A. Greer .pwrsts_mem_ret = {
77ff7ad7e4SMark A. Greer [0] = PWRSTS_ON,
78ff7ad7e4SMark A. Greer },
79ff7ad7e4SMark A. Greer .pwrsts_mem_on = {
80ff7ad7e4SMark A. Greer [0] = PWRSTS_ON,
81ff7ad7e4SMark A. Greer },
82ff7ad7e4SMark A. Greer .voltdm = { .name = "mpu_iva" },
83ff7ad7e4SMark A. Greer };
84ff7ad7e4SMark A. Greer
856e01478aSPaul Walmsley /*
866e01478aSPaul Walmsley * The USBTLL Save-and-Restore mechanism is broken on
876e01478aSPaul Walmsley * 3430s up to ES3.0 and 3630ES1.0. Hence this feature
886e01478aSPaul Walmsley * needs to be disabled on these chips.
896e01478aSPaul Walmsley * Refer: 3430 errata ID i459 and 3630 errata ID i579
906e01478aSPaul Walmsley *
916e01478aSPaul Walmsley * Note: setting the SAR flag could help for errata ID i478
926e01478aSPaul Walmsley * which applies to 3430 <= ES3.1, but since the SAR feature
936e01478aSPaul Walmsley * is broken, do not use it.
946e01478aSPaul Walmsley */
956e01478aSPaul Walmsley static struct powerdomain core_3xxx_pre_es3_1_pwrdm = {
966e01478aSPaul Walmsley .name = "core_pwrdm",
976e01478aSPaul Walmsley .prcm_offs = CORE_MOD,
986e01478aSPaul Walmsley .pwrsts = PWRSTS_OFF_RET_ON,
996e01478aSPaul Walmsley .pwrsts_logic_ret = PWRSTS_OFF_RET,
1006e01478aSPaul Walmsley .banks = 2,
1016e01478aSPaul Walmsley .pwrsts_mem_ret = {
1026e01478aSPaul Walmsley [0] = PWRSTS_OFF_RET, /* MEM1RETSTATE */
1036e01478aSPaul Walmsley [1] = PWRSTS_OFF_RET, /* MEM2RETSTATE */
1046e01478aSPaul Walmsley },
1056e01478aSPaul Walmsley .pwrsts_mem_on = {
1066e01478aSPaul Walmsley [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
1076e01478aSPaul Walmsley [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
1086e01478aSPaul Walmsley },
109da03ce65SKevin Hilman .voltdm = { .name = "core" },
1106e01478aSPaul Walmsley };
1116e01478aSPaul Walmsley
1126e01478aSPaul Walmsley static struct powerdomain core_3xxx_es3_1_pwrdm = {
1136e01478aSPaul Walmsley .name = "core_pwrdm",
1146e01478aSPaul Walmsley .prcm_offs = CORE_MOD,
1156e01478aSPaul Walmsley .pwrsts = PWRSTS_OFF_RET_ON,
1166e01478aSPaul Walmsley .pwrsts_logic_ret = PWRSTS_OFF_RET,
1176e01478aSPaul Walmsley /*
1186e01478aSPaul Walmsley * Setting the SAR flag for errata ID i478 which applies
1196e01478aSPaul Walmsley * to 3430 <= ES3.1
1206e01478aSPaul Walmsley */
1216e01478aSPaul Walmsley .flags = PWRDM_HAS_HDWR_SAR, /* for USBTLL only */
1226e01478aSPaul Walmsley .banks = 2,
1236e01478aSPaul Walmsley .pwrsts_mem_ret = {
1246e01478aSPaul Walmsley [0] = PWRSTS_OFF_RET, /* MEM1RETSTATE */
1256e01478aSPaul Walmsley [1] = PWRSTS_OFF_RET, /* MEM2RETSTATE */
1266e01478aSPaul Walmsley },
1276e01478aSPaul Walmsley .pwrsts_mem_on = {
1286e01478aSPaul Walmsley [0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
1296e01478aSPaul Walmsley [1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
1306e01478aSPaul Walmsley },
131da03ce65SKevin Hilman .voltdm = { .name = "core" },
1326e01478aSPaul Walmsley };
1336e01478aSPaul Walmsley
134ff7ad7e4SMark A. Greer static struct powerdomain core_am35x_pwrdm = {
135ff7ad7e4SMark A. Greer .name = "core_pwrdm",
136ff7ad7e4SMark A. Greer .prcm_offs = CORE_MOD,
137ff7ad7e4SMark A. Greer .pwrsts = PWRSTS_ON,
138ff7ad7e4SMark A. Greer .pwrsts_logic_ret = PWRSTS_ON,
139ff7ad7e4SMark A. Greer .banks = 2,
140ff7ad7e4SMark A. Greer .pwrsts_mem_ret = {
141ff7ad7e4SMark A. Greer [0] = PWRSTS_ON, /* MEM1RETSTATE */
142ff7ad7e4SMark A. Greer [1] = PWRSTS_ON, /* MEM2RETSTATE */
143ff7ad7e4SMark A. Greer },
144ff7ad7e4SMark A. Greer .pwrsts_mem_on = {
145ff7ad7e4SMark A. Greer [0] = PWRSTS_ON, /* MEM1ONSTATE */
146ff7ad7e4SMark A. Greer [1] = PWRSTS_ON, /* MEM2ONSTATE */
147ff7ad7e4SMark A. Greer },
148ff7ad7e4SMark A. Greer .voltdm = { .name = "core" },
149ff7ad7e4SMark A. Greer };
150ff7ad7e4SMark A. Greer
1516e01478aSPaul Walmsley static struct powerdomain dss_pwrdm = {
1526e01478aSPaul Walmsley .name = "dss_pwrdm",
1536e01478aSPaul Walmsley .prcm_offs = OMAP3430_DSS_MOD,
1546e01478aSPaul Walmsley .pwrsts = PWRSTS_OFF_RET_ON,
1554cb49fecSPaul Walmsley .pwrsts_logic_ret = PWRSTS_RET,
1566e01478aSPaul Walmsley .banks = 1,
1576e01478aSPaul Walmsley .pwrsts_mem_ret = {
1584cb49fecSPaul Walmsley [0] = PWRSTS_RET, /* MEMRETSTATE */
1596e01478aSPaul Walmsley },
1606e01478aSPaul Walmsley .pwrsts_mem_on = {
1614cb49fecSPaul Walmsley [0] = PWRSTS_ON, /* MEMONSTATE */
1626e01478aSPaul Walmsley },
163da03ce65SKevin Hilman .voltdm = { .name = "core" },
1646e01478aSPaul Walmsley };
1656e01478aSPaul Walmsley
166ff7ad7e4SMark A. Greer static struct powerdomain dss_am35x_pwrdm = {
167ff7ad7e4SMark A. Greer .name = "dss_pwrdm",
168ff7ad7e4SMark A. Greer .prcm_offs = OMAP3430_DSS_MOD,
169ff7ad7e4SMark A. Greer .pwrsts = PWRSTS_ON,
170ff7ad7e4SMark A. Greer .pwrsts_logic_ret = PWRSTS_ON,
171ff7ad7e4SMark A. Greer .banks = 1,
172ff7ad7e4SMark A. Greer .pwrsts_mem_ret = {
173ff7ad7e4SMark A. Greer [0] = PWRSTS_ON, /* MEMRETSTATE */
174ff7ad7e4SMark A. Greer },
175ff7ad7e4SMark A. Greer .pwrsts_mem_on = {
176ff7ad7e4SMark A. Greer [0] = PWRSTS_ON, /* MEMONSTATE */
177ff7ad7e4SMark A. Greer },
178ff7ad7e4SMark A. Greer .voltdm = { .name = "core" },
179ff7ad7e4SMark A. Greer };
180ff7ad7e4SMark A. Greer
1816e01478aSPaul Walmsley /*
1826e01478aSPaul Walmsley * Although the 34XX TRM Rev K Table 4-371 notes that retention is a
1836e01478aSPaul Walmsley * possible SGX powerstate, the SGX device itself does not support
1846e01478aSPaul Walmsley * retention.
1856e01478aSPaul Walmsley */
1866e01478aSPaul Walmsley static struct powerdomain sgx_pwrdm = {
1876e01478aSPaul Walmsley .name = "sgx_pwrdm",
1886e01478aSPaul Walmsley .prcm_offs = OMAP3430ES2_SGX_MOD,
1896e01478aSPaul Walmsley /* XXX This is accurate for 3430 SGX, but what about GFX? */
1906e01478aSPaul Walmsley .pwrsts = PWRSTS_OFF_ON,
1914cb49fecSPaul Walmsley .pwrsts_logic_ret = PWRSTS_RET,
1926e01478aSPaul Walmsley .banks = 1,
1936e01478aSPaul Walmsley .pwrsts_mem_ret = {
1944cb49fecSPaul Walmsley [0] = PWRSTS_RET, /* MEMRETSTATE */
1956e01478aSPaul Walmsley },
1966e01478aSPaul Walmsley .pwrsts_mem_on = {
1974cb49fecSPaul Walmsley [0] = PWRSTS_ON, /* MEMONSTATE */
1986e01478aSPaul Walmsley },
199da03ce65SKevin Hilman .voltdm = { .name = "core" },
2006e01478aSPaul Walmsley };
2016e01478aSPaul Walmsley
202ff7ad7e4SMark A. Greer static struct powerdomain sgx_am35x_pwrdm = {
203ff7ad7e4SMark A. Greer .name = "sgx_pwrdm",
204ff7ad7e4SMark A. Greer .prcm_offs = OMAP3430ES2_SGX_MOD,
205ff7ad7e4SMark A. Greer .pwrsts = PWRSTS_ON,
206ff7ad7e4SMark A. Greer .pwrsts_logic_ret = PWRSTS_ON,
207ff7ad7e4SMark A. Greer .banks = 1,
208ff7ad7e4SMark A. Greer .pwrsts_mem_ret = {
209ff7ad7e4SMark A. Greer [0] = PWRSTS_ON, /* MEMRETSTATE */
210ff7ad7e4SMark A. Greer },
211ff7ad7e4SMark A. Greer .pwrsts_mem_on = {
212ff7ad7e4SMark A. Greer [0] = PWRSTS_ON, /* MEMONSTATE */
213ff7ad7e4SMark A. Greer },
214ff7ad7e4SMark A. Greer .voltdm = { .name = "core" },
215ff7ad7e4SMark A. Greer };
216ff7ad7e4SMark A. Greer
2176e01478aSPaul Walmsley static struct powerdomain cam_pwrdm = {
2186e01478aSPaul Walmsley .name = "cam_pwrdm",
2196e01478aSPaul Walmsley .prcm_offs = OMAP3430_CAM_MOD,
2206e01478aSPaul Walmsley .pwrsts = PWRSTS_OFF_RET_ON,
2214cb49fecSPaul Walmsley .pwrsts_logic_ret = PWRSTS_RET,
2226e01478aSPaul Walmsley .banks = 1,
2236e01478aSPaul Walmsley .pwrsts_mem_ret = {
2244cb49fecSPaul Walmsley [0] = PWRSTS_RET, /* MEMRETSTATE */
2256e01478aSPaul Walmsley },
2266e01478aSPaul Walmsley .pwrsts_mem_on = {
2274cb49fecSPaul Walmsley [0] = PWRSTS_ON, /* MEMONSTATE */
2286e01478aSPaul Walmsley },
229da03ce65SKevin Hilman .voltdm = { .name = "core" },
2306e01478aSPaul Walmsley };
2316e01478aSPaul Walmsley
2326e01478aSPaul Walmsley static struct powerdomain per_pwrdm = {
2336e01478aSPaul Walmsley .name = "per_pwrdm",
2346e01478aSPaul Walmsley .prcm_offs = OMAP3430_PER_MOD,
2356e01478aSPaul Walmsley .pwrsts = PWRSTS_OFF_RET_ON,
2366e01478aSPaul Walmsley .pwrsts_logic_ret = PWRSTS_OFF_RET,
2376e01478aSPaul Walmsley .banks = 1,
2386e01478aSPaul Walmsley .pwrsts_mem_ret = {
2394cb49fecSPaul Walmsley [0] = PWRSTS_RET, /* MEMRETSTATE */
2406e01478aSPaul Walmsley },
2416e01478aSPaul Walmsley .pwrsts_mem_on = {
2424cb49fecSPaul Walmsley [0] = PWRSTS_ON, /* MEMONSTATE */
2436e01478aSPaul Walmsley },
244da03ce65SKevin Hilman .voltdm = { .name = "core" },
2456e01478aSPaul Walmsley };
2466e01478aSPaul Walmsley
247ff7ad7e4SMark A. Greer static struct powerdomain per_am35x_pwrdm = {
248ff7ad7e4SMark A. Greer .name = "per_pwrdm",
249ff7ad7e4SMark A. Greer .prcm_offs = OMAP3430_PER_MOD,
250ff7ad7e4SMark A. Greer .pwrsts = PWRSTS_ON,
251ff7ad7e4SMark A. Greer .pwrsts_logic_ret = PWRSTS_ON,
252ff7ad7e4SMark A. Greer .banks = 1,
253ff7ad7e4SMark A. Greer .pwrsts_mem_ret = {
254ff7ad7e4SMark A. Greer [0] = PWRSTS_ON, /* MEMRETSTATE */
255ff7ad7e4SMark A. Greer },
256ff7ad7e4SMark A. Greer .pwrsts_mem_on = {
257ff7ad7e4SMark A. Greer [0] = PWRSTS_ON, /* MEMONSTATE */
258ff7ad7e4SMark A. Greer },
259ff7ad7e4SMark A. Greer .voltdm = { .name = "core" },
260ff7ad7e4SMark A. Greer };
261ff7ad7e4SMark A. Greer
2626e01478aSPaul Walmsley static struct powerdomain emu_pwrdm = {
2636e01478aSPaul Walmsley .name = "emu_pwrdm",
2646e01478aSPaul Walmsley .prcm_offs = OMAP3430_EMU_MOD,
265da03ce65SKevin Hilman .voltdm = { .name = "core" },
2666e01478aSPaul Walmsley };
2676e01478aSPaul Walmsley
2686e01478aSPaul Walmsley static struct powerdomain neon_pwrdm = {
2696e01478aSPaul Walmsley .name = "neon_pwrdm",
2706e01478aSPaul Walmsley .prcm_offs = OMAP3430_NEON_MOD,
2716e01478aSPaul Walmsley .pwrsts = PWRSTS_OFF_RET_ON,
2724cb49fecSPaul Walmsley .pwrsts_logic_ret = PWRSTS_RET,
273da03ce65SKevin Hilman .voltdm = { .name = "mpu_iva" },
2746e01478aSPaul Walmsley };
2756e01478aSPaul Walmsley
276ff7ad7e4SMark A. Greer static struct powerdomain neon_am35x_pwrdm = {
277ff7ad7e4SMark A. Greer .name = "neon_pwrdm",
278ff7ad7e4SMark A. Greer .prcm_offs = OMAP3430_NEON_MOD,
279ff7ad7e4SMark A. Greer .pwrsts = PWRSTS_ON,
280ff7ad7e4SMark A. Greer .pwrsts_logic_ret = PWRSTS_ON,
281ff7ad7e4SMark A. Greer .voltdm = { .name = "mpu_iva" },
282ff7ad7e4SMark A. Greer };
283ff7ad7e4SMark A. Greer
2846e01478aSPaul Walmsley static struct powerdomain usbhost_pwrdm = {
2856e01478aSPaul Walmsley .name = "usbhost_pwrdm",
2866e01478aSPaul Walmsley .prcm_offs = OMAP3430ES2_USBHOST_MOD,
2876e01478aSPaul Walmsley .pwrsts = PWRSTS_OFF_RET_ON,
2884cb49fecSPaul Walmsley .pwrsts_logic_ret = PWRSTS_RET,
2896e01478aSPaul Walmsley /*
2906e01478aSPaul Walmsley * REVISIT: Enabling usb host save and restore mechanism seems to
2916e01478aSPaul Walmsley * leave the usb host domain permanently in ACTIVE mode after
2926e01478aSPaul Walmsley * changing the usb host power domain state from OFF to active once.
2936e01478aSPaul Walmsley * Disabling for now.
2946e01478aSPaul Walmsley */
2956e01478aSPaul Walmsley /*.flags = PWRDM_HAS_HDWR_SAR,*/ /* for USBHOST ctrlr only */
2966e01478aSPaul Walmsley .banks = 1,
2976e01478aSPaul Walmsley .pwrsts_mem_ret = {
2984cb49fecSPaul Walmsley [0] = PWRSTS_RET, /* MEMRETSTATE */
2996e01478aSPaul Walmsley },
3006e01478aSPaul Walmsley .pwrsts_mem_on = {
3014cb49fecSPaul Walmsley [0] = PWRSTS_ON, /* MEMONSTATE */
3026e01478aSPaul Walmsley },
303da03ce65SKevin Hilman .voltdm = { .name = "core" },
3046e01478aSPaul Walmsley };
3056e01478aSPaul Walmsley
3066e01478aSPaul Walmsley static struct powerdomain dpll1_pwrdm = {
3076e01478aSPaul Walmsley .name = "dpll1_pwrdm",
3086e01478aSPaul Walmsley .prcm_offs = MPU_MOD,
309da03ce65SKevin Hilman .voltdm = { .name = "mpu_iva" },
3106e01478aSPaul Walmsley };
3116e01478aSPaul Walmsley
3126e01478aSPaul Walmsley static struct powerdomain dpll2_pwrdm = {
3136e01478aSPaul Walmsley .name = "dpll2_pwrdm",
3146e01478aSPaul Walmsley .prcm_offs = OMAP3430_IVA2_MOD,
315da03ce65SKevin Hilman .voltdm = { .name = "mpu_iva" },
3166e01478aSPaul Walmsley };
3176e01478aSPaul Walmsley
3186e01478aSPaul Walmsley static struct powerdomain dpll3_pwrdm = {
3196e01478aSPaul Walmsley .name = "dpll3_pwrdm",
3206e01478aSPaul Walmsley .prcm_offs = PLL_MOD,
321da03ce65SKevin Hilman .voltdm = { .name = "core" },
3226e01478aSPaul Walmsley };
3236e01478aSPaul Walmsley
3246e01478aSPaul Walmsley static struct powerdomain dpll4_pwrdm = {
3256e01478aSPaul Walmsley .name = "dpll4_pwrdm",
3266e01478aSPaul Walmsley .prcm_offs = PLL_MOD,
327da03ce65SKevin Hilman .voltdm = { .name = "core" },
3286e01478aSPaul Walmsley };
3296e01478aSPaul Walmsley
3306e01478aSPaul Walmsley static struct powerdomain dpll5_pwrdm = {
3316e01478aSPaul Walmsley .name = "dpll5_pwrdm",
3326e01478aSPaul Walmsley .prcm_offs = PLL_MOD,
333da03ce65SKevin Hilman .voltdm = { .name = "core" },
3346e01478aSPaul Walmsley };
3356e01478aSPaul Walmsley
3360f0dd089SAida Mynzhasova static struct powerdomain alwon_81xx_pwrdm = {
3370f0dd089SAida Mynzhasova .name = "alwon_pwrdm",
3380f0dd089SAida Mynzhasova .prcm_offs = TI81XX_PRM_ALWON_MOD,
3390f0dd089SAida Mynzhasova .pwrsts = PWRSTS_OFF_ON,
3400f0dd089SAida Mynzhasova .voltdm = { .name = "core" },
3410f0dd089SAida Mynzhasova };
3420f0dd089SAida Mynzhasova
343c3ed359cSAida Mynzhasova static struct powerdomain device_81xx_pwrdm = {
344c3ed359cSAida Mynzhasova .name = "device_pwrdm",
345c3ed359cSAida Mynzhasova .prcm_offs = TI81XX_PRM_DEVICE_MOD,
346c3ed359cSAida Mynzhasova .voltdm = { .name = "core" },
347c3ed359cSAida Mynzhasova };
348c3ed359cSAida Mynzhasova
3497c80a3f8STony Lindgren static struct powerdomain gem_814x_pwrdm = {
3507c80a3f8STony Lindgren .name = "gem_pwrdm",
3517c80a3f8STony Lindgren .prcm_offs = TI814X_PRM_DSP_MOD,
3527c80a3f8STony Lindgren .pwrsts = PWRSTS_OFF_ON,
3537c80a3f8STony Lindgren .voltdm = { .name = "dsp" },
3547c80a3f8STony Lindgren };
3557c80a3f8STony Lindgren
3567c80a3f8STony Lindgren static struct powerdomain ivahd_814x_pwrdm = {
3577c80a3f8STony Lindgren .name = "ivahd_pwrdm",
3587c80a3f8STony Lindgren .prcm_offs = TI814X_PRM_HDVICP_MOD,
3597c80a3f8STony Lindgren .pwrsts = PWRSTS_OFF_ON,
3607c80a3f8STony Lindgren .voltdm = { .name = "iva" },
3617c80a3f8STony Lindgren };
3627c80a3f8STony Lindgren
3637c80a3f8STony Lindgren static struct powerdomain hdvpss_814x_pwrdm = {
3647c80a3f8STony Lindgren .name = "hdvpss_pwrdm",
3657c80a3f8STony Lindgren .prcm_offs = TI814X_PRM_HDVPSS_MOD,
3667c80a3f8STony Lindgren .pwrsts = PWRSTS_OFF_ON,
3677c80a3f8STony Lindgren .voltdm = { .name = "dsp" },
3687c80a3f8STony Lindgren };
3697c80a3f8STony Lindgren
3707c80a3f8STony Lindgren static struct powerdomain sgx_814x_pwrdm = {
3717c80a3f8STony Lindgren .name = "sgx_pwrdm",
3727c80a3f8STony Lindgren .prcm_offs = TI814X_PRM_GFX_MOD,
3737c80a3f8STony Lindgren .pwrsts = PWRSTS_OFF_ON,
3747c80a3f8STony Lindgren .voltdm = { .name = "core" },
3757c80a3f8STony Lindgren };
3767c80a3f8STony Lindgren
3777c80a3f8STony Lindgren static struct powerdomain isp_814x_pwrdm = {
3787c80a3f8STony Lindgren .name = "isp_pwrdm",
3797c80a3f8STony Lindgren .prcm_offs = TI814X_PRM_ISP_MOD,
3807c80a3f8STony Lindgren .pwrsts = PWRSTS_OFF_ON,
3817c80a3f8STony Lindgren .voltdm = { .name = "core" },
3827c80a3f8STony Lindgren };
3837c80a3f8STony Lindgren
384418d4ebcSTony Lindgren static struct powerdomain active_81xx_pwrdm = {
385c3ed359cSAida Mynzhasova .name = "active_pwrdm",
386c3ed359cSAida Mynzhasova .prcm_offs = TI816X_PRM_ACTIVE_MOD,
387c3ed359cSAida Mynzhasova .pwrsts = PWRSTS_OFF_ON,
388c3ed359cSAida Mynzhasova .voltdm = { .name = "core" },
389c3ed359cSAida Mynzhasova };
390c3ed359cSAida Mynzhasova
391418d4ebcSTony Lindgren static struct powerdomain default_81xx_pwrdm = {
392c3ed359cSAida Mynzhasova .name = "default_pwrdm",
393c3ed359cSAida Mynzhasova .prcm_offs = TI81XX_PRM_DEFAULT_MOD,
394c3ed359cSAida Mynzhasova .pwrsts = PWRSTS_OFF_ON,
395c3ed359cSAida Mynzhasova .voltdm = { .name = "core" },
396c3ed359cSAida Mynzhasova };
397c3ed359cSAida Mynzhasova
398c3ed359cSAida Mynzhasova static struct powerdomain ivahd0_816x_pwrdm = {
399c3ed359cSAida Mynzhasova .name = "ivahd0_pwrdm",
400c3ed359cSAida Mynzhasova .prcm_offs = TI816X_PRM_IVAHD0_MOD,
401c3ed359cSAida Mynzhasova .pwrsts = PWRSTS_OFF_ON,
402c3ed359cSAida Mynzhasova .voltdm = { .name = "mpu_iva" },
403c3ed359cSAida Mynzhasova };
404c3ed359cSAida Mynzhasova
405c3ed359cSAida Mynzhasova static struct powerdomain ivahd1_816x_pwrdm = {
406c3ed359cSAida Mynzhasova .name = "ivahd1_pwrdm",
407c3ed359cSAida Mynzhasova .prcm_offs = TI816X_PRM_IVAHD1_MOD,
408c3ed359cSAida Mynzhasova .pwrsts = PWRSTS_OFF_ON,
409c3ed359cSAida Mynzhasova .voltdm = { .name = "mpu_iva" },
410c3ed359cSAida Mynzhasova };
411c3ed359cSAida Mynzhasova
412c3ed359cSAida Mynzhasova static struct powerdomain ivahd2_816x_pwrdm = {
413c3ed359cSAida Mynzhasova .name = "ivahd2_pwrdm",
414c3ed359cSAida Mynzhasova .prcm_offs = TI816X_PRM_IVAHD2_MOD,
415c3ed359cSAida Mynzhasova .pwrsts = PWRSTS_OFF_ON,
416c3ed359cSAida Mynzhasova .voltdm = { .name = "mpu_iva" },
417c3ed359cSAida Mynzhasova };
418c3ed359cSAida Mynzhasova
419c3ed359cSAida Mynzhasova static struct powerdomain sgx_816x_pwrdm = {
420c3ed359cSAida Mynzhasova .name = "sgx_pwrdm",
421c3ed359cSAida Mynzhasova .prcm_offs = TI816X_PRM_SGX_MOD,
422c3ed359cSAida Mynzhasova .pwrsts = PWRSTS_OFF_ON,
423c3ed359cSAida Mynzhasova .voltdm = { .name = "core" },
424c3ed359cSAida Mynzhasova };
425c3ed359cSAida Mynzhasova
4266e01478aSPaul Walmsley /* As powerdomains are added or removed above, this list must also be changed */
4278179488aSPaul Walmsley static struct powerdomain *powerdomains_omap3430_common[] __initdata = {
4286e01478aSPaul Walmsley &wkup_omap2_pwrdm,
4296e01478aSPaul Walmsley &iva2_pwrdm,
4306e01478aSPaul Walmsley &mpu_3xxx_pwrdm,
4316e01478aSPaul Walmsley &neon_pwrdm,
4326e01478aSPaul Walmsley &cam_pwrdm,
4336e01478aSPaul Walmsley &dss_pwrdm,
4346e01478aSPaul Walmsley &per_pwrdm,
4356e01478aSPaul Walmsley &emu_pwrdm,
4366e01478aSPaul Walmsley &dpll1_pwrdm,
4376e01478aSPaul Walmsley &dpll2_pwrdm,
4386e01478aSPaul Walmsley &dpll3_pwrdm,
4396e01478aSPaul Walmsley &dpll4_pwrdm,
4406e01478aSPaul Walmsley NULL
4416e01478aSPaul Walmsley };
4426e01478aSPaul Walmsley
4438179488aSPaul Walmsley static struct powerdomain *powerdomains_omap3430es1[] __initdata = {
4448179488aSPaul Walmsley &gfx_omap2_pwrdm,
4458179488aSPaul Walmsley &core_3xxx_pre_es3_1_pwrdm,
4468179488aSPaul Walmsley NULL
4478179488aSPaul Walmsley };
4488179488aSPaul Walmsley
4498179488aSPaul Walmsley /* also includes 3630ES1.0 */
4508179488aSPaul Walmsley static struct powerdomain *powerdomains_omap3430es2_es3_0[] __initdata = {
4518179488aSPaul Walmsley &core_3xxx_pre_es3_1_pwrdm,
4528179488aSPaul Walmsley &sgx_pwrdm,
4538179488aSPaul Walmsley &usbhost_pwrdm,
4548179488aSPaul Walmsley &dpll5_pwrdm,
4558179488aSPaul Walmsley NULL
4568179488aSPaul Walmsley };
4578179488aSPaul Walmsley
4588179488aSPaul Walmsley /* also includes 3630ES1.1+ */
4598179488aSPaul Walmsley static struct powerdomain *powerdomains_omap3430es3_1plus[] __initdata = {
4608179488aSPaul Walmsley &core_3xxx_es3_1_pwrdm,
4618179488aSPaul Walmsley &sgx_pwrdm,
4628179488aSPaul Walmsley &usbhost_pwrdm,
4638179488aSPaul Walmsley &dpll5_pwrdm,
4648179488aSPaul Walmsley NULL
4658179488aSPaul Walmsley };
4666e01478aSPaul Walmsley
467ff7ad7e4SMark A. Greer static struct powerdomain *powerdomains_am35x[] __initdata = {
468ff7ad7e4SMark A. Greer &wkup_omap2_pwrdm,
469ff7ad7e4SMark A. Greer &mpu_am35x_pwrdm,
470ff7ad7e4SMark A. Greer &neon_am35x_pwrdm,
471ff7ad7e4SMark A. Greer &core_am35x_pwrdm,
472ff7ad7e4SMark A. Greer &sgx_am35x_pwrdm,
473ff7ad7e4SMark A. Greer &dss_am35x_pwrdm,
474ff7ad7e4SMark A. Greer &per_am35x_pwrdm,
475ff7ad7e4SMark A. Greer &emu_pwrdm,
476ff7ad7e4SMark A. Greer &dpll1_pwrdm,
477ff7ad7e4SMark A. Greer &dpll3_pwrdm,
478ff7ad7e4SMark A. Greer &dpll4_pwrdm,
479ff7ad7e4SMark A. Greer &dpll5_pwrdm,
480ff7ad7e4SMark A. Greer NULL
481ff7ad7e4SMark A. Greer };
482ff7ad7e4SMark A. Greer
4837c80a3f8STony Lindgren static struct powerdomain *powerdomains_ti814x[] __initdata = {
4847c80a3f8STony Lindgren &alwon_81xx_pwrdm,
4857c80a3f8STony Lindgren &device_81xx_pwrdm,
486418d4ebcSTony Lindgren &active_81xx_pwrdm,
487418d4ebcSTony Lindgren &default_81xx_pwrdm,
4887c80a3f8STony Lindgren &gem_814x_pwrdm,
4897c80a3f8STony Lindgren &ivahd_814x_pwrdm,
4907c80a3f8STony Lindgren &hdvpss_814x_pwrdm,
4917c80a3f8STony Lindgren &sgx_814x_pwrdm,
4927c80a3f8STony Lindgren &isp_814x_pwrdm,
4937c80a3f8STony Lindgren NULL
4947c80a3f8STony Lindgren };
4957c80a3f8STony Lindgren
4967c80a3f8STony Lindgren static struct powerdomain *powerdomains_ti816x[] __initdata = {
4970f0dd089SAida Mynzhasova &alwon_81xx_pwrdm,
498c3ed359cSAida Mynzhasova &device_81xx_pwrdm,
499418d4ebcSTony Lindgren &active_81xx_pwrdm,
500418d4ebcSTony Lindgren &default_81xx_pwrdm,
501c3ed359cSAida Mynzhasova &ivahd0_816x_pwrdm,
502c3ed359cSAida Mynzhasova &ivahd1_816x_pwrdm,
503c3ed359cSAida Mynzhasova &ivahd2_816x_pwrdm,
504c3ed359cSAida Mynzhasova &sgx_816x_pwrdm,
505c3ed359cSAida Mynzhasova NULL
506c3ed359cSAida Mynzhasova };
507c3ed359cSAida Mynzhasova
5087c80a3f8STony Lindgren /* TI81XX specific ops */
5097c80a3f8STony Lindgren #define TI81XX_PM_PWSTCTRL 0x0000
5107c80a3f8STony Lindgren #define TI81XX_RM_RSTCTRL 0x0010
5117c80a3f8STony Lindgren #define TI81XX_PM_PWSTST 0x0004
5127c80a3f8STony Lindgren
ti81xx_pwrdm_set_next_pwrst(struct powerdomain * pwrdm,u8 pwrst)5137c80a3f8STony Lindgren static int ti81xx_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
5147c80a3f8STony Lindgren {
5157c80a3f8STony Lindgren omap2_prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK,
5167c80a3f8STony Lindgren (pwrst << OMAP_POWERSTATE_SHIFT),
5177c80a3f8STony Lindgren pwrdm->prcm_offs, TI81XX_PM_PWSTCTRL);
5187c80a3f8STony Lindgren return 0;
5197c80a3f8STony Lindgren }
5207c80a3f8STony Lindgren
ti81xx_pwrdm_read_next_pwrst(struct powerdomain * pwrdm)5217c80a3f8STony Lindgren static int ti81xx_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
5227c80a3f8STony Lindgren {
5237c80a3f8STony Lindgren return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
5247c80a3f8STony Lindgren TI81XX_PM_PWSTCTRL,
5257c80a3f8STony Lindgren OMAP_POWERSTATE_MASK);
5267c80a3f8STony Lindgren }
5277c80a3f8STony Lindgren
ti81xx_pwrdm_read_pwrst(struct powerdomain * pwrdm)5287c80a3f8STony Lindgren static int ti81xx_pwrdm_read_pwrst(struct powerdomain *pwrdm)
5297c80a3f8STony Lindgren {
5307c80a3f8STony Lindgren return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
5317c80a3f8STony Lindgren (pwrdm->prcm_offs == TI814X_PRM_GFX_MOD) ? TI81XX_RM_RSTCTRL :
5327c80a3f8STony Lindgren TI81XX_PM_PWSTST,
5337c80a3f8STony Lindgren OMAP_POWERSTATEST_MASK);
5347c80a3f8STony Lindgren }
5357c80a3f8STony Lindgren
ti81xx_pwrdm_read_logic_pwrst(struct powerdomain * pwrdm)5367c80a3f8STony Lindgren static int ti81xx_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
5377c80a3f8STony Lindgren {
5387c80a3f8STony Lindgren return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
5397c80a3f8STony Lindgren (pwrdm->prcm_offs == TI814X_PRM_GFX_MOD) ? TI81XX_RM_RSTCTRL :
5407c80a3f8STony Lindgren TI81XX_PM_PWSTST,
5417c80a3f8STony Lindgren OMAP3430_LOGICSTATEST_MASK);
5427c80a3f8STony Lindgren }
5437c80a3f8STony Lindgren
ti81xx_pwrdm_wait_transition(struct powerdomain * pwrdm)5447c80a3f8STony Lindgren static int ti81xx_pwrdm_wait_transition(struct powerdomain *pwrdm)
5457c80a3f8STony Lindgren {
5467c80a3f8STony Lindgren u32 c = 0;
5477c80a3f8STony Lindgren
5487c80a3f8STony Lindgren while ((omap2_prm_read_mod_reg(pwrdm->prcm_offs,
5497c80a3f8STony Lindgren (pwrdm->prcm_offs == TI814X_PRM_GFX_MOD) ? TI81XX_RM_RSTCTRL :
5507c80a3f8STony Lindgren TI81XX_PM_PWSTST) &
5517c80a3f8STony Lindgren OMAP_INTRANSITION_MASK) &&
5527c80a3f8STony Lindgren (c++ < PWRDM_TRANSITION_BAILOUT))
5537c80a3f8STony Lindgren udelay(1);
5547c80a3f8STony Lindgren
5557c80a3f8STony Lindgren if (c > PWRDM_TRANSITION_BAILOUT) {
5567c80a3f8STony Lindgren pr_err("powerdomain: %s timeout waiting for transition\n",
5577c80a3f8STony Lindgren pwrdm->name);
5587c80a3f8STony Lindgren return -EAGAIN;
5597c80a3f8STony Lindgren }
5607c80a3f8STony Lindgren
5617c80a3f8STony Lindgren pr_debug("powerdomain: completed transition in %d loops\n", c);
5627c80a3f8STony Lindgren
5637c80a3f8STony Lindgren return 0;
5647c80a3f8STony Lindgren }
5657c80a3f8STony Lindgren
5667c80a3f8STony Lindgren /* For dm814x we need to fix up fix GFX pwstst and rstctrl reg offsets */
5677c80a3f8STony Lindgren static struct pwrdm_ops ti81xx_pwrdm_operations = {
5687c80a3f8STony Lindgren .pwrdm_set_next_pwrst = ti81xx_pwrdm_set_next_pwrst,
5697c80a3f8STony Lindgren .pwrdm_read_next_pwrst = ti81xx_pwrdm_read_next_pwrst,
5707c80a3f8STony Lindgren .pwrdm_read_pwrst = ti81xx_pwrdm_read_pwrst,
5717c80a3f8STony Lindgren .pwrdm_read_logic_pwrst = ti81xx_pwrdm_read_logic_pwrst,
5727c80a3f8STony Lindgren .pwrdm_wait_transition = ti81xx_pwrdm_wait_transition,
5737c80a3f8STony Lindgren };
5747c80a3f8STony Lindgren
omap3xxx_powerdomains_init(void)5756e01478aSPaul Walmsley void __init omap3xxx_powerdomains_init(void)
5766e01478aSPaul Walmsley {
5778179488aSPaul Walmsley unsigned int rev;
5788179488aSPaul Walmsley
579c27964b5STony Lindgren if (!cpu_is_omap34xx() && !cpu_is_ti81xx())
5808179488aSPaul Walmsley return;
5818179488aSPaul Walmsley
5829610c8abSTony Lindgren /* Only 81xx needs custom pwrdm_operations */
5839610c8abSTony Lindgren if (!cpu_is_ti81xx())
584ae428a72SJavier Martinez Canillas pwrdm_register_platform_funcs(&omap3_pwrdm_operations);
5858179488aSPaul Walmsley
5868179488aSPaul Walmsley rev = omap_rev();
5878179488aSPaul Walmsley
588ff7ad7e4SMark A. Greer if (rev == AM35XX_REV_ES1_0 || rev == AM35XX_REV_ES1_1) {
589ff7ad7e4SMark A. Greer pwrdm_register_pwrdms(powerdomains_am35x);
5907c80a3f8STony Lindgren } else if (rev == TI8148_REV_ES1_0 || rev == TI8148_REV_ES2_0 ||
5917c80a3f8STony Lindgren rev == TI8148_REV_ES2_1) {
5929610c8abSTony Lindgren pwrdm_register_platform_funcs(&ti81xx_pwrdm_operations);
5937c80a3f8STony Lindgren pwrdm_register_pwrdms(powerdomains_ti814x);
594c3ed359cSAida Mynzhasova } else if (rev == TI8168_REV_ES1_0 || rev == TI8168_REV_ES1_1
595c3ed359cSAida Mynzhasova || rev == TI8168_REV_ES2_0 || rev == TI8168_REV_ES2_1) {
5969610c8abSTony Lindgren pwrdm_register_platform_funcs(&ti81xx_pwrdm_operations);
5977c80a3f8STony Lindgren pwrdm_register_pwrdms(powerdomains_ti816x);
598ff7ad7e4SMark A. Greer } else {
599ff7ad7e4SMark A. Greer pwrdm_register_pwrdms(powerdomains_omap3430_common);
600ff7ad7e4SMark A. Greer
601ff7ad7e4SMark A. Greer switch (rev) {
602ff7ad7e4SMark A. Greer case OMAP3430_REV_ES1_0:
6038179488aSPaul Walmsley pwrdm_register_pwrdms(powerdomains_omap3430es1);
604ff7ad7e4SMark A. Greer break;
605ff7ad7e4SMark A. Greer case OMAP3430_REV_ES2_0:
606ff7ad7e4SMark A. Greer case OMAP3430_REV_ES2_1:
607ff7ad7e4SMark A. Greer case OMAP3430_REV_ES3_0:
608ff7ad7e4SMark A. Greer case OMAP3630_REV_ES1_0:
6098179488aSPaul Walmsley pwrdm_register_pwrdms(powerdomains_omap3430es2_es3_0);
610ff7ad7e4SMark A. Greer break;
611ff7ad7e4SMark A. Greer case OMAP3430_REV_ES3_1:
612ff7ad7e4SMark A. Greer case OMAP3430_REV_ES3_1_2:
613ff7ad7e4SMark A. Greer case OMAP3630_REV_ES1_1:
614ff7ad7e4SMark A. Greer case OMAP3630_REV_ES1_2:
6158179488aSPaul Walmsley pwrdm_register_pwrdms(powerdomains_omap3430es3_1plus);
616ff7ad7e4SMark A. Greer break;
617ff7ad7e4SMark A. Greer default:
6188179488aSPaul Walmsley WARN(1, "OMAP3 powerdomain init: unknown chip type\n");
619ff7ad7e4SMark A. Greer }
620ff7ad7e4SMark A. Greer }
6218179488aSPaul Walmsley
622129c65eeSPaul Walmsley pwrdm_complete_init();
6236e01478aSPaul Walmsley }
624