diff options
author | Anson Huang <Anson.Huang@nxp.com> | 2019-11-22 10:50:20 +0800 |
---|---|---|
committer | Anson Huang <Anson.Huang@nxp.com> | 2019-11-22 10:50:20 +0800 |
commit | def250487be094af7ad5dfc52ac8370c5f1dbe83 (patch) | |
tree | b284566a9ae229b1028fe9fb9af1a9efc3442a56 | |
parent | a04808c16cfc126d9fe572ae7c4b5a3d39de5796 (diff) |
plat: imx: Add WDOG functions SIP support
Add WDOG functions SIP support.
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
-rw-r--r-- | plat/imx/common/imx_sip_handler.c | 37 | ||||
-rw-r--r-- | plat/imx/common/include/imx_sip_svc.h | 7 |
2 files changed, 44 insertions, 0 deletions
diff --git a/plat/imx/common/imx_sip_handler.c b/plat/imx/common/imx_sip_handler.c index 62048b69..7484fdd9 100644 --- a/plat/imx/common/imx_sip_handler.c +++ b/plat/imx/common/imx_sip_handler.c @@ -32,6 +32,20 @@ static int imx_srtc_set_time(uint32_t year_mon, 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, void *handle, u_register_t x1, @@ -40,11 +54,34 @@ int imx_srtc_handler(uint32_t smc_fid, u_register_t x4) { int ret; + sc_timer_wdog_time_t timeout, max_timeout, remaining; switch (x1) { case IMX_SIP_SRTC_SET_TIME: ret = imx_srtc_set_time(x2, x3, x4); break; + case IMX_SIP_SRTC_START_WDOG: + ret = sc_timer_start_wdog(ipc_handle, !!x2); + break; + case IMX_SIP_SRTC_STOP_WDOG: + ret = sc_timer_stop_wdog(ipc_handle); + break; + case IMX_SIP_SRTC_SET_WDOG_ACT: + ret = imx_srtc_set_wdog_action(x2); + break; + case IMX_SIP_SRTC_PING_WDOG: + ret = sc_timer_ping_wdog(ipc_handle); + break; + case IMX_SIP_SRTC_SET_TIMEOUT_WDOG: + ret = sc_timer_set_wdog_timeout(ipc_handle, x2); + break; + case IMX_SIP_SRTC_SET_PRETIME_WDOG: + ret = sc_timer_set_wdog_pre_timeout(ipc_handle, x2); + break; + case IMX_SIP_SRTC_GET_WDOG_STAT: + ret = sc_timer_get_wdog_status(ipc_handle, &timeout, + &max_timeout, &remaining); + SMC_RET4(handle, ret, timeout, max_timeout, remaining); default: ret = SMC_UNK; } diff --git a/plat/imx/common/include/imx_sip_svc.h b/plat/imx/common/include/imx_sip_svc.h index 5898f7a8..4cdf11bd 100644 --- a/plat/imx/common/include/imx_sip_svc.h +++ b/plat/imx/common/include/imx_sip_svc.h @@ -13,6 +13,13 @@ #define IMX_SIP_SRTC 0xC2000002 #define IMX_SIP_SRTC_SET_TIME 0x00 +#define IMX_SIP_SRTC_START_WDOG 0x01 +#define IMX_SIP_SRTC_STOP_WDOG 0x02 +#define IMX_SIP_SRTC_SET_WDOG_ACT 0x03 +#define IMX_SIP_SRTC_PING_WDOG 0x04 +#define IMX_SIP_SRTC_SET_TIMEOUT_WDOG 0x05 +#define IMX_SIP_SRTC_GET_WDOG_STAT 0x06 +#define IMX_SIP_SRTC_SET_PRETIME_WDOG 0x07 #define IMX_SIP_BUILDINFO 0xC2000003 #define IMX_SIP_BUILDINFO_GET_COMMITHASH 0x00 |