Commit 9d97140b authored by Tero Kristo's avatar Tero Kristo Committed by Kevin Hilman

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: default avatarTero Kristo <tero.kristo@nokia.com>
Signed-off-by: default avatarRoger Quadros <ext-roger.quadros@nokia.com>
Signed-off-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
parent 27d59a4a
...@@ -112,6 +112,12 @@ static void omap3_core_restore_context(void) ...@@ -112,6 +112,12 @@ static void omap3_core_restore_context(void)
omap_dma_global_context_restore(); omap_dma_global_context_restore();
} }
/*
* FIXME: This function should be called before entering off-mode after
* OMAP3 secure services have been accessed. Currently it is only called
* once during boot sequence, but this works as we are not using secure
* services.
*/
static void omap3_save_secure_ram_context(u32 target_mpu_state) static void omap3_save_secure_ram_context(u32 target_mpu_state)
{ {
u32 ret; u32 ret;
...@@ -337,7 +343,6 @@ static void omap_sram_idle(void) ...@@ -337,7 +343,6 @@ static void omap_sram_idle(void)
if (core_next_state == PWRDM_POWER_OFF) { if (core_next_state == PWRDM_POWER_OFF) {
omap3_core_save_context(); omap3_core_save_context();
omap3_prcm_save_context(); omap3_prcm_save_context();
omap3_save_secure_ram_context(mpu_next_state);
} }
/* Enable IO-PAD wakeup */ /* Enable IO-PAD wakeup */
prm_set_mod_reg_bits(OMAP3430_EN_IO, WKUP_MOD, PM_WKEN); prm_set_mod_reg_bits(OMAP3430_EN_IO, WKUP_MOD, PM_WKEN);
...@@ -999,9 +1004,19 @@ static int __init omap3_pm_init(void) ...@@ -999,9 +1004,19 @@ static int __init omap3_pm_init(void)
if (!omap3_secure_ram_storage) if (!omap3_secure_ram_storage)
printk(KERN_ERR "Memory allocation failed when" printk(KERN_ERR "Memory allocation failed when"
"allocating for secure sram context\n"); "allocating for secure sram context\n");
local_irq_disable();
local_fiq_disable();
omap_dma_global_context_save();
omap3_save_secure_ram_context(PWRDM_POWER_ON);
omap_dma_global_context_restore();
local_irq_enable();
local_fiq_enable();
} }
omap3_save_scratchpad_contents();
omap3_save_scratchpad_contents();
err1: err1:
return ret; return ret;
err2: err2:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment