summaryrefslogtreecommitdiff
path: root/plat/imx/common/sci
diff options
context:
space:
mode:
authorRobin Gong <yibin.gong@nxp.com>2017-10-27 10:13:46 +0800
committerAbel Vesa <abel.vesa@nxp.com>2018-06-11 10:08:40 +0300
commitf62d4ae081d935ac0c77534b28445b0db157d041 (patch)
treee76d1b07d95353561696d231c4c4e2af29ec31d1 /plat/imx/common/sci
parent905204763cb18b899b261fe893dd6e889e0fcb8d (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/sci')
-rw-r--r--plat/imx/common/sci/svc/timer/timer_rpc_clnt.c87
1 files changed, 86 insertions, 1 deletions
diff --git a/plat/imx/common/sci/svc/timer/timer_rpc_clnt.c b/plat/imx/common/sci/svc/timer/timer_rpc_clnt.c
index 7aeb0e47..9543eab3 100644
--- a/plat/imx/common/sci/svc/timer/timer_rpc_clnt.c
+++ b/plat/imx/common/sci/svc/timer/timer_rpc_clnt.c
@@ -48,7 +48,8 @@
/* Local Defines */
/* Local Types */
-
+typedef uint8_t sc_timer_wdog_action_t;
+typedef uint32_t sc_timer_wdog_time_t;
/* Local Functions */
sc_err_t sc_timer_set_rtc_time(sc_ipc_t ipc, uint16_t year, uint8_t mon,
@@ -147,4 +148,88 @@ sc_err_t sc_timer_set_rtc_alarm(sc_ipc_t ipc, uint16_t year, uint8_t mon,
return (sc_err_t)result;
}
+sc_err_t sc_timer_start_wdog(sc_ipc_t ipc, bool lock)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = SC_RPC_SVC_TIMER;
+ RPC_FUNC(&msg) = TIMER_FUNC_START_WDOG;
+ RPC_U8(&msg, 0) = lock;
+ RPC_SIZE(&msg) = 2;
+
+ sc_call_rpc(ipc, &msg, false);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_timer_stop_wdog(sc_ipc_t ipc)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = SC_RPC_SVC_TIMER;
+ RPC_FUNC(&msg) = TIMER_FUNC_STOP_WDOG;
+ RPC_SIZE(&msg) = 1;
+
+ sc_call_rpc(ipc, &msg, false);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_timer_set_wdog_action(sc_ipc_t ipc,
+ sc_rm_pt_t pt, sc_timer_wdog_action_t action)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = SC_RPC_SVC_TIMER;
+ RPC_FUNC(&msg) = TIMER_FUNC_SET_WDOG_ACTION;
+ RPC_U8(&msg, 0) = pt;
+ RPC_U8(&msg, 1) = action;
+ RPC_SIZE(&msg) = 2;
+
+ sc_call_rpc(ipc, &msg, false);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_timer_set_wdog_timeout(sc_ipc_t ipc, sc_timer_wdog_time_t timeout)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = SC_RPC_SVC_TIMER;
+ RPC_FUNC(&msg) = TIMER_FUNC_SET_WDOG_TIMEOUT;
+ RPC_U32(&msg, 0) = timeout;
+ RPC_SIZE(&msg) = 2;
+
+ sc_call_rpc(ipc, &msg, false);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
+
+sc_err_t sc_timer_ping_wdog(sc_ipc_t ipc)
+{
+ sc_rpc_msg_t msg;
+ uint8_t result;
+
+ RPC_VER(&msg) = SC_RPC_VERSION;
+ RPC_SVC(&msg) = SC_RPC_SVC_TIMER;
+ RPC_FUNC(&msg) = TIMER_FUNC_PING_WDOG;
+ RPC_SIZE(&msg) = 1;
+
+ sc_call_rpc(ipc, &msg, false);
+
+ result = RPC_R8(&msg);
+ return (sc_err_t)result;
+}
/**@}*/