• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * AM43xx Power domains framework
3  *
4  * Copyright (C) 2013 Texas Instruments, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10 
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 
14 #include "powerdomain.h"
15 
16 #include "prcm-common.h"
17 #include "prcm44xx.h"
18 #include "prcm43xx.h"
19 
20 static struct powerdomain gfx_43xx_pwrdm = {
21 	.name		  = "gfx_pwrdm",
22 	.voltdm		  = { .name = "core" },
23 	.prcm_offs	  = AM43XX_PRM_GFX_INST,
24 	.prcm_partition	  = AM43XX_PRM_PARTITION,
25 	.pwrsts		  = PWRSTS_OFF_ON,
26 	.banks		  = 1,
27 	.pwrsts_mem_on	= {
28 		[0] = PWRSTS_ON,	/* gfx_mem */
29 	},
30 	.flags		  = PWRDM_HAS_LOWPOWERSTATECHANGE,
31 };
32 
33 static struct powerdomain mpu_43xx_pwrdm = {
34 	.name		  = "mpu_pwrdm",
35 	.voltdm		  = { .name = "mpu" },
36 	.prcm_offs	  = AM43XX_PRM_MPU_INST,
37 	.prcm_partition	  = AM43XX_PRM_PARTITION,
38 	.pwrsts		  = PWRSTS_OFF_RET_ON,
39 	.pwrsts_logic_ret = PWRSTS_OFF_RET,
40 	.banks		  = 3,
41 	.pwrsts_mem_ret	= {
42 		[0] = PWRSTS_OFF_RET,	/* mpu_l1 */
43 		[1] = PWRSTS_OFF_RET,	/* mpu_l2 */
44 		[2] = PWRSTS_OFF_RET,	/* mpu_ram */
45 	},
46 	.pwrsts_mem_on	= {
47 		[0] = PWRSTS_ON,	/* mpu_l1 */
48 		[1] = PWRSTS_ON,	/* mpu_l2 */
49 		[2] = PWRSTS_ON,	/* mpu_ram */
50 	},
51 	.flags		  = PWRDM_HAS_LOWPOWERSTATECHANGE,
52 };
53 
54 static struct powerdomain rtc_43xx_pwrdm = {
55 	.name		  = "rtc_pwrdm",
56 	.voltdm		  = { .name = "rtc" },
57 	.prcm_offs	  = AM43XX_PRM_RTC_INST,
58 	.prcm_partition	  = AM43XX_PRM_PARTITION,
59 	.pwrsts		  = PWRSTS_ON,
60 };
61 
62 static struct powerdomain wkup_43xx_pwrdm = {
63 	.name		  = "wkup_pwrdm",
64 	.voltdm		  = { .name = "core" },
65 	.prcm_offs	  = AM43XX_PRM_WKUP_INST,
66 	.prcm_partition	  = AM43XX_PRM_PARTITION,
67 	.pwrsts		  = PWRSTS_ON,
68 	.banks		  = 1,
69 	.pwrsts_mem_on	= {
70 		[0] = PWRSTS_ON,	/* debugss_mem */
71 	},
72 };
73 
74 static struct powerdomain tamper_43xx_pwrdm = {
75 	.name		  = "tamper_pwrdm",
76 	.voltdm		  = { .name = "tamper" },
77 	.prcm_offs	  = AM43XX_PRM_TAMPER_INST,
78 	.prcm_partition	  = AM43XX_PRM_PARTITION,
79 	.pwrsts		  = PWRSTS_ON,
80 };
81 
82 static struct powerdomain cefuse_43xx_pwrdm = {
83 	.name		  = "cefuse_pwrdm",
84 	.voltdm		  = { .name = "core" },
85 	.prcm_offs	  = AM43XX_PRM_CEFUSE_INST,
86 	.prcm_partition	  = AM43XX_PRM_PARTITION,
87 	.pwrsts		  = PWRSTS_OFF_ON,
88 	.flags		  = PWRDM_HAS_LOWPOWERSTATECHANGE,
89 };
90 
91 static struct powerdomain per_43xx_pwrdm = {
92 	.name		  = "per_pwrdm",
93 	.voltdm		  = { .name = "core" },
94 	.prcm_offs	  = AM43XX_PRM_PER_INST,
95 	.prcm_partition	  = AM43XX_PRM_PARTITION,
96 	.pwrsts		  = PWRSTS_OFF_RET_ON,
97 	.pwrsts_logic_ret = PWRSTS_OFF_RET,
98 	.banks		  = 4,
99 	.pwrsts_mem_ret	= {
100 		[0] = PWRSTS_OFF_RET,	/* icss_mem */
101 		[1] = PWRSTS_OFF_RET,	/* per_mem */
102 		[2] = PWRSTS_OFF_RET,	/* ram1_mem */
103 		[3] = PWRSTS_OFF_RET,	/* ram2_mem */
104 	},
105 	.pwrsts_mem_on	= {
106 		[0] = PWRSTS_ON,	/* icss_mem */
107 		[1] = PWRSTS_ON,	/* per_mem */
108 		[2] = PWRSTS_ON,	/* ram1_mem */
109 		[3] = PWRSTS_ON,	/* ram2_mem */
110 	},
111 	.flags		  = PWRDM_HAS_LOWPOWERSTATECHANGE,
112 };
113 
114 static struct powerdomain *powerdomains_am43xx[] __initdata = {
115 	&gfx_43xx_pwrdm,
116 	&mpu_43xx_pwrdm,
117 	&rtc_43xx_pwrdm,
118 	&wkup_43xx_pwrdm,
119 	&tamper_43xx_pwrdm,
120 	&cefuse_43xx_pwrdm,
121 	&per_43xx_pwrdm,
122 	NULL
123 };
124 
am43xx_check_vcvp(void)125 static int am43xx_check_vcvp(void)
126 {
127 	return 0;
128 }
129 
am43xx_powerdomains_init(void)130 void __init am43xx_powerdomains_init(void)
131 {
132 	omap4_pwrdm_operations.pwrdm_has_voltdm = am43xx_check_vcvp;
133 	pwrdm_register_platform_funcs(&omap4_pwrdm_operations);
134 	pwrdm_register_pwrdms(powerdomains_am43xx);
135 	pwrdm_complete_init();
136 }
137