Commit ebdbc25b authored by Anson Huang's avatar Anson Huang
Browse files

imx: add wakeup source SIP runtime service support



On i.MX8QM/i.MX8QX with system controller inside, the wakeup
source is managed in SCFW(system controller firmware), if the
wakeup source is belonged to system controller partition, then
before Linux suspend, the wakeup source should be set to
SC_PM_WAKE_SRC_SCU, and if the wakeup source is belonged to
Cortex-A partition, the wakeup source should be set to
SC_PM_WAKE_SRC_IRQSTEER, so need to add wakeup source SIP runtime
service to get Linux kernel's wakeup source and set the correct
wakeup source for system controller.
Signed-off-by: default avatarAnson Huang <Anson.Huang@nxp.com>
parent 023bc019
...@@ -76,3 +76,29 @@ int imx_cpufreq_handler(uint32_t smc_fid, ...@@ -76,3 +76,29 @@ int imx_cpufreq_handler(uint32_t smc_fid,
return 0; return 0;
} }
static bool wakeup_src_irqsteer;
bool imx_is_wakeup_src_irqsteer(void)
{
return wakeup_src_irqsteer;
}
int imx_wakeup_src_handler(uint32_t smc_fid,
u_register_t x1,
u_register_t x2,
u_register_t x3)
{
switch (x1) {
case IMX_SIP_WAKEUP_SRC_IRQSTEER:
wakeup_src_irqsteer = true;
break;
case IMX_SIP_WAKEUP_SRC_SCU:
wakeup_src_irqsteer = false;
break;
default:
return SMC_UNK;
}
return SMC_OK;
}
...@@ -32,6 +32,8 @@ static uintptr_t imx_sip_handler(unsigned int smc_fid, ...@@ -32,6 +32,8 @@ static uintptr_t imx_sip_handler(unsigned int smc_fid,
case IMX_SIP_CPUFREQ: case IMX_SIP_CPUFREQ:
SMC_RET1(handle, imx_cpufreq_handler(smc_fid, x1, x2, x3)); SMC_RET1(handle, imx_cpufreq_handler(smc_fid, x1, x2, x3));
break; break;
case IMX_SIP_WAKEUP_SRC:
SMC_RET1(handle, imx_wakeup_src_handler(smc_fid, x1, x2, x3));
#endif #endif
default: default:
WARN("Unimplemented i.MX SiP Service Call: 0x%x\n", smc_fid); WARN("Unimplemented i.MX SiP Service Call: 0x%x\n", smc_fid);
......
...@@ -14,11 +14,17 @@ ...@@ -14,11 +14,17 @@
#define IMX_SIP_SRTC 0xC2000002 #define IMX_SIP_SRTC 0xC2000002
#define IMX_SIP_SRTC_SET_TIME 0x00 #define IMX_SIP_SRTC_SET_TIME 0x00
#define IMX_SIP_WAKEUP_SRC 0xC2000009
#define IMX_SIP_WAKEUP_SRC_SCU 0x1
#define IMX_SIP_WAKEUP_SRC_IRQSTEER 0x2
#if (defined(PLAT_IMX8QM) || defined(PLAT_IMX8QX)) #if (defined(PLAT_IMX8QM) || defined(PLAT_IMX8QX))
int imx_cpufreq_handler(uint32_t smc_fid, u_register_t x1, int imx_cpufreq_handler(uint32_t smc_fid, u_register_t x1,
u_register_t x2, u_register_t x3); u_register_t x2, u_register_t x3);
int imx_srtc_handler(uint32_t smc_fid, void *handle, u_register_t x1, int imx_srtc_handler(uint32_t smc_fid, void *handle, u_register_t x1,
u_register_t x2, u_register_t x3, u_register_t x4); u_register_t x2, u_register_t x3, u_register_t x4);
int imx_wakeup_src_handler(uint32_t smc_fid, u_register_t x1,
u_register_t x2, u_register_t x3);
#endif #endif
#endif /* __IMX_SIP_SVC_H__ */ #endif /* __IMX_SIP_SVC_H__ */
...@@ -23,5 +23,6 @@ void __dead2 imx_system_reset(void); ...@@ -23,5 +23,6 @@ void __dead2 imx_system_reset(void);
int imx_validate_power_state(unsigned int power_state, int imx_validate_power_state(unsigned int power_state,
psci_power_state_t *req_state); psci_power_state_t *req_state);
void imx_get_sys_suspend_power_state(psci_power_state_t *req_state); void imx_get_sys_suspend_power_state(psci_power_state_t *req_state);
bool imx_is_wakeup_src_irqsteer(void);
#endif /* PLAT_IMX8_H */ #endif /* PLAT_IMX8_H */
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