1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * OMAP2XXX powerdomain definitions
4  *
5  * Copyright (C) 2007-2008, 2011 Texas Instruments, Inc.
6  * Copyright (C) 2007-2011 Nokia Corporation
7  *
8  * Paul Walmsley, Jouni Högander
9  */
10 
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 
14 #include "soc.h"
15 #include "powerdomain.h"
16 #include "powerdomains2xxx_3xxx_data.h"
17 
18 #include "prcm-common.h"
19 #include "prm2xxx_3xxx.h"
20 #include "prm-regbits-24xx.h"
21 
22 /* 24XX powerdomains and dependencies */
23 
24 /* Powerdomains */
25 
26 static struct powerdomain dsp_pwrdm = {
27 	.name		  = "dsp_pwrdm",
28 	.prcm_offs	  = OMAP24XX_DSP_MOD,
29 	.pwrsts		  = PWRSTS_OFF_RET_ON,
30 	.pwrsts_logic_ret = PWRSTS_RET,
31 	.banks		  = 1,
32 	.pwrsts_mem_ret	  = {
33 		[0] = PWRSTS_RET,
34 	},
35 	.pwrsts_mem_on	  = {
36 		[0] = PWRSTS_ON,
37 	},
38 	.voltdm		  = { .name = "core" },
39 };
40 
41 static struct powerdomain mpu_24xx_pwrdm = {
42 	.name		  = "mpu_pwrdm",
43 	.prcm_offs	  = MPU_MOD,
44 	.pwrsts		  = PWRSTS_OFF_RET_ON,
45 	.pwrsts_logic_ret = PWRSTS_OFF_RET,
46 	.banks		  = 1,
47 	.pwrsts_mem_ret	  = {
48 		[0] = PWRSTS_RET,
49 	},
50 	.pwrsts_mem_on	  = {
51 		[0] = PWRSTS_ON,
52 	},
53 	.voltdm		  = { .name = "core" },
54 };
55 
56 static struct powerdomain core_24xx_pwrdm = {
57 	.name		  = "core_pwrdm",
58 	.prcm_offs	  = CORE_MOD,
59 	.pwrsts		  = PWRSTS_OFF_RET_ON,
60 	.pwrsts_logic_ret = PWRSTS_RET,
61 	.banks		  = 3,
62 	.pwrsts_mem_ret	  = {
63 		[0] = PWRSTS_OFF_RET,	 /* MEM1RETSTATE */
64 		[1] = PWRSTS_OFF_RET,	 /* MEM2RETSTATE */
65 		[2] = PWRSTS_OFF_RET,	 /* MEM3RETSTATE */
66 	},
67 	.pwrsts_mem_on	  = {
68 		[0] = PWRSTS_OFF_RET_ON, /* MEM1ONSTATE */
69 		[1] = PWRSTS_OFF_RET_ON, /* MEM2ONSTATE */
70 		[2] = PWRSTS_OFF_RET_ON, /* MEM3ONSTATE */
71 	},
72 	.voltdm		  = { .name = "core" },
73 };
74 
75 
76 /*
77  * 2430-specific powerdomains
78  */
79 
80 /* XXX 2430 KILLDOMAINWKUP bit?  No current users apparently */
81 
82 static struct powerdomain mdm_pwrdm = {
83 	.name		  = "mdm_pwrdm",
84 	.prcm_offs	  = OMAP2430_MDM_MOD,
85 	.pwrsts		  = PWRSTS_OFF_RET_ON,
86 	.pwrsts_logic_ret = PWRSTS_RET,
87 	.banks		  = 1,
88 	.pwrsts_mem_ret	  = {
89 		[0] = PWRSTS_RET, /* MEMRETSTATE */
90 	},
91 	.pwrsts_mem_on	  = {
92 		[0] = PWRSTS_ON,  /* MEMONSTATE */
93 	},
94 	.voltdm		  = { .name = "core" },
95 };
96 
97 /*
98  *
99  */
100 
101 static struct powerdomain *powerdomains_omap24xx[] __initdata = {
102 	&wkup_omap2_pwrdm,
103 	&gfx_omap2_pwrdm,
104 	&dsp_pwrdm,
105 	&mpu_24xx_pwrdm,
106 	&core_24xx_pwrdm,
107 	NULL
108 };
109 
110 static struct powerdomain *powerdomains_omap2430[] __initdata = {
111 	&mdm_pwrdm,
112 	NULL
113 };
114 
omap242x_powerdomains_init(void)115 void __init omap242x_powerdomains_init(void)
116 {
117 	if (!cpu_is_omap2420())
118 		return;
119 
120 	pwrdm_register_platform_funcs(&omap2_pwrdm_operations);
121 	pwrdm_register_pwrdms(powerdomains_omap24xx);
122 	pwrdm_complete_init();
123 }
124 
omap243x_powerdomains_init(void)125 void __init omap243x_powerdomains_init(void)
126 {
127 	if (!cpu_is_omap2430())
128 		return;
129 
130 	pwrdm_register_platform_funcs(&omap2_pwrdm_operations);
131 	pwrdm_register_pwrdms(powerdomains_omap24xx);
132 	pwrdm_register_pwrdms(powerdomains_omap2430);
133 	pwrdm_complete_init();
134 }
135