summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnson Huang <Anson.Huang@nxp.com>2017-09-15 15:26:30 +0800
committerAnson Huang <Anson.Huang@nxp.com>2017-09-15 15:26:30 +0800
commite5af91bbf430815b993c98f207d9f119165b1846 (patch)
tree8d4c311fa73d0d7fae8b016c37a694b293f229cf
parent0a9efa7fafe8d1cc6a36e813e53cced22ed7171e (diff)
imx8qm/imx8qxp: enable standby suspend
As suspend with last CPU power down needs SCFW support, and it is NOT ready now, in order to enable kernel suspend function earlier for modules to start debugging suspend resume function, this patch adds standby suspend for now. Will add last CPU power down suspend function when SCFW is ready. Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
-rw-r--r--lib/psci/psci_main.c8
-rw-r--r--lib/psci/psci_suspend.c13
-rw-r--r--plat/freescale/imx8qm/include/platform_def.h2
-rw-r--r--plat/freescale/imx8qxp/include/platform_def.h2
4 files changed, 25 insertions, 0 deletions
diff --git a/lib/psci/psci_main.c b/lib/psci/psci_main.c
index 2f42b812..5cdc1afd 100644
--- a/lib/psci/psci_main.c
+++ b/lib/psci/psci_main.c
@@ -182,10 +182,18 @@ int psci_system_suspend(uintptr_t entrypoint, u_register_t context_id)
* might return if the power down was abandoned for any reason, e.g.
* arrival of an interrupt
*/
+
+#ifdef SYSTEM_SUSPEND_USE_STANDBY
+ psci_cpu_suspend_start(&ep,
+ PLAT_MAX_PWR_LVL,
+ &state_info,
+ PSTATE_TYPE_STANDBY);
+#else
psci_cpu_suspend_start(&ep,
PLAT_MAX_PWR_LVL,
&state_info,
PSTATE_TYPE_POWERDOWN);
+#endif
return PSCI_E_SUCCESS;
}
diff --git a/lib/psci/psci_suspend.c b/lib/psci/psci_suspend.c
index 47988926..a9428ba1 100644
--- a/lib/psci/psci_suspend.c
+++ b/lib/psci/psci_suspend.c
@@ -234,8 +234,21 @@ exit:
* requested at multiple power levels. This means that the cpu
* context will be preserved.
*/
+
+#ifdef SYSTEM_SUSPEND_USE_STANDBY
+ write_icc_igrpen1_el1(1);
+ write_scr_el3(read_scr_el3() | 0x4);
+ isb();
+#endif
+
wfi();
+#ifdef SYSTEM_SUSPEND_USE_STANDBY
+ write_icc_igrpen1_el1(0);
+ write_scr_el3(read_scr_el3() & (~0x4));
+ isb();
+#endif
+
#if ENABLE_PSCI_STAT
plat_psci_stat_accounting_stop(state_info);
psci_stats_update_pwr_up(end_pwrlvl, state_info);
diff --git a/plat/freescale/imx8qm/include/platform_def.h b/plat/freescale/imx8qm/include/platform_def.h
index ab3c9e27..0f3aad8f 100644
--- a/plat/freescale/imx8qm/include/platform_def.h
+++ b/plat/freescale/imx8qm/include/platform_def.h
@@ -83,6 +83,8 @@
#define COUNTER_FREQUENCY 8000000 /* 8MHz */
+#define SYSTEM_SUSPEND_USE_STANDBY 1
+
#define DEBUG_CONSOLE 0
#define DEBUG_CONSOLE_A53 0
#define PLAT_IMX8QM 1
diff --git a/plat/freescale/imx8qxp/include/platform_def.h b/plat/freescale/imx8qxp/include/platform_def.h
index 50f77b16..717f693d 100644
--- a/plat/freescale/imx8qxp/include/platform_def.h
+++ b/plat/freescale/imx8qxp/include/platform_def.h
@@ -75,6 +75,8 @@
#define COUNTER_FREQUENCY 8000000 /* 8MHz */
+#define SYSTEM_SUSPEND_USE_STANDBY 1
+
#define DEBUG_CONSOLE 0
#define DEBUG_CONSOLE_A35 0
#define PLAT_IMX8QXP 1