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 /arch/arm/mach-omap2/control.c | |
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>
Diffstat (limited to 'arch/arm/mach-omap2/control.c')
-rw-r--r-- | arch/arm/mach-omap2/control.c | 157 |
1 files changed, 155 insertions, 2 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 */ | ||