aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorTero Kristo <t-kristo@ti.com>2012-09-23 19:28:19 -0400
committerPaul Walmsley <paul@pwsan.com>2012-09-23 19:28:19 -0400
commit5b8a14be513ca1172c72ec181a5e22ec18fb7bf5 (patch)
treefc6d85078409b5e72d56dac8b5fec060abc81fa5 /arch
parent3bb05dbf69018177c06ee09011e2d8bd183dd2ba (diff)
ARM: OMAP4: powerdomain: add support for reading prev logic and mem states
On OMAP4, there is no support to read previous logic state or previous memory state achieved when a power domain transitions to RET. Instead there are module level context registers. In order to support the powerdomain level logic/mem_off_counters on OMAP4, instead use the previous power state achieved (RET) and the *programmed* logic/mem RET state to derive if a powerdomain lost logic or did not. If the powerdomain is programmed to enter RET state and lose logic in RET state, knowing that the powerdomain entered RET is good enough to derive that the logic was lost as well, in such cases. Signed-off-by: Tero Kristo <t-kristo@ti.com> [paul@pwsan.com: removed dependency on functional power state series for now; bumped copyright date] Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/powerdomain44xx.c61
1 files changed, 60 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/powerdomain44xx.c b/arch/arm/mach-omap2/powerdomain44xx.c
index aeac6f35ca10..aceb4f464c9b 100644
--- a/arch/arm/mach-omap2/powerdomain44xx.c
+++ b/arch/arm/mach-omap2/powerdomain44xx.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP4 powerdomain control 2 * OMAP4 powerdomain control
3 * 3 *
4 * Copyright (C) 2009-2010 Texas Instruments, Inc. 4 * Copyright (C) 2009-2010, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2007-2009 Nokia Corporation 5 * Copyright (C) 2007-2009 Nokia Corporation
6 * 6 *
7 * Derived from mach-omap2/powerdomain.c written by Paul Walmsley 7 * Derived from mach-omap2/powerdomain.c written by Paul Walmsley
@@ -151,6 +151,34 @@ static int omap4_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
151 return v; 151 return v;
152} 152}
153 153
154/**
155 * omap4_pwrdm_read_prev_logic_pwrst - read the previous logic powerstate
156 * @pwrdm: struct powerdomain * to read the state for
157 *
158 * Reads the previous logic powerstate for a powerdomain. This
159 * function must determine the previous logic powerstate by first
160 * checking the previous powerstate for the domain. If that was OFF,
161 * then logic has been lost. If previous state was RETENTION, the
162 * function reads the setting for the next retention logic state to
163 * see the actual value. In every other case, the logic is
164 * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET
165 * depending whether the logic was retained or not.
166 */
167static int omap4_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
168{
169 int state;
170
171 state = omap4_pwrdm_read_prev_pwrst(pwrdm);
172
173 if (state == PWRDM_POWER_OFF)
174 return PWRDM_POWER_OFF;
175
176 if (state != PWRDM_POWER_RET)
177 return PWRDM_POWER_RET;
178
179 return omap4_pwrdm_read_logic_retst(pwrdm);
180}
181
154static int omap4_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank) 182static int omap4_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
155{ 183{
156 u32 m, v; 184 u32 m, v;
@@ -179,6 +207,35 @@ static int omap4_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
179 return v; 207 return v;
180} 208}
181 209
210/**
211 * omap4_pwrdm_read_prev_mem_pwrst - reads the previous memory powerstate
212 * @pwrdm: struct powerdomain * to read mem powerstate for
213 * @bank: memory bank index
214 *
215 * Reads the previous memory powerstate for a powerdomain. This
216 * function must determine the previous memory powerstate by first
217 * checking the previous powerstate for the domain. If that was OFF,
218 * then logic has been lost. If previous state was RETENTION, the
219 * function reads the setting for the next memory retention state to
220 * see the actual value. In every other case, the logic is
221 * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET
222 * depending whether logic was retained or not.
223 */
224static int omap4_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
225{
226 int state;
227
228 state = omap4_pwrdm_read_prev_pwrst(pwrdm);
229
230 if (state == PWRDM_POWER_OFF)
231 return PWRDM_POWER_OFF;
232
233 if (state != PWRDM_POWER_RET)
234 return PWRDM_POWER_RET;
235
236 return omap4_pwrdm_read_mem_retst(pwrdm, bank);
237}
238
182static int omap4_pwrdm_wait_transition(struct powerdomain *pwrdm) 239static int omap4_pwrdm_wait_transition(struct powerdomain *pwrdm)
183{ 240{
184 u32 c = 0; 241 u32 c = 0;
@@ -217,9 +274,11 @@ struct pwrdm_ops omap4_pwrdm_operations = {
217 .pwrdm_clear_all_prev_pwrst = omap4_pwrdm_clear_all_prev_pwrst, 274 .pwrdm_clear_all_prev_pwrst = omap4_pwrdm_clear_all_prev_pwrst,
218 .pwrdm_set_logic_retst = omap4_pwrdm_set_logic_retst, 275 .pwrdm_set_logic_retst = omap4_pwrdm_set_logic_retst,
219 .pwrdm_read_logic_pwrst = omap4_pwrdm_read_logic_pwrst, 276 .pwrdm_read_logic_pwrst = omap4_pwrdm_read_logic_pwrst,
277 .pwrdm_read_prev_logic_pwrst = omap4_pwrdm_read_prev_logic_pwrst,
220 .pwrdm_read_logic_retst = omap4_pwrdm_read_logic_retst, 278 .pwrdm_read_logic_retst = omap4_pwrdm_read_logic_retst,
221 .pwrdm_read_mem_pwrst = omap4_pwrdm_read_mem_pwrst, 279 .pwrdm_read_mem_pwrst = omap4_pwrdm_read_mem_pwrst,
222 .pwrdm_read_mem_retst = omap4_pwrdm_read_mem_retst, 280 .pwrdm_read_mem_retst = omap4_pwrdm_read_mem_retst,
281 .pwrdm_read_prev_mem_pwrst = omap4_pwrdm_read_prev_mem_pwrst,
223 .pwrdm_set_mem_onst = omap4_pwrdm_set_mem_onst, 282 .pwrdm_set_mem_onst = omap4_pwrdm_set_mem_onst,
224 .pwrdm_set_mem_retst = omap4_pwrdm_set_mem_retst, 283 .pwrdm_set_mem_retst = omap4_pwrdm_set_mem_retst,
225 .pwrdm_wait_transition = omap4_pwrdm_wait_transition, 284 .pwrdm_wait_transition = omap4_pwrdm_wait_transition,