]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - arch/arm/mach-omap2/pm33xx-core.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
[linux.git] / arch / arm / mach-omap2 / pm33xx-core.c
index f11442ed3efff29869be77daf7759f29f0cd1569..7461b0346549086d9b47540f413ae79ec7f53fe5 100644 (file)
@@ -28,6 +28,7 @@
 #include "prm33xx.h"
 #include "soc.h"
 #include "sram.h"
+#include "omap-secure.h"
 
 static struct powerdomain *cefuse_pwrdm, *gfx_pwrdm, *per_pwrdm, *mpu_pwrdm;
 static struct clockdomain *gfx_l4ls_clkdm;
@@ -166,6 +167,16 @@ static int am43xx_suspend(unsigned int state, int (*fn)(unsigned long),
 {
        int ret = 0;
 
+       /* Suspend secure side on HS devices */
+       if (omap_type() != OMAP2_DEVICE_TYPE_GP) {
+               if (optee_available)
+                       omap_smccc_smc(AM43xx_PPA_SVC_PM_SUSPEND, 0);
+               else
+                       omap_secure_dispatcher(AM43xx_PPA_SVC_PM_SUSPEND,
+                                              FLAG_START_CRITICAL,
+                                              0, 0, 0, 0, 0);
+       }
+
        amx3_pre_suspend_common();
        scu_power_mode(scu_base, SCU_PM_POWEROFF);
        ret = cpu_suspend(args, fn);
@@ -174,6 +185,19 @@ static int am43xx_suspend(unsigned int state, int (*fn)(unsigned long),
        if (!am43xx_check_off_mode_enable())
                amx3_post_suspend_common();
 
+       /*
+        * Resume secure side on HS devices.
+        *
+        * Note that even on systems with OP-TEE available this resume call is
+        * issued to the ROM. This is because upon waking from suspend the ROM
+        * is restored as the secure monitor. On systems with OP-TEE ROM will
+        * restore OP-TEE during this call.
+        */
+       if (omap_type() != OMAP2_DEVICE_TYPE_GP)
+               omap_secure_dispatcher(AM43xx_PPA_SVC_PM_RESUME,
+                                      FLAG_START_CRITICAL,
+                                      0, 0, 0, 0, 0);
+
        return ret;
 }