diff options
author | Robin Gong <yibin.gong@nxp.com> | 2017-10-27 10:13:46 +0800 |
---|---|---|
committer | Abel Vesa <abel.vesa@nxp.com> | 2018-06-11 10:08:40 +0300 |
commit | f62d4ae081d935ac0c77534b28445b0db157d041 (patch) | |
tree | e76d1b07d95353561696d231c4c4e2af29ec31d1 /plat/imx/common/srtc.c | |
parent | 905204763cb18b899b261fe893dd6e889e0fcb8d (diff) |
imx8qm/qxp: add watchdog sip interfaces
To support virtual watchdog driver in Linux, add those watchdog functions
to call scfw interface in ATF.
Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Diffstat (limited to 'plat/imx/common/srtc.c')
-rw-r--r-- | plat/imx/common/srtc.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/plat/imx/common/srtc.c b/plat/imx/common/srtc.c index 0a32d65b..56b32a92 100644 --- a/plat/imx/common/srtc.c +++ b/plat/imx/common/srtc.c @@ -48,6 +48,20 @@ static int imx_srtc_set_time(uint32_t year_mon, unsigned long day_hour, unsigned min_sec >> 16, min_sec & 0xffff); } +static int imx_srtc_set_wdog_action(uint32_t x2) +{ + sc_rm_pt_t secure_part; + sc_err_t err; + + err = sc_rm_get_partition(ipc_handle, &secure_part); + if (err) + return err; + + err = sc_timer_set_wdog_action(ipc_handle, secure_part, x2); + + return err; +} + int imx_srtc_handler(uint32_t smc_fid, u_register_t x1, u_register_t x2, @@ -60,6 +74,21 @@ int imx_srtc_handler(uint32_t smc_fid, case FSL_SIP_SRTC_SET_TIME: ret = imx_srtc_set_time(x2, x3, x4); break; + case FSL_SIP_SRTC_START_WDOG: + ret = sc_timer_start_wdog(ipc_handle, !!x2); + break; + case FSL_SIP_SRTC_STOP_WDOG: + ret = sc_timer_stop_wdog(ipc_handle); + break; + case FSL_SIP_SRTC_SET_WDOG_ACT: + ret = imx_srtc_set_wdog_action(x2); + break; + case FSL_SIP_SRTC_PING_WDOG: + ret = sc_timer_ping_wdog(ipc_handle); + break; + case FSL_SIP_SRTC_SET_TIMEOUT_WDOG: + ret = sc_timer_set_wdog_timeout(ipc_handle, x2); + break; default: return SMC_UNK; } |