diff options
Diffstat (limited to 'arch/arm/mach-omap2/powerdomain.h')
-rw-r--r-- | arch/arm/mach-omap2/powerdomain.h | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h index 5277d56eb37f..140c36074fed 100644 --- a/arch/arm/mach-omap2/powerdomain.h +++ b/arch/arm/mach-omap2/powerdomain.h | |||
@@ -19,8 +19,7 @@ | |||
19 | 19 | ||
20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
21 | #include <linux/list.h> | 21 | #include <linux/list.h> |
22 | 22 | #include <linux/spinlock.h> | |
23 | #include <linux/atomic.h> | ||
24 | 23 | ||
25 | #include "voltage.h" | 24 | #include "voltage.h" |
26 | 25 | ||
@@ -44,18 +43,20 @@ | |||
44 | #define PWRSTS_OFF_RET_ON (PWRSTS_OFF_RET | PWRSTS_ON) | 43 | #define PWRSTS_OFF_RET_ON (PWRSTS_OFF_RET | PWRSTS_ON) |
45 | 44 | ||
46 | 45 | ||
47 | /* Powerdomain flags */ | 46 | /* |
48 | #define PWRDM_HAS_HDWR_SAR (1 << 0) /* hardware save-and-restore support */ | 47 | * Powerdomain flags (struct powerdomain.flags) |
49 | #define PWRDM_HAS_MPU_QUIRK (1 << 1) /* MPU pwr domain has MEM bank 0 bits | 48 | * |
50 | * in MEM bank 1 position. This is | 49 | * PWRDM_HAS_HDWR_SAR - powerdomain has hardware save-and-restore support |
51 | * true for OMAP3430 | 50 | * |
52 | */ | 51 | * PWRDM_HAS_MPU_QUIRK - MPU pwr domain has MEM bank 0 bits in MEM |
53 | #define PWRDM_HAS_LOWPOWERSTATECHANGE (1 << 2) /* | 52 | * bank 1 position. This is true for OMAP3430 |
54 | * support to transition from a | 53 | * |
55 | * sleep state to a lower sleep | 54 | * PWRDM_HAS_LOWPOWERSTATECHANGE - can transition from a sleep state |
56 | * state without waking up the | 55 | * to a lower sleep state without waking up the powerdomain |
57 | * powerdomain | 56 | */ |
58 | */ | 57 | #define PWRDM_HAS_HDWR_SAR BIT(0) |
58 | #define PWRDM_HAS_MPU_QUIRK BIT(1) | ||
59 | #define PWRDM_HAS_LOWPOWERSTATECHANGE BIT(2) | ||
59 | 60 | ||
60 | /* | 61 | /* |
61 | * Number of memory banks that are power-controllable. On OMAP4430, the | 62 | * Number of memory banks that are power-controllable. On OMAP4430, the |
@@ -103,6 +104,8 @@ struct powerdomain; | |||
103 | * @state_counter: | 104 | * @state_counter: |
104 | * @timer: | 105 | * @timer: |
105 | * @state_timer: | 106 | * @state_timer: |
107 | * @_lock: spinlock used to serialize powerdomain and some clockdomain ops | ||
108 | * @_lock_flags: stored flags when @_lock is taken | ||
106 | * | 109 | * |
107 | * @prcm_partition possible values are defined in mach-omap2/prcm44xx.h. | 110 | * @prcm_partition possible values are defined in mach-omap2/prcm44xx.h. |
108 | */ | 111 | */ |
@@ -127,7 +130,8 @@ struct powerdomain { | |||
127 | unsigned state_counter[PWRDM_MAX_PWRSTS]; | 130 | unsigned state_counter[PWRDM_MAX_PWRSTS]; |
128 | unsigned ret_logic_off_counter; | 131 | unsigned ret_logic_off_counter; |
129 | unsigned ret_mem_off_counter[PWRDM_MAX_MEM_BANKS]; | 132 | unsigned ret_mem_off_counter[PWRDM_MAX_MEM_BANKS]; |
130 | 133 | spinlock_t _lock; | |
134 | unsigned long _lock_flags; | ||
131 | const u8 pwrstctrl_offs; | 135 | const u8 pwrstctrl_offs; |
132 | const u8 pwrstst_offs; | 136 | const u8 pwrstst_offs; |
133 | const u32 logicretstate_mask; | 137 | const u32 logicretstate_mask; |
@@ -162,6 +166,16 @@ struct powerdomain { | |||
162 | * @pwrdm_disable_hdwr_sar: Disable Hardware Save-Restore feature for a pd | 166 | * @pwrdm_disable_hdwr_sar: Disable Hardware Save-Restore feature for a pd |
163 | * @pwrdm_set_lowpwrstchange: Enable pd transitions from a shallow to deep sleep | 167 | * @pwrdm_set_lowpwrstchange: Enable pd transitions from a shallow to deep sleep |
164 | * @pwrdm_wait_transition: Wait for a pd state transition to complete | 168 | * @pwrdm_wait_transition: Wait for a pd state transition to complete |
169 | * | ||
170 | * Regarding @pwrdm_set_lowpwrstchange: On the OMAP2 and 3-family | ||
171 | * chips, a powerdomain's power state is not allowed to directly | ||
172 | * transition from one low-power state (e.g., CSWR) to another | ||
173 | * low-power state (e.g., OFF) without first waking up the | ||
174 | * powerdomain. This wastes energy. So OMAP4 chips support the | ||
175 | * ability to transition a powerdomain power state directly from one | ||
176 | * low-power state to another. The function pointed to by | ||
177 | * @pwrdm_set_lowpwrstchange is intended to configure the OMAP4 | ||
178 | * hardware powerdomain state machine to enable this feature. | ||
165 | */ | 179 | */ |
166 | struct pwrdm_ops { | 180 | struct pwrdm_ops { |
167 | int (*pwrdm_set_next_pwrst)(struct powerdomain *pwrdm, u8 pwrst); | 181 | int (*pwrdm_set_next_pwrst)(struct powerdomain *pwrdm, u8 pwrst); |
@@ -225,15 +239,15 @@ int pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm); | |||
225 | int pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm); | 239 | int pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm); |
226 | bool pwrdm_has_hdwr_sar(struct powerdomain *pwrdm); | 240 | bool pwrdm_has_hdwr_sar(struct powerdomain *pwrdm); |
227 | 241 | ||
228 | int pwrdm_wait_transition(struct powerdomain *pwrdm); | 242 | int pwrdm_state_switch_nolock(struct powerdomain *pwrdm); |
229 | |||
230 | int pwrdm_state_switch(struct powerdomain *pwrdm); | 243 | int pwrdm_state_switch(struct powerdomain *pwrdm); |
231 | int pwrdm_pre_transition(struct powerdomain *pwrdm); | 244 | int pwrdm_pre_transition(struct powerdomain *pwrdm); |
232 | int pwrdm_post_transition(struct powerdomain *pwrdm); | 245 | int pwrdm_post_transition(struct powerdomain *pwrdm); |
233 | int pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm); | ||
234 | int pwrdm_get_context_loss_count(struct powerdomain *pwrdm); | 246 | int pwrdm_get_context_loss_count(struct powerdomain *pwrdm); |
235 | bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm); | 247 | bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm); |
236 | 248 | ||
249 | extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u8 state); | ||
250 | |||
237 | extern void omap242x_powerdomains_init(void); | 251 | extern void omap242x_powerdomains_init(void); |
238 | extern void omap243x_powerdomains_init(void); | 252 | extern void omap243x_powerdomains_init(void); |
239 | extern void omap3xxx_powerdomains_init(void); | 253 | extern void omap3xxx_powerdomains_init(void); |
@@ -253,5 +267,7 @@ extern u32 omap2_pwrdm_get_mem_bank_stst_mask(u8 bank); | |||
253 | extern struct powerdomain wkup_omap2_pwrdm; | 267 | extern struct powerdomain wkup_omap2_pwrdm; |
254 | extern struct powerdomain gfx_omap2_pwrdm; | 268 | extern struct powerdomain gfx_omap2_pwrdm; |
255 | 269 | ||
270 | extern void pwrdm_lock(struct powerdomain *pwrdm); | ||
271 | extern void pwrdm_unlock(struct powerdomain *pwrdm); | ||
256 | 272 | ||
257 | #endif | 273 | #endif |