diff options
author | Tero Kristo <tero.kristo@nokia.com> | 2008-12-12 04:20:05 -0500 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2009-11-11 17:42:25 -0500 |
commit | 9d97140bd0c5da55f174a81dafd2bbef135f5748 (patch) | |
tree | c93788037876eeee65b6da93eadb5e7286a4acf8 | |
parent | 27d59a4a2def42307349079f2e3538d96934c379 (diff) |
OMAP3: PM: save secure RAM only during init
The function omap3_save_secure_ram() is now called only once during
the initialization of the device and consequent sleep cycles will
re-use the same saved contents for secure RAM. Users who need secure
services should do secure RAM saving before entering off-mode, if a
secure service has been accessed after last save.
There are both latency and reliability issues with saving secure RAM
context in the idle path. The context save uses a hardware resource
which takes an order of hundreds of milliseconds to initialize after a
wake up from off-mode, and also there is no way of checking whether it
is ready from kernel side or not. It just crashes if you use it too
quickly
Additional fix to ensure scratchpad save is done after secure
RAM by Roger Quadros.
Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
Signed-off-by: Roger Quadros <ext-roger.quadros@nokia.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
-rw-r--r-- | arch/arm/mach-omap2/pm34xx.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index ebb88f3aae31..310c189efb5d 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c | |||
@@ -112,6 +112,12 @@ static void omap3_core_restore_context(void) | |||
112 | omap_dma_global_context_restore(); | 112 | omap_dma_global_context_restore(); |
113 | } | 113 | } |
114 | 114 | ||
115 | /* | ||
116 | * FIXME: This function should be called before entering off-mode after | ||
117 | * OMAP3 secure services have been accessed. Currently it is only called | ||
118 | * once during boot sequence, but this works as we are not using secure | ||
119 | * services. | ||
120 | */ | ||
115 | static void omap3_save_secure_ram_context(u32 target_mpu_state) | 121 | static void omap3_save_secure_ram_context(u32 target_mpu_state) |
116 | { | 122 | { |
117 | u32 ret; | 123 | u32 ret; |
@@ -337,7 +343,6 @@ static void omap_sram_idle(void) | |||
337 | if (core_next_state == PWRDM_POWER_OFF) { | 343 | if (core_next_state == PWRDM_POWER_OFF) { |
338 | omap3_core_save_context(); | 344 | omap3_core_save_context(); |
339 | omap3_prcm_save_context(); | 345 | omap3_prcm_save_context(); |
340 | omap3_save_secure_ram_context(mpu_next_state); | ||
341 | } | 346 | } |
342 | /* Enable IO-PAD wakeup */ | 347 | /* Enable IO-PAD wakeup */ |
343 | prm_set_mod_reg_bits(OMAP3430_EN_IO, WKUP_MOD, PM_WKEN); | 348 | prm_set_mod_reg_bits(OMAP3430_EN_IO, WKUP_MOD, PM_WKEN); |
@@ -999,9 +1004,19 @@ static int __init omap3_pm_init(void) | |||
999 | if (!omap3_secure_ram_storage) | 1004 | if (!omap3_secure_ram_storage) |
1000 | printk(KERN_ERR "Memory allocation failed when" | 1005 | printk(KERN_ERR "Memory allocation failed when" |
1001 | "allocating for secure sram context\n"); | 1006 | "allocating for secure sram context\n"); |
1007 | |||
1008 | local_irq_disable(); | ||
1009 | local_fiq_disable(); | ||
1010 | |||
1011 | omap_dma_global_context_save(); | ||
1012 | omap3_save_secure_ram_context(PWRDM_POWER_ON); | ||
1013 | omap_dma_global_context_restore(); | ||
1014 | |||
1015 | local_irq_enable(); | ||
1016 | local_fiq_enable(); | ||
1002 | } | 1017 | } |
1003 | omap3_save_scratchpad_contents(); | ||
1004 | 1018 | ||
1019 | omap3_save_scratchpad_contents(); | ||
1005 | err1: | 1020 | err1: |
1006 | return ret; | 1021 | return ret; |
1007 | err2: | 1022 | err2: |