From 12dd7eabc29348b2e5e726967ee740d7361ab1e6 Mon Sep 17 00:00:00 2001 From: XiaoDong Huang Date: Fri, 14 Feb 2025 17:03:14 +0800 Subject: [PATCH] firmware: rockchip_sip: support gpio_config Signed-off-by: XiaoDong Huang Change-Id: Icebff7235e875c8b8f3dcde22af5be2b04cff274 --- drivers/firmware/rockchip_sip.c | 13 +++++++++++++ include/linux/rockchip/rockchip_sip.h | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/drivers/firmware/rockchip_sip.c b/drivers/firmware/rockchip_sip.c index 785e25420346..b426ec3d4977 100644 --- a/drivers/firmware/rockchip_sip.c +++ b/drivers/firmware/rockchip_sip.c @@ -358,6 +358,19 @@ struct arm_smccc_res sip_hdcp_config(u32 arg0, u32 arg1, u32 arg2) } EXPORT_SYMBOL_GPL(sip_hdcp_config); +struct arm_smccc_res sip_smc_gpio_config(u32 sub_func_id, u32 arg1, u32 arg2, + u32 arg3) +{ + struct arm_smccc_res res; + + /* + * res.a0: error code(0: success, !0: error). + */ + arm_smccc_smc(SIP_GPIO_CFG, sub_func_id, arg1, arg2, arg3, 0, 0, 0, &res); + return res; +} +EXPORT_SYMBOL_GPL(sip_smc_gpio_config); + /************************** 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 20dbece78cf9..b6196c138698 100644 --- a/include/linux/rockchip/rockchip_sip.h +++ b/include/linux/rockchip/rockchip_sip.h @@ -59,6 +59,7 @@ #define SIP_HDMIRX_CFG 0x82000027 #define SIP_MCU_CFG 0x82000028 #define SIP_PVTPLL_CFG 0x82000029 +#define SIP_GPIO_CFG 0x8200002c #define TRUSTED_OS_HDCPKEY_INIT 0xB7000003 @@ -249,6 +250,13 @@ enum { PVTPLL_VOLT_SEL = 3, }; +/* SIP_GPIO_CFG child configs */ +enum { + GPIO_GET_GROUP_INFO = 0, + GPIO_SET_GROUP_INFO = 1, + GPIO_GET_VIRT_EN = 2, +}; + struct pt_regs; typedef void (*sip_fiq_debugger_uart_irq_tf_cb_t)(struct pt_regs *_pt_regs, unsigned long cpu); @@ -286,6 +294,8 @@ struct arm_smccc_res sip_smc_pvtpll_config(u32 sub_func_id, u32 arg1, u32 arg2, void __iomem *sip_hdcp_request_share_memory(int id); struct arm_smccc_res sip_hdcp_config(u32 arg0, u32 arg1, u32 arg2); +struct arm_smccc_res sip_smc_gpio_config(u32 sub_func_id, u32 arg1, u32 arg2, + u32 arg3); ulong sip_cpu_logical_map_mpidr(u32 cpu); /***************************fiq debugger **************************************/ void sip_fiq_debugger_enable_fiq(bool enable, uint32_t tgt_cpu); @@ -429,6 +439,14 @@ static inline struct arm_smccc_res sip_hdcp_config(u32 arg0, u32 arg1, u32 arg2) return tmp; } +static inline struct arm_smccc_res sip_smc_gpio_config(u32 sub_func_id, u32 arg1, + u32 arg2, u32 arg3) +{ + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED, }; + + return tmp; +} + static inline ulong sip_cpu_logical_map_mpidr(u32 cpu) { return 0; } /***************************fiq debugger **************************************/