xref: /rk3399_rockchip-uboot/arch/arm/include/asm/arch-rockchip/rockchip_smccc.h (revision b8fa3d2a17dce6006a8a5f46cbc978a19a3fdf82)
1 /*
2  * (C) Copyright 2017 Rockchip Electronics Co., Ltd
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6 
7 #ifndef __ROCKCHIP_SMCCC_H__
8 #define __ROCKCHIP_SMCCC_H__
9 
10 /* Rockchip platform SiP call ID */
11 #define SIP_ATF_VERSION			0x82000001
12 #define SIP_ACCESS_REG			0x82000002
13 #define SIP_SUSPEND_MODE		0x82000003
14 #define SIP_PENDING_CPUS		0x82000004
15 #define SIP_UARTDBG_CFG			0x82000005
16 #define SIP_UARTDBG_CFG64		0xc2000005
17 #define SIP_MCU_EL3FIQ_CFG		0x82000006
18 #define SIP_ACCESS_CHIP_STATE64		0xc2000006
19 #define SIP_SECURE_MEM_CONFIG		0x82000007
20 #define SIP_ACCESS_CHIP_EXTRA_STATE64	0xc2000007
21 #define SIP_DRAM_CONFIG			0x82000008
22 #define SIP_SHARE_MEM			0x82000009
23 #define SIP_SIP_VERSION			0x8200000a
24 #define SIP_REMOTECTL_CFG		0x8200000b
25 #define PSCI_SIP_VPU_RESET		0x8200000c
26 
27 /* Rockchip Sip version */
28 #define SIP_IMPLEMENT_V1                (1)
29 #define SIP_IMPLEMENT_V2                (2)
30 
31 /* Error return code */
32 #define IS_SIP_ERROR(x)			(!!(x))
33 
34 #define SIP_RET_SUCCESS			0
35 #define SIP_RET_SMC_UNKNOWN		-1
36 #define SIP_RET_NOT_SUPPORTED		-2
37 #define SIP_RET_INVALID_PARAMS		-3
38 #define SIP_RET_INVALID_ADDRESS		-4
39 #define SIP_RET_DENIED			-5
40 
41 /* SIP_ACCESS_REG: read or write */
42 #define SECURE_REG_RD			0x0
43 #define SECURE_REG_WR			0x1
44 
45 /* Share mem page types */
46 typedef enum {
47 	SHARE_PAGE_TYPE_INVALID = 0,
48 	SHARE_PAGE_TYPE_UARTDBG,
49 	SHARE_PAGE_TYPE_DDR,
50 	SHARE_PAGE_TYPE_MAX,
51 } share_page_type_t;
52 
53 /* Stand PSCI system suspend */
54 int psci_system_suspend(unsigned long unused);
55 
56 /* Rockchip SMC Calls */
57 int sip_smc_set_suspend_mode(unsigned long ctrl,
58 			     unsigned long config1,
59 			     unsigned long config2);
60 
61 struct arm_smccc_res sip_smc_dram(unsigned long arg0,
62 				  unsigned long arg1,
63 				  unsigned long arg2);
64 
65 struct arm_smccc_res sip_smc_request_share_mem(unsigned long page_num,
66 					       share_page_type_t page_type);
67 
68 int sip_smc_set_sip_version(unsigned long version);
69 struct arm_smccc_res sip_smc_get_sip_version(void);
70 int psci_cpu_on(unsigned long cpuid, unsigned long entry_point);
71 
72 #endif
73