diff options
author | Rajendra Nayak <rnayak@ti.com> | 2008-09-26 08:19:02 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2009-11-11 17:42:24 -0500 |
commit | c96631e13888e9be3a80aae291ed671d4d573ec9 (patch) | |
tree | f27784eb60630d7a3ac64508350967d7c5f97101 | |
parent | 8014078684377257e3a83ac45db95711929850c5 (diff) |
OMAP3: PM: SCM context save/restore
Add context save and restore for the System Control Module to suport
off-mode.
ETK and debobs definitions added by Peter De Schrijver.
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
-rw-r--r-- | arch/arm/mach-omap2/control.c | 157 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/control.h | 49 |
2 files changed, 202 insertions, 4 deletions
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c index 03e1bce3b3bb..3ea417d7a1b5 100644 --- a/arch/arm/mach-omap2/control.c +++ b/arch/arm/mach-omap2/control.c | |||
@@ -26,6 +26,7 @@ | |||
26 | 26 | ||
27 | static void __iomem *omap2_ctrl_base; | 27 | static void __iomem *omap2_ctrl_base; |
28 | 28 | ||
29 | #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM) | ||
29 | struct omap3_scratchpad { | 30 | struct omap3_scratchpad { |
30 | u32 boot_config_ptr; | 31 | u32 boot_config_ptr; |
31 | u32 public_restore_ptr; | 32 | u32 public_restore_ptr; |
@@ -92,6 +93,47 @@ struct omap3_scratchpad_sdrc_block { | |||
92 | */ | 93 | */ |
93 | u32 omap3_arm_context[128]; | 94 | u32 omap3_arm_context[128]; |
94 | 95 | ||
96 | struct omap3_control_regs { | ||
97 | u32 sysconfig; | ||
98 | u32 devconf0; | ||
99 | u32 mem_dftrw0; | ||
100 | u32 mem_dftrw1; | ||
101 | u32 msuspendmux_0; | ||
102 | u32 msuspendmux_1; | ||
103 | u32 msuspendmux_2; | ||
104 | u32 msuspendmux_3; | ||
105 | u32 msuspendmux_4; | ||
106 | u32 msuspendmux_5; | ||
107 | u32 sec_ctrl; | ||
108 | u32 devconf1; | ||
109 | u32 csirxfe; | ||
110 | u32 iva2_bootaddr; | ||
111 | u32 iva2_bootmod; | ||
112 | u32 debobs_0; | ||
113 | u32 debobs_1; | ||
114 | u32 debobs_2; | ||
115 | u32 debobs_3; | ||
116 | u32 debobs_4; | ||
117 | u32 debobs_5; | ||
118 | u32 debobs_6; | ||
119 | u32 debobs_7; | ||
120 | u32 debobs_8; | ||
121 | u32 prog_io0; | ||
122 | u32 prog_io1; | ||
123 | u32 dss_dpll_spreading; | ||
124 | u32 core_dpll_spreading; | ||
125 | u32 per_dpll_spreading; | ||
126 | u32 usbhost_dpll_spreading; | ||
127 | u32 pbias_lite; | ||
128 | u32 temp_sensor; | ||
129 | u32 sramldo4; | ||
130 | u32 sramldo5; | ||
131 | u32 csi; | ||
132 | }; | ||
133 | |||
134 | static struct omap3_control_regs control_context; | ||
135 | #endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */ | ||
136 | |||
95 | #define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg)) | 137 | #define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg)) |
96 | 138 | ||
97 | void __init omap2_set_globals_control(struct omap_globals *omap2_globals) | 139 | void __init omap2_set_globals_control(struct omap_globals *omap2_globals) |
@@ -134,7 +176,7 @@ void omap_ctrl_writel(u32 val, u16 offset) | |||
134 | __raw_writel(val, OMAP_CTRL_REGADDR(offset)); | 176 | __raw_writel(val, OMAP_CTRL_REGADDR(offset)); |
135 | } | 177 | } |
136 | 178 | ||
137 | #ifdef CONFIG_ARCH_OMAP3 | 179 | #if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM) |
138 | /* | 180 | /* |
139 | * Clears the scratchpad contents in case of cold boot- | 181 | * Clears the scratchpad contents in case of cold boot- |
140 | * called during bootup | 182 | * called during bootup |
@@ -264,4 +306,115 @@ void omap3_save_scratchpad_contents(void) | |||
264 | sizeof(sdrc_block_contents), &arm_context_addr, 4); | 306 | sizeof(sdrc_block_contents), &arm_context_addr, 4); |
265 | } | 307 | } |
266 | 308 | ||
267 | #endif /* CONFIG_ARCH_OMAP3 */ | 309 | void omap3_control_save_context(void) |
310 | { | ||
311 | control_context.sysconfig = omap_ctrl_readl(OMAP2_CONTROL_SYSCONFIG); | ||
312 | control_context.devconf0 = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); | ||
313 | control_context.mem_dftrw0 = | ||
314 | omap_ctrl_readl(OMAP343X_CONTROL_MEM_DFTRW0); | ||
315 | control_context.mem_dftrw1 = | ||
316 | omap_ctrl_readl(OMAP343X_CONTROL_MEM_DFTRW1); | ||
317 | control_context.msuspendmux_0 = | ||
318 | omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_0); | ||
319 | control_context.msuspendmux_1 = | ||
320 | omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_1); | ||
321 | control_context.msuspendmux_2 = | ||
322 | omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_2); | ||
323 | control_context.msuspendmux_3 = | ||
324 | omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_3); | ||
325 | control_context.msuspendmux_4 = | ||
326 | omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_4); | ||
327 | control_context.msuspendmux_5 = | ||
328 | omap_ctrl_readl(OMAP2_CONTROL_MSUSPENDMUX_5); | ||
329 | control_context.sec_ctrl = omap_ctrl_readl(OMAP2_CONTROL_SEC_CTRL); | ||
330 | control_context.devconf1 = omap_ctrl_readl(OMAP343X_CONTROL_DEVCONF1); | ||
331 | control_context.csirxfe = omap_ctrl_readl(OMAP343X_CONTROL_CSIRXFE); | ||
332 | control_context.iva2_bootaddr = | ||
333 | omap_ctrl_readl(OMAP343X_CONTROL_IVA2_BOOTADDR); | ||
334 | control_context.iva2_bootmod = | ||
335 | omap_ctrl_readl(OMAP343X_CONTROL_IVA2_BOOTMOD); | ||
336 | control_context.debobs_0 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(0)); | ||
337 | control_context.debobs_1 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(1)); | ||
338 | control_context.debobs_2 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(2)); | ||
339 | control_context.debobs_3 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(3)); | ||
340 | control_context.debobs_4 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(4)); | ||
341 | control_context.debobs_5 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(5)); | ||
342 | control_context.debobs_6 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(6)); | ||
343 | control_context.debobs_7 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(7)); | ||
344 | control_context.debobs_8 = omap_ctrl_readl(OMAP343X_CONTROL_DEBOBS(8)); | ||
345 | control_context.prog_io0 = omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO0); | ||
346 | control_context.prog_io1 = omap_ctrl_readl(OMAP343X_CONTROL_PROG_IO1); | ||
347 | control_context.dss_dpll_spreading = | ||
348 | omap_ctrl_readl(OMAP343X_CONTROL_DSS_DPLL_SPREADING); | ||
349 | control_context.core_dpll_spreading = | ||
350 | omap_ctrl_readl(OMAP343X_CONTROL_CORE_DPLL_SPREADING); | ||
351 | control_context.per_dpll_spreading = | ||
352 | omap_ctrl_readl(OMAP343X_CONTROL_PER_DPLL_SPREADING); | ||
353 | control_context.usbhost_dpll_spreading = | ||
354 | omap_ctrl_readl(OMAP343X_CONTROL_USBHOST_DPLL_SPREADING); | ||
355 | control_context.pbias_lite = | ||
356 | omap_ctrl_readl(OMAP343X_CONTROL_PBIAS_LITE); | ||
357 | control_context.temp_sensor = | ||
358 | omap_ctrl_readl(OMAP343X_CONTROL_TEMP_SENSOR); | ||
359 | control_context.sramldo4 = omap_ctrl_readl(OMAP343X_CONTROL_SRAMLDO4); | ||
360 | control_context.sramldo5 = omap_ctrl_readl(OMAP343X_CONTROL_SRAMLDO5); | ||
361 | control_context.csi = omap_ctrl_readl(OMAP343X_CONTROL_CSI); | ||
362 | return; | ||
363 | } | ||
364 | |||
365 | void omap3_control_restore_context(void) | ||
366 | { | ||
367 | omap_ctrl_writel(control_context.sysconfig, OMAP2_CONTROL_SYSCONFIG); | ||
368 | omap_ctrl_writel(control_context.devconf0, OMAP2_CONTROL_DEVCONF0); | ||
369 | omap_ctrl_writel(control_context.mem_dftrw0, | ||
370 | OMAP343X_CONTROL_MEM_DFTRW0); | ||
371 | omap_ctrl_writel(control_context.mem_dftrw1, | ||
372 | OMAP343X_CONTROL_MEM_DFTRW1); | ||
373 | omap_ctrl_writel(control_context.msuspendmux_0, | ||
374 | OMAP2_CONTROL_MSUSPENDMUX_0); | ||
375 | omap_ctrl_writel(control_context.msuspendmux_1, | ||
376 | OMAP2_CONTROL_MSUSPENDMUX_1); | ||
377 | omap_ctrl_writel(control_context.msuspendmux_2, | ||
378 | OMAP2_CONTROL_MSUSPENDMUX_2); | ||
379 | omap_ctrl_writel(control_context.msuspendmux_3, | ||
380 | OMAP2_CONTROL_MSUSPENDMUX_3); | ||
381 | omap_ctrl_writel(control_context.msuspendmux_4, | ||
382 | OMAP2_CONTROL_MSUSPENDMUX_4); | ||
383 | omap_ctrl_writel(control_context.msuspendmux_5, | ||
384 | OMAP2_CONTROL_MSUSPENDMUX_5); | ||
385 | omap_ctrl_writel(control_context.sec_ctrl, OMAP2_CONTROL_SEC_CTRL); | ||
386 | omap_ctrl_writel(control_context.devconf1, OMAP343X_CONTROL_DEVCONF1); | ||
387 | omap_ctrl_writel(control_context.csirxfe, OMAP343X_CONTROL_CSIRXFE); | ||
388 | omap_ctrl_writel(control_context.iva2_bootaddr, | ||
389 | OMAP343X_CONTROL_IVA2_BOOTADDR); | ||
390 | omap_ctrl_writel(control_context.iva2_bootmod, | ||
391 | OMAP343X_CONTROL_IVA2_BOOTMOD); | ||
392 | omap_ctrl_writel(control_context.debobs_0, OMAP343X_CONTROL_DEBOBS(0)); | ||
393 | omap_ctrl_writel(control_context.debobs_1, OMAP343X_CONTROL_DEBOBS(1)); | ||
394 | omap_ctrl_writel(control_context.debobs_2, OMAP343X_CONTROL_DEBOBS(2)); | ||
395 | omap_ctrl_writel(control_context.debobs_3, OMAP343X_CONTROL_DEBOBS(3)); | ||
396 | omap_ctrl_writel(control_context.debobs_4, OMAP343X_CONTROL_DEBOBS(4)); | ||
397 | omap_ctrl_writel(control_context.debobs_5, OMAP343X_CONTROL_DEBOBS(5)); | ||
398 | omap_ctrl_writel(control_context.debobs_6, OMAP343X_CONTROL_DEBOBS(6)); | ||
399 | omap_ctrl_writel(control_context.debobs_7, OMAP343X_CONTROL_DEBOBS(7)); | ||
400 | omap_ctrl_writel(control_context.debobs_8, OMAP343X_CONTROL_DEBOBS(8)); | ||
401 | omap_ctrl_writel(control_context.prog_io0, OMAP343X_CONTROL_PROG_IO0); | ||
402 | omap_ctrl_writel(control_context.prog_io1, OMAP343X_CONTROL_PROG_IO1); | ||
403 | omap_ctrl_writel(control_context.dss_dpll_spreading, | ||
404 | OMAP343X_CONTROL_DSS_DPLL_SPREADING); | ||
405 | omap_ctrl_writel(control_context.core_dpll_spreading, | ||
406 | OMAP343X_CONTROL_CORE_DPLL_SPREADING); | ||
407 | omap_ctrl_writel(control_context.per_dpll_spreading, | ||
408 | OMAP343X_CONTROL_PER_DPLL_SPREADING); | ||
409 | omap_ctrl_writel(control_context.usbhost_dpll_spreading, | ||
410 | OMAP343X_CONTROL_USBHOST_DPLL_SPREADING); | ||
411 | omap_ctrl_writel(control_context.pbias_lite, | ||
412 | OMAP343X_CONTROL_PBIAS_LITE); | ||
413 | omap_ctrl_writel(control_context.temp_sensor, | ||
414 | OMAP343X_CONTROL_TEMP_SENSOR); | ||
415 | omap_ctrl_writel(control_context.sramldo4, OMAP343X_CONTROL_SRAMLDO4); | ||
416 | omap_ctrl_writel(control_context.sramldo5, OMAP343X_CONTROL_SRAMLDO5); | ||
417 | omap_ctrl_writel(control_context.csi, OMAP343X_CONTROL_CSI); | ||
418 | return; | ||
419 | } | ||
420 | #endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */ | ||
diff --git a/arch/arm/plat-omap/include/plat/control.h b/arch/arm/plat-omap/include/plat/control.h index 1076dd967390..8ca73471ba45 100644 --- a/arch/arm/plat-omap/include/plat/control.h +++ b/arch/arm/plat-omap/include/plat/control.h | |||
@@ -146,8 +146,51 @@ | |||
146 | #define OMAP343X_CONTROL_TEST_KEY_13 (OMAP2_CONTROL_GENERAL + 0x00fc) | 146 | #define OMAP343X_CONTROL_TEST_KEY_13 (OMAP2_CONTROL_GENERAL + 0x00fc) |
147 | #define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190) | 147 | #define OMAP343X_CONTROL_IVA2_BOOTADDR (OMAP2_CONTROL_GENERAL + 0x0190) |
148 | #define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194) | 148 | #define OMAP343X_CONTROL_IVA2_BOOTMOD (OMAP2_CONTROL_GENERAL + 0x0194) |
149 | #define OMAP343X_CONTROL_PBIAS_LITE (OMAP2_CONTROL_GENERAL + 0x02b0) | 149 | #define OMAP343X_CONTROL_DEBOBS(i) (OMAP2_CONTROL_GENERAL + 0x01B0 \ |
150 | #define OMAP343X_CONTROL_TEMP_SENSOR (OMAP2_CONTROL_GENERAL + 0x02b4) | 150 | + ((i) >> 1) * 4 + (!(i) & 1) * 2) |
151 | #define OMAP343X_CONTROL_PROG_IO0 (OMAP2_CONTROL_GENERAL + 0x01D4) | ||
152 | #define OMAP343X_CONTROL_PROG_IO1 (OMAP2_CONTROL_GENERAL + 0x01D8) | ||
153 | #define OMAP343X_CONTROL_DSS_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01E0) | ||
154 | #define OMAP343X_CONTROL_CORE_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01E4) | ||
155 | #define OMAP343X_CONTROL_PER_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01E8) | ||
156 | #define OMAP343X_CONTROL_USBHOST_DPLL_SPREADING (OMAP2_CONTROL_GENERAL + 0x01EC) | ||
157 | #define OMAP343X_CONTROL_PBIAS_LITE (OMAP2_CONTROL_GENERAL + 0x02B0) | ||
158 | #define OMAP343X_CONTROL_TEMP_SENSOR (OMAP2_CONTROL_GENERAL + 0x02B4) | ||
159 | #define OMAP343X_CONTROL_SRAMLDO4 (OMAP2_CONTROL_GENERAL + 0x02B8) | ||
160 | #define OMAP343X_CONTROL_SRAMLDO5 (OMAP2_CONTROL_GENERAL + 0x02C0) | ||
161 | #define OMAP343X_CONTROL_CSI (OMAP2_CONTROL_GENERAL + 0x02C4) | ||
162 | |||
163 | |||
164 | /* 34xx PADCONF register offsets */ | ||
165 | #define OMAP343X_PADCONF_ETK(i) (OMAP2_CONTROL_PADCONFS + 0x5a8 + \ | ||
166 | (i)*2) | ||
167 | #define OMAP343X_PADCONF_ETK_CLK OMAP343X_PADCONF_ETK(0) | ||
168 | #define OMAP343X_PADCONF_ETK_CTL OMAP343X_PADCONF_ETK(1) | ||
169 | #define OMAP343X_PADCONF_ETK_D0 OMAP343X_PADCONF_ETK(2) | ||
170 | #define OMAP343X_PADCONF_ETK_D1 OMAP343X_PADCONF_ETK(3) | ||
171 | #define OMAP343X_PADCONF_ETK_D2 OMAP343X_PADCONF_ETK(4) | ||
172 | #define OMAP343X_PADCONF_ETK_D3 OMAP343X_PADCONF_ETK(5) | ||
173 | #define OMAP343X_PADCONF_ETK_D4 OMAP343X_PADCONF_ETK(6) | ||
174 | #define OMAP343X_PADCONF_ETK_D5 OMAP343X_PADCONF_ETK(7) | ||
175 | #define OMAP343X_PADCONF_ETK_D6 OMAP343X_PADCONF_ETK(8) | ||
176 | #define OMAP343X_PADCONF_ETK_D7 OMAP343X_PADCONF_ETK(9) | ||
177 | #define OMAP343X_PADCONF_ETK_D8 OMAP343X_PADCONF_ETK(10) | ||
178 | #define OMAP343X_PADCONF_ETK_D9 OMAP343X_PADCONF_ETK(11) | ||
179 | #define OMAP343X_PADCONF_ETK_D10 OMAP343X_PADCONF_ETK(12) | ||
180 | #define OMAP343X_PADCONF_ETK_D11 OMAP343X_PADCONF_ETK(13) | ||
181 | #define OMAP343X_PADCONF_ETK_D12 OMAP343X_PADCONF_ETK(14) | ||
182 | #define OMAP343X_PADCONF_ETK_D13 OMAP343X_PADCONF_ETK(15) | ||
183 | #define OMAP343X_PADCONF_ETK_D14 OMAP343X_PADCONF_ETK(16) | ||
184 | #define OMAP343X_PADCONF_ETK_D15 OMAP343X_PADCONF_ETK(17) | ||
185 | |||
186 | /* 34xx GENERAL_WKUP regist offsets */ | ||
187 | #define OMAP343X_CONTROL_WKUP_DEBOBSMUX(i) (OMAP343X_CONTROL_GENERAL_WKUP + \ | ||
188 | 0x008 + (i)) | ||
189 | #define OMAP343X_CONTROL_WKUP_DEBOBS0 (OMAP343X_CONTROL_GENERAL_WKUP + 0x008) | ||
190 | #define OMAP343X_CONTROL_WKUP_DEBOBS1 (OMAP343X_CONTROL_GENERAL_WKUP + 0x00C) | ||
191 | #define OMAP343X_CONTROL_WKUP_DEBOBS2 (OMAP343X_CONTROL_GENERAL_WKUP + 0x010) | ||
192 | #define OMAP343X_CONTROL_WKUP_DEBOBS3 (OMAP343X_CONTROL_GENERAL_WKUP + 0x014) | ||
193 | #define OMAP343X_CONTROL_WKUP_DEBOBS4 (OMAP343X_CONTROL_GENERAL_WKUP + 0x018) | ||
151 | 194 | ||
152 | /* 34xx D2D idle-related pins, handled by PM core */ | 195 | /* 34xx D2D idle-related pins, handled by PM core */ |
153 | #define OMAP3_PADCONF_SAD2D_MSTANDBY 0x250 | 196 | #define OMAP3_PADCONF_SAD2D_MSTANDBY 0x250 |
@@ -226,6 +269,8 @@ extern void omap3_save_scratchpad_contents(void); | |||
226 | extern void omap3_clear_scratchpad_contents(void); | 269 | extern void omap3_clear_scratchpad_contents(void); |
227 | extern u32 *get_restore_pointer(void); | 270 | extern u32 *get_restore_pointer(void); |
228 | extern u32 omap3_arm_context[128]; | 271 | extern u32 omap3_arm_context[128]; |
272 | extern void omap3_control_save_context(void); | ||
273 | extern void omap3_control_restore_context(void); | ||
229 | 274 | ||
230 | #else | 275 | #else |
231 | #define omap_ctrl_base_get() 0 | 276 | #define omap_ctrl_base_get() 0 |