aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/pm34xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/pm34xx.c')
-rw-r--r--arch/arm/mach-omap2/pm34xx.c47
1 files changed, 10 insertions, 37 deletions
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index c155c9d1c82c..ae4017750bbe 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -40,8 +40,6 @@
40#include <plat/gpmc.h> 40#include <plat/gpmc.h>
41#include <plat/dma.h> 41#include <plat/dma.h>
42 42
43#include <asm/tlbflush.h>
44
45#include "cm2xxx_3xxx.h" 43#include "cm2xxx_3xxx.h"
46#include "cm-regbits-34xx.h" 44#include "cm-regbits-34xx.h"
47#include "prm-regbits-34xx.h" 45#include "prm-regbits-34xx.h"
@@ -64,11 +62,6 @@ static inline bool is_suspending(void)
64} 62}
65#endif 63#endif
66 64
67/* Scratchpad offsets */
68#define OMAP343X_TABLE_ADDRESS_OFFSET 0xc4
69#define OMAP343X_TABLE_VALUE_OFFSET 0xc0
70#define OMAP343X_CONTROL_REG_VALUE_OFFSET 0xc8
71
72/* pm34xx errata defined in pm.h */ 65/* pm34xx errata defined in pm.h */
73u16 pm34xx_errata; 66u16 pm34xx_errata;
74 67
@@ -312,28 +305,9 @@ static irqreturn_t prcm_interrupt_handler (int irq, void *dev_id)
312 return IRQ_HANDLED; 305 return IRQ_HANDLED;
313} 306}
314 307
315/* Function to restore the table entry that was modified for enabling MMU */ 308static void omap34xx_do_sram_idle(unsigned long save_state)
316static void restore_table_entry(void)
317{ 309{
318 void __iomem *scratchpad_address; 310 _omap_sram_idle(omap3_arm_context, save_state);
319 u32 previous_value, control_reg_value;
320 u32 *address;
321
322 scratchpad_address = OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD);
323
324 /* Get address of entry that was modified */
325 address = (u32 *)__raw_readl(scratchpad_address +
326 OMAP343X_TABLE_ADDRESS_OFFSET);
327 /* Get the previous value which needs to be restored */
328 previous_value = __raw_readl(scratchpad_address +
329 OMAP343X_TABLE_VALUE_OFFSET);
330 address = __va(address);
331 *address = previous_value;
332 flush_tlb_all();
333 control_reg_value = __raw_readl(scratchpad_address
334 + OMAP343X_CONTROL_REG_VALUE_OFFSET);
335 /* This will enable caches and prediction */
336 set_cr(control_reg_value);
337} 311}
338 312
339void omap_sram_idle(void) 313void omap_sram_idle(void)
@@ -432,12 +406,15 @@ void omap_sram_idle(void)
432 sdrc_pwr = sdrc_read_reg(SDRC_POWER); 406 sdrc_pwr = sdrc_read_reg(SDRC_POWER);
433 407
434 /* 408 /*
435 * omap3_arm_context is the location where ARM registers 409 * omap3_arm_context is the location where some ARM context
436 * get saved. The restore path then reads from this 410 * get saved. The rest is placed on the stack, and restored
437 * location and restores them back. 411 * from there before resuming.
438 */ 412 */
439 _omap_sram_idle(omap3_arm_context, save_state); 413 if (save_state == 1 || save_state == 3)
440 cpu_init(); 414 cpu_suspend(0, PHYS_OFFSET - PAGE_OFFSET, save_state,
415 omap34xx_do_sram_idle);
416 else
417 omap34xx_do_sram_idle(save_state);
441 418
442 /* Restore normal SDRC POWER settings */ 419 /* Restore normal SDRC POWER settings */
443 if (omap_rev() >= OMAP3430_REV_ES3_0 && 420 if (omap_rev() >= OMAP3430_REV_ES3_0 &&
@@ -445,10 +422,6 @@ void omap_sram_idle(void)
445 core_next_state == PWRDM_POWER_OFF) 422 core_next_state == PWRDM_POWER_OFF)
446 sdrc_write_reg(sdrc_pwr, SDRC_POWER); 423 sdrc_write_reg(sdrc_pwr, SDRC_POWER);
447 424
448 /* Restore table entry modified during MMU restoration */
449 if (pwrdm_read_prev_pwrst(mpu_pwrdm) == PWRDM_POWER_OFF)
450 restore_table_entry();
451
452 /* CORE */ 425 /* CORE */
453 if (core_next_state < PWRDM_POWER_ON) { 426 if (core_next_state < PWRDM_POWER_ON) {
454 core_prev_state = pwrdm_read_prev_pwrst(core_pwrdm); 427 core_prev_state = pwrdm_read_prev_pwrst(core_pwrdm);