firmware: rockchip: deliver sip implement version v2 to optee
authorchenjh <chenjh@rock-chips.com>
Thu, 20 Apr 2017 02:53:32 +0000 (10:53 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Fri, 28 Apr 2017 09:43:54 +0000 (17:43 +0800)
Because optee works on both kernel 3.10 and 4.4, these two branches
have different rockchip sip protocol that sip version v1 for 3.10
and sip version v2 for 4.4

Change-Id: I4f69352d2001b1c22c5617dc443510263b4c53f5
Signed-off-by: chenjh <chenjh@rock-chips.com>
drivers/firmware/rockchip_sip.c
include/linux/rockchip/rockchip_sip.h

index c454fff98661e7cfaba34febdfd51c477a5103e8..fc0ca1d79a9e97d8206e672147d35a4752ddca80 100644 (file)
@@ -285,3 +285,22 @@ void sip_fiq_debugger_enable_fiq(bool enable, uint32_t tgt_cpu)
        __invoke_sip_fn_smc(SIP_UARTDBG_FN, tgt_cpu, 0, en);
 }
 
+/******************************************************************************/
+#ifdef CONFIG_ARM
+/*
+ * optee work on kernel 3.10 and 4.4, and we have different sip
+ * implement. We should tell optee the current rockchip sip version.
+ */
+static __init int sip_implement_version_init(void)
+{
+       struct arm_smccc_res res;
+
+       res = __invoke_sip_fn_smc(SIP_SIP_VERSION, SIP_IMPLEMENT_V2,
+                                 SECURE_REG_WR, 0);
+       if (IS_SIP_ERROR(res.a0))
+               pr_err("%s: set rockchip sip version v2 failed\n", __func__);
+
+       return 0;
+}
+arch_initcall(sip_implement_version_init);
+#endif
index 3ecef04b5051baef7ddcf42af1ee297771ec5898..4b0ddddf9be3af60fb99299ec94c6b58cac7af38 100644 (file)
 #define SIP_SIP_VERSION                        0x8200000a
 #define SIP_REMOTECTL_CFG              0x8200000b
 
+/* Rockchip Sip version */
+#define SIP_IMPLEMENT_V1                (1)
+#define SIP_IMPLEMENT_V2                (2)
+
 /* Trust firmware version */
 #define ATF_VER_MAJOR(ver)             (((ver) >> 16) & 0xffff)
 #define ATF_VER_MINOR(ver)             (((ver) >> 0) & 0xffff)