From 473b3cd1b72bc2024b9884c83e02d6880c1fc291 Mon Sep 17 00:00:00 2001 From: chenjh Date: Thu, 20 Apr 2017 10:53:32 +0800 Subject: [PATCH] firmware: rockchip: deliver sip implement version v2 to optee 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 --- drivers/firmware/rockchip_sip.c | 19 +++++++++++++++++++ include/linux/rockchip/rockchip_sip.h | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/drivers/firmware/rockchip_sip.c b/drivers/firmware/rockchip_sip.c index c454fff98661..fc0ca1d79a9e 100644 --- a/drivers/firmware/rockchip_sip.c +++ b/drivers/firmware/rockchip_sip.c @@ -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 diff --git a/include/linux/rockchip/rockchip_sip.h b/include/linux/rockchip/rockchip_sip.h index 3ecef04b5051..4b0ddddf9be3 100644 --- a/include/linux/rockchip/rockchip_sip.h +++ b/include/linux/rockchip/rockchip_sip.h @@ -31,6 +31,10 @@ #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) -- 2.34.1