summaryrefstree
path: root/kernel/include/linux/smc.h
blob: 7db8f16eedba9ca7b4cf2e5317129a0ac5b32f8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
 *  Copyright (c) 2012 Samsung Electronics.
 *
 * EXYNOS - SMC Call
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#ifndef __ASM_ARCH_EXYNOS_SMC_H
#define __ASM_ARCH_EXYNOS_SMC_H

#define SMC_CMD_INIT		(-1)
#define SMC_CMD_INFO		(-2)
/* For Power Management */
#define SMC_CMD_SLEEP		(-3)
#define SMC_CMD_CPU1BOOT	(-4)
#define SMC_CMD_CPU0AFTR	(-5)
#define SMC_CMD_SAVE		(-6)
#define SMC_CMD_SHUTDOWN	(-7)
/* For CP15 Access */
#define SMC_CMD_C15RESUME	(-11)
/* For L2 Cache Access */
#define SMC_CMD_L2X0CTRL	(-21)
#define SMC_CMD_L2X0SETUP1	(-22)
#define SMC_CMD_L2X0SETUP2	(-23)
#define SMC_CMD_L2X0INVALL	(-24)
#define SMC_CMD_L2X0DEBUG	(-25)

/* For Accessing CP15/SFR (General) */
#define SMC_CMD_REG		(-101)

/* For setting memory for debug */
#define SMC_CMD_SET_DEBUG_MEM  (-120)

/* Command ID for smc */
#define SMC_PROTECTION_SET	0x81000000
#define SMC_DRM_FW_LOADING	0x81000001
#define SMC_DCPP_SUPPORT	0x81000002
#define SMC_DRM_MAKE_PGTABLE	0x81000003
#define SMC_DRM_CLEAR_PGTABLE	0x81000004
#define SMC_MEM_PROT_SET	0x81000005
#define SMC_DRM_SECMEM_INFO	0x81000006
#define SMC_DRM_VIDEO_PROC	0x81000007
#define SMC_DRM_SECMEM_REGION_INFO	0x8100000A
#define SMC_DRM_SECMEM_REGION_PROT	0x8100000B
#define MC_FC_SET_CFW_PROT	0xC20018A0
#define MC_FC_DRM_SET_CFW_PROT	0x10000000

/* SiP & OEM fastcall ID base */
#define SMC_SIP_BASE		0x81000000
#define SMC_OEM_BASE		0x83000000

/* Parameter for smc */
#define SMC_PROTECTION_ENABLE	1
#define SMC_PROTECTION_DISABLE	0

/* For FMP Ctrl */
#if defined(CONFIG_SOC_EXYNOS7420)
#define SMC_CMD_FMP		(0xC2001810)
#define SMC_CMD_SMU		(0xC2001820)
#define SMC_CMD_RESUME		(0xC2001830)
#else
#define SMC_CMD_FMP		(0x81000020)
#endif

/* For DTRNG Access */
#ifdef CONFIG_EXYRNG_USE_CRYPTOMANAGER
#define SMC_CMD_RANDOM		(0x82001012)
#else
#define SMC_CMD_RANDOM		(0x81000030)
#endif

/* MACRO for SMC_CMD_REG */
#define SMC_REG_CLASS_CP15	(0x0 << 30)
#define SMC_REG_CLASS_SFR_W	(0x1 << 30)
#define SMC_REG_CLASS_SFR_R	(0x3 << 30)
#define SMC_REG_CLASS_MASK	(0x3 << 30)
#define SMC_REG_ID_CP15(CRn, Op1, CRm, Op2) \
	   (SMC_REG_CLASS_CP15 | (CRn << 10) | (Op1 << 7) | (CRm << 3) | (Op2))
#define SMC_REG_ID_SFR_W(ADDR)	(SMC_REG_CLASS_SFR_W | ((ADDR) >> 2))
#define SMC_REG_ID_SFR_R(ADDR)	(SMC_REG_CLASS_SFR_R | ((ADDR) >> 2))

/* op type for SMC_CMD_SAVE and SMC_CMD_SHUTDOWN */
#define OP_TYPE_CORE            0x0
#define OP_TYPE_CLUSTER         0x1

/* Power State required for SMC_CMD_SAVE and SMC_CMD_SHUTDOWN */
#define SMC_POWERSTATE_SLEEP    0x0
#define SMC_POWERSTATE_IDLE     0x1
#define SMC_POWERSTATE_SWITCH   0x2

/* For FMP Ctrl */
#if defined(CONFIG_SOC_EXYNOS7420)
#define FMP_KEY_STORE		0x0
#define FMP_KEY_SET		0x1
#define FMP_KEY_RESUME		0x2
#define FMP_FW_INTEGRITY	0x3
#define FMP_FW_SELFTEST		0x4
#define FMP_FW_SHA2_TEST	0x5
#define FMP_FW_HMAC_SHA2_TEST	0x6
#define FMP_KEY_CLEAR		0x7
#define FMP_SECURITY		0x8

#define FMP_DESC_OFF		0x0
#define FMP_DESC_ON		0x1

#define FMP_SMU_OFF		0x0
#define FMP_SMU_ON		0x1

#define FMP_SMU_INIT		0x0
#define FMP_SMU_SET		0x1
#define FMP_SMU_RESUME		0x2
#define FMP_SMU_DUMP		0x3
#else
#define FMP_MMC_KEY_SET		0x0
#define FMP_MMC_SUSPEND		0x1
#define FMP_MMC_RESUME		0x2
#endif

#if defined(CONFIG_SOC_EXYNOS7420)
#define UFS_FMP			0x15572000
#define EMMC0_FMP		0x15741000
#define EMMC2_FMP		0x15561000
#endif

/* For DTRNG Access */
#define HWRNG_INIT		0x0
#define HWRNG_EXIT		0x1
#define HWRNG_GET_DATA		0x2
#define HWRNG_RESUME		0x3

/* For CFW group */
#define CFW_DISP_RW	3
#define CFW_VPP0	5
#define CFW_VPP1	6

#ifndef __ASSEMBLY__
extern int _exynos_smc(unsigned long cmd, unsigned long arg1, unsigned long arg2, unsigned long arg3);
extern int exynos_smc(unsigned long cmd, unsigned long arg1, unsigned long arg2, unsigned long arg3);
extern int exynos_smc_readsfr(unsigned long addr, unsigned long* val);
#endif

#endif