From 6ccd9a7567c73d3ac17c9ee3e595bc7267fd0d81 Mon Sep 17 00:00:00 2001 From: Joseph Chen Date: Mon, 25 Jun 2018 10:27:10 +0800 Subject: [PATCH] firmware: rockchip: add last log request interface Change-Id: I26e37b25d75ac07928f1964f5165e1a2a568ac69 Signed-off-by: Joseph Chen --- drivers/firmware/rockchip_sip.c | 28 +++++++++++++++++++++++++++ include/linux/rockchip/rockchip_sip.h | 8 ++++++++ 2 files changed, 36 insertions(+) diff --git a/drivers/firmware/rockchip_sip.c b/drivers/firmware/rockchip_sip.c index 0bf2fba10a93..ac25645fbce9 100644 --- a/drivers/firmware/rockchip_sip.c +++ b/drivers/firmware/rockchip_sip.c @@ -152,6 +152,34 @@ struct arm_smccc_res sip_smc_soc_bus_div(u32 arg0, u32 arg1, u32 arg2) return res; } +struct arm_smccc_res sip_smc_lastlog_request(void) +{ + struct arm_smccc_res res; + void __iomem *addr1, *addr2; + + res = __invoke_sip_fn_smc(SIP_LAST_LOG, local_clock(), 0, 0); + if (IS_SIP_ERROR(res.a0)) + return res; + + addr1 = ioremap(res.a1, res.a3); + if (!addr1) { + pr_err("%s: share memory buffer0 ioremap failed\n", __func__); + res.a0 = SIP_RET_INVALID_ADDRESS; + return res; + } + addr2 = ioremap(res.a2, res.a3); + if (!addr2) { + pr_err("%s: share memory buffer1 ioremap failed\n", __func__); + res.a0 = SIP_RET_INVALID_ADDRESS; + return res; + } + + res.a1 = (unsigned long)addr1; + res.a2 = (unsigned long)addr2; + + return res; +} + /************************** fiq debugger **************************************/ /* * AArch32 is not allowed to call SMC64(ATF framework does not support), so we diff --git a/include/linux/rockchip/rockchip_sip.h b/include/linux/rockchip/rockchip_sip.h index 6072a1c947c8..3258eeda6e50 100644 --- a/include/linux/rockchip/rockchip_sip.h +++ b/include/linux/rockchip/rockchip_sip.h @@ -32,6 +32,7 @@ #define SIP_REMOTECTL_CFG 0x8200000b #define PSCI_SIP_VPU_RESET 0x8200000c #define RK_SIP_SOC_BUS_DIV 0x8200000d +#define SIP_LAST_LOG 0x8200000e /* Rockchip Sip version */ #define SIP_IMPLEMENT_V1 (1) @@ -120,6 +121,7 @@ struct arm_smccc_res sip_smc_request_share_mem(u32 page_num, struct arm_smccc_res sip_smc_mcu_el3fiq(u32 arg0, u32 arg1, u32 arg2); struct arm_smccc_res sip_smc_vpu_reset(u32 arg0, u32 arg1, u32 arg2); struct arm_smccc_res sip_smc_get_suspend_info(u32 info); +struct arm_smccc_res sip_smc_lastlog_request(void); int sip_smc_set_suspend_mode(u32 ctrl, u32 config1, u32 config2); int sip_smc_virtual_poweroff(void); @@ -178,6 +180,12 @@ sip_smc_vpu_reset(u32 arg0, u32 arg1, u32 arg2) return tmp; } +struct arm_smccc_res sip_smc_lastlog_request(void) +{ + struct arm_smccc_res tmp = {0}; + return tmp; +} + static inline int sip_smc_set_suspend_mode(u32 ctrl, u32 config1, u32 config2) { return 0;