From 959392911781f3bd4263a01d703097998d0aaa0f Mon Sep 17 00:00:00 2001 From: Anson Huang Date: Tue, 19 Jun 2018 11:16:33 +0800 Subject: imx8qxp: support SC_R_IRQSTR_SCU2 OFF in system suspend SC_R_IRQSTR_SCU2 can be OFF in system suspend if there is no wakeup irq enabled from non-secure OS partion. Add wakeup source check to decide if turning off SC_R_IRQSTR_SCU2 or NOT when suspend. Signed-off-by: Anson Huang --- plat/imx/common/include/fsl_sip.h | 4 ++++ plat/imx/common/sip_svc.c | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) (limited to 'plat/imx/common') diff --git a/plat/imx/common/include/fsl_sip.h b/plat/imx/common/include/fsl_sip.h index 24b8eb31..004349c1 100644 --- a/plat/imx/common/include/fsl_sip.h +++ b/plat/imx/common/include/fsl_sip.h @@ -48,4 +48,8 @@ #define FSL_SIP_NOC 0xc2000008 #define FSL_SIP_NOC_LCDIF 0x0 +#define FSL_SIP_WAKEUP_SRC 0xc2000009 +#define FSL_SIP_WAKEUP_SRC_SCU 0x1 +#define FSL_SIP_WAKEUP_SRC_IRQSTEER 0x2 + #endif diff --git a/plat/imx/common/sip_svc.c b/plat/imx/common/sip_svc.c index 02728556..bf774722 100644 --- a/plat/imx/common/sip_svc.c +++ b/plat/imx/common/sip_svc.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -25,6 +26,8 @@ extern int imx_soc_handler(uint32_t smc_fid, u_register_t x1, u_register_t x2, u extern int imx_hab_handler(uint32_t smc_fid, u_register_t x1, u_register_t x2, u_register_t x3, u_register_t x4); extern int imx_noc_handler(uint32_t smc_fid, u_register_t x1, u_register_t x2, u_register_t x3); +bool wakeup_src_irqsteer = false; + /* Setup i.MX platform specific services Services */ static int32_t plat_svc_setup(void) { @@ -76,6 +79,27 @@ uint64_t imx_buildinfo_handler(uint32_t smc_fid, return ret; } +int imx_wakeup_src_handler(uint32_t smc_fid, + u_register_t x1, + u_register_t x2, + u_register_t x3) +{ + uint64_t ret; + + switch(x1) { + case FSL_SIP_WAKEUP_SRC_IRQSTEER: + wakeup_src_irqsteer = true; + break; + case FSL_SIP_WAKEUP_SRC_SCU: + wakeup_src_irqsteer = false; + break; + default: + return SMC_UNK; + } + + return ret; +} + /* i.MX platform specific service SMC handler */ uintptr_t imx_svc_smc_handler(uint32_t smc_fid, @@ -116,6 +140,9 @@ uintptr_t imx_svc_smc_handler(uint32_t smc_fid, break; case FSL_SIP_SRTC: return imx_srtc_handler(smc_fid, handle, x1, x2, x3, x4); + case FSL_SIP_WAKEUP_SRC: + SMC_RET1(handle, imx_wakeup_src_handler(smc_fid, x1, x2, x3)); + break; #endif case FSL_SIP_BUILDINFO: SMC_RET1(handle, imx_buildinfo_handler(smc_fid, x1, x2, x3, x4)); -- cgit v1.2.3