.. | .. |
---|
52 | 52 | #define SIP_SDEI_FIQ_DBG_SWITCH_CPU 0x82000020 |
---|
53 | 53 | #define SIP_SDEI_FIQ_DBG_GET_EVENT_ID 0x82000021 |
---|
54 | 54 | #define RK_SIP_AMP_CFG 0x82000022 |
---|
| 55 | +#define RK_SIP_FIQ_CTRL 0x82000024 |
---|
| 56 | +#define SIP_HDCP_CONFIG 0x82000025 |
---|
| 57 | +#define SIP_WDT_CFG 0x82000026 |
---|
| 58 | +#define SIP_HDMIRX_CFG 0x82000027 |
---|
| 59 | +#define SIP_MCU_CFG 0x82000028 |
---|
| 60 | +#define SIP_PVTPLL_CFG 0x82000029 |
---|
| 61 | + |
---|
| 62 | +#define TRUSTED_OS_HDCPKEY_INIT 0xB7000003 |
---|
55 | 63 | |
---|
56 | 64 | /* Rockchip Sip version */ |
---|
57 | 65 | #define SIP_IMPLEMENT_V1 (1) |
---|
.. | .. |
---|
100 | 108 | #define VIRTUAL_POWEROFF 0x07 |
---|
101 | 109 | #define SUSPEND_WFI_TIME_MS 0x08 |
---|
102 | 110 | #define LINUX_PM_STATE 0x09 |
---|
| 111 | +#define SUSPEND_IO_RET_CONFIG 0x0a |
---|
| 112 | +#define SLEEP_PIN_CONFIG 0x0b |
---|
103 | 113 | |
---|
104 | 114 | /* SIP_REMOTECTL_CFG call types */ |
---|
105 | 115 | #define REMOTECTL_SET_IRQ 0xf0 |
---|
.. | .. |
---|
109 | 119 | #define REMOTECTL_ENABLE 0xf4 |
---|
110 | 120 | /* wakeup state */ |
---|
111 | 121 | #define REMOTECTL_PWRKEY_WAKEUP 0xdeadbeaf |
---|
| 122 | + |
---|
| 123 | +/* SIP_MCU_CFG child configs, MCU ID */ |
---|
| 124 | +enum { |
---|
| 125 | + RK_BUS_MCU, |
---|
| 126 | + RK_PMU_MCU, |
---|
| 127 | + RK_DDR_MCU, |
---|
| 128 | + RK_NPU_MCU, |
---|
| 129 | +}; |
---|
| 130 | + |
---|
| 131 | +#define RK_SIP_MCU_ID(type, id) ((type) << 8 | id) |
---|
| 132 | + |
---|
| 133 | +#define RK_SIP_CFG_BUSMCU_0_ID RK_SIP_MCU_ID(RK_BUS_MCU, 0) |
---|
| 134 | +#define RK_SIP_CFG_BUSMCU_1_ID RK_SIP_MCU_ID(RK_BUS_MCU, 1) |
---|
| 135 | +#define RK_SIP_CFG_PMUMCU_0_ID RK_SIP_MCU_ID(RK_PMU_MCU, 0) |
---|
| 136 | +#define RK_SIP_CFG_DDRMCU_0_ID RK_SIP_MCU_ID(RK_DDR_MCU, 0) |
---|
| 137 | +#define RK_SIP_CFG_NPUMCU_0_ID RK_SIP_MCU_ID(RK_NPU_MCU, 0) |
---|
| 138 | + |
---|
| 139 | +/* SIP_MCU_CFG child configs */ |
---|
| 140 | +#define CONFIG_MCU_CODE_START_ADDR 0x01 |
---|
| 141 | +#define CONFIG_MCU_EXPERI_START_ADDR 0x02 |
---|
| 142 | +#define CONFIG_MCU_SRAM_START_ADDR 0x03 |
---|
| 143 | +#define CONFIG_MCU_EXSRAM_START_ADDR 0x04 |
---|
| 144 | + |
---|
| 145 | +struct dram_addrmap_info { |
---|
| 146 | + u64 ch_mask[2]; |
---|
| 147 | + u64 bk_mask[4]; |
---|
| 148 | + u64 bg_mask[2]; |
---|
| 149 | + u64 cs_mask[2]; |
---|
| 150 | + u32 reserved[20]; |
---|
| 151 | + u32 bank_bit_first; |
---|
| 152 | + u32 bank_bit_mask; |
---|
| 153 | +}; |
---|
112 | 154 | |
---|
113 | 155 | /* AMP Ctrl */ |
---|
114 | 156 | enum { |
---|
.. | .. |
---|
120 | 162 | RK_AMP_SUB_FUNC_RSV, /* for RTOS */ |
---|
121 | 163 | RK_AMP_SUB_FUNC_CPU_ON, |
---|
122 | 164 | RK_AMP_SUB_FUNC_END, |
---|
123 | | -}; |
---|
124 | | - |
---|
125 | | -struct dram_addrmap_info { |
---|
126 | | - u64 ch_mask[2]; |
---|
127 | | - u64 bk_mask[4]; |
---|
128 | | - u64 bg_mask[2]; |
---|
129 | | - u64 cs_mask[2]; |
---|
130 | | - u32 reserved[20]; |
---|
131 | | - u32 bank_bit_first; |
---|
132 | | - u32 bank_bit_mask; |
---|
133 | 165 | }; |
---|
134 | 166 | |
---|
135 | 167 | enum { |
---|
.. | .. |
---|
150 | 182 | SHARE_PAGE_TYPE_DDRFSP, |
---|
151 | 183 | SHARE_PAGE_TYPE_DDR_ADDRMAP, |
---|
152 | 184 | SHARE_PAGE_TYPE_LAST_LOG, |
---|
| 185 | + SHARE_PAGE_TYPE_HDCP, |
---|
| 186 | + SHARE_PAGE_TYPE_SLEEP, |
---|
153 | 187 | SHARE_PAGE_TYPE_MAX, |
---|
154 | 188 | } share_page_type_t; |
---|
| 189 | + |
---|
| 190 | +/* fiq control sub func */ |
---|
| 191 | +enum { |
---|
| 192 | + RK_SIP_FIQ_CTRL_FIQ_EN = 1, |
---|
| 193 | + RK_SIP_FIQ_CTRL_FIQ_DIS, |
---|
| 194 | + RK_SIP_FIQ_CTRL_SET_AFF |
---|
| 195 | +}; |
---|
| 196 | + |
---|
| 197 | +/* hdcp function types */ |
---|
| 198 | +enum { |
---|
| 199 | + HDCP_FUNC_STORAGE_INCRYPT = 1, |
---|
| 200 | + HDCP_FUNC_KEY_LOAD, |
---|
| 201 | + HDCP_FUNC_ENCRYPT_MODE |
---|
| 202 | +}; |
---|
| 203 | + |
---|
| 204 | +/* support hdcp device list */ |
---|
| 205 | +enum { |
---|
| 206 | + DP_TX0, |
---|
| 207 | + DP_TX1, |
---|
| 208 | + EDP_TX0, |
---|
| 209 | + EDP_TX1, |
---|
| 210 | + HDMI_TX0, |
---|
| 211 | + HDMI_TX1, |
---|
| 212 | + HDMI_RX, |
---|
| 213 | + MAX_DEVICE, |
---|
| 214 | +}; |
---|
| 215 | + |
---|
| 216 | +/* SIP_WDT_CONFIG call types */ |
---|
| 217 | +enum { |
---|
| 218 | + WDT_START = 0, |
---|
| 219 | + WDT_STOP = 1, |
---|
| 220 | + WDT_PING = 2, |
---|
| 221 | +}; |
---|
| 222 | + |
---|
| 223 | +/* SIP_HDMIRX_CONFIG child configs */ |
---|
| 224 | +enum { |
---|
| 225 | + HDMIRX_AUTO_TOUCH_EN = 0, |
---|
| 226 | + HDMIRX_REG_PRE_FETCH = 1, |
---|
| 227 | + HDMIRX_INFO_NOTIFY = 2, |
---|
| 228 | +}; |
---|
| 229 | + |
---|
| 230 | +/* SIP_PVTPLL_CFG child configs */ |
---|
| 231 | +enum { |
---|
| 232 | + PVTPLL_GET_INFO = 0, |
---|
| 233 | + PVTPLL_ADJUST_TABLE = 1, |
---|
| 234 | + PVTPLL_LOW_TEMP = 2, |
---|
| 235 | +}; |
---|
| 236 | + |
---|
| 237 | +struct pt_regs; |
---|
| 238 | +typedef void (*sip_fiq_debugger_uart_irq_tf_cb_t)(struct pt_regs *_pt_regs, unsigned long cpu); |
---|
155 | 239 | |
---|
156 | 240 | /* |
---|
157 | 241 | * Rules: struct arm_smccc_res contains result and data, details: |
---|
.. | .. |
---|
159 | 243 | * a0: error code(0: success, !0: error); |
---|
160 | 244 | * a1~a3: data |
---|
161 | 245 | */ |
---|
162 | | -#if IS_ENABLED(CONFIG_ROCKCHIP_SIP) |
---|
| 246 | +#if IS_REACHABLE(CONFIG_ROCKCHIP_SIP) |
---|
163 | 247 | struct arm_smccc_res sip_smc_get_atf_version(void); |
---|
164 | 248 | struct arm_smccc_res sip_smc_get_sip_version(void); |
---|
165 | 249 | struct arm_smccc_res sip_smc_dram(u32 arg0, u32 arg1, u32 arg2); |
---|
.. | .. |
---|
177 | 261 | int sip_smc_secure_reg_write(u32 addr_phy, u32 val); |
---|
178 | 262 | u32 sip_smc_secure_reg_read(u32 addr_phy); |
---|
179 | 263 | struct arm_smccc_res sip_smc_bus_config(u32 arg0, u32 arg1, u32 arg2); |
---|
| 264 | +struct dram_addrmap_info *sip_smc_get_dram_map(void); |
---|
180 | 265 | int sip_smc_amp_config(u32 sub_func_id, u32 arg1, u32 arg2, u32 arg3); |
---|
181 | 266 | struct arm_smccc_res sip_smc_get_amp_info(u32 sub_func_id, u32 arg1); |
---|
182 | | -struct dram_addrmap_info *sip_smc_get_dram_map(void); |
---|
| 267 | +struct arm_smccc_res sip_smc_get_pvtpll_info(u32 sub_func_id, u32 arg1); |
---|
| 268 | +struct arm_smccc_res sip_smc_pvtpll_config(u32 sub_func_id, u32 arg1, u32 arg2, |
---|
| 269 | + u32 arg3, u32 arg4, u32 arg5, u32 arg6); |
---|
183 | 270 | |
---|
| 271 | +void __iomem *sip_hdcp_request_share_memory(int id); |
---|
| 272 | +struct arm_smccc_res sip_hdcp_config(u32 arg0, u32 arg1, u32 arg2); |
---|
| 273 | +ulong sip_cpu_logical_map_mpidr(u32 cpu); |
---|
184 | 274 | /***************************fiq debugger **************************************/ |
---|
185 | 275 | void sip_fiq_debugger_enable_fiq(bool enable, uint32_t tgt_cpu); |
---|
186 | 276 | void sip_fiq_debugger_enable_debug(bool enable); |
---|
187 | | -int sip_fiq_debugger_uart_irq_tf_init(u32 irq_id, void *callback_fn); |
---|
| 277 | +int sip_fiq_debugger_uart_irq_tf_init(u32 irq_id, sip_fiq_debugger_uart_irq_tf_cb_t callback_fn); |
---|
188 | 278 | int sip_fiq_debugger_set_print_port(u32 port_phyaddr, u32 baudrate); |
---|
189 | 279 | int sip_fiq_debugger_request_share_memory(void); |
---|
190 | 280 | int sip_fiq_debugger_get_target_cpu(void); |
---|
.. | .. |
---|
192 | 282 | int sip_fiq_debugger_sdei_switch_cpu(u32 cur_cpu, u32 target_cpu, u32 flag); |
---|
193 | 283 | int sip_fiq_debugger_is_enabled(void); |
---|
194 | 284 | int sip_fiq_debugger_sdei_get_event_id(u32 *fiq, u32 *sw_cpu, u32 *flag); |
---|
| 285 | +int sip_fiq_control(u32 sub_func, u32 irq, unsigned long data); |
---|
| 286 | +int sip_wdt_config(u32 sub_func, u32 arg1, u32 arg2, u32 arg3); |
---|
| 287 | +int sip_hdmirx_config(u32 sub_func, u32 arg1, u32 arg2, u32 arg3); |
---|
| 288 | +int sip_hdcpkey_init(u32 hdcp_id); |
---|
| 289 | +int sip_smc_mcu_config(unsigned long mcu_id, unsigned long func, unsigned long arg2); |
---|
195 | 290 | #else |
---|
196 | 291 | static inline struct arm_smccc_res sip_smc_get_atf_version(void) |
---|
197 | 292 | { |
---|
198 | | - struct arm_smccc_res tmp = {0}; |
---|
| 293 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
---|
199 | 294 | return tmp; |
---|
200 | 295 | } |
---|
201 | 296 | |
---|
202 | 297 | static inline struct arm_smccc_res sip_smc_get_sip_version(void) |
---|
203 | 298 | { |
---|
204 | | - struct arm_smccc_res tmp = {0}; |
---|
| 299 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
---|
205 | 300 | return tmp; |
---|
206 | 301 | } |
---|
207 | 302 | |
---|
208 | 303 | static inline struct arm_smccc_res sip_smc_dram(u32 arg0, u32 arg1, u32 arg2) |
---|
209 | 304 | { |
---|
210 | | - struct arm_smccc_res tmp = {0}; |
---|
| 305 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
---|
211 | 306 | return tmp; |
---|
212 | 307 | } |
---|
213 | 308 | |
---|
214 | 309 | static inline struct arm_smccc_res sip_smc_request_share_mem |
---|
215 | 310 | (u32 page_num, share_page_type_t page_type) |
---|
216 | 311 | { |
---|
217 | | - struct arm_smccc_res tmp = {0}; |
---|
| 312 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
---|
218 | 313 | return tmp; |
---|
219 | 314 | } |
---|
220 | 315 | |
---|
221 | 316 | static inline struct arm_smccc_res sip_smc_mcu_el3fiq |
---|
222 | 317 | (u32 arg0, u32 arg1, u32 arg2) |
---|
223 | 318 | { |
---|
224 | | - struct arm_smccc_res tmp = {0}; |
---|
| 319 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
---|
225 | 320 | return tmp; |
---|
226 | 321 | } |
---|
227 | 322 | |
---|
228 | 323 | static inline struct arm_smccc_res |
---|
229 | 324 | sip_smc_vpu_reset(u32 arg0, u32 arg1, u32 arg2) |
---|
230 | 325 | { |
---|
231 | | - struct arm_smccc_res tmp = {0}; |
---|
| 326 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
---|
| 327 | + return tmp; |
---|
| 328 | +} |
---|
| 329 | + |
---|
| 330 | +static inline struct arm_smccc_res sip_smc_get_suspend_info(u32 info) |
---|
| 331 | +{ |
---|
| 332 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
---|
232 | 333 | return tmp; |
---|
233 | 334 | } |
---|
234 | 335 | |
---|
235 | 336 | static inline struct arm_smccc_res sip_smc_lastlog_request(void) |
---|
236 | 337 | { |
---|
237 | | - struct arm_smccc_res tmp = {0}; |
---|
| 338 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
---|
238 | 339 | return tmp; |
---|
239 | 340 | } |
---|
240 | 341 | |
---|
.. | .. |
---|
243 | 344 | return 0; |
---|
244 | 345 | } |
---|
245 | 346 | |
---|
246 | | -static inline int sip_smc_get_suspend_info(u32 info) |
---|
247 | | -{ |
---|
248 | | - return 0; |
---|
249 | | -} |
---|
250 | | - |
---|
251 | 347 | static inline int sip_smc_virtual_poweroff(void) { return 0; } |
---|
252 | 348 | static inline int sip_smc_remotectl_config(u32 func, u32 data) { return 0; } |
---|
253 | | -static inline u32 sip_smc_secure_reg_read(u32 addr_phy) { return 0; } |
---|
254 | 349 | static inline int sip_smc_secure_reg_write(u32 addr_phy, u32 val) { return 0; } |
---|
255 | | -static inline int sip_smc_soc_bus_div(u32 arg0, u32 arg1, u32 arg2) |
---|
| 350 | +static inline u32 sip_smc_secure_reg_read(u32 addr_phy) { return 0; } |
---|
| 351 | + |
---|
| 352 | +static inline struct arm_smccc_res sip_smc_bus_config(u32 arg0, u32 arg1, u32 arg2) |
---|
256 | 353 | { |
---|
257 | | - return 0; |
---|
| 354 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
---|
| 355 | + return tmp; |
---|
258 | 356 | } |
---|
| 357 | + |
---|
259 | 358 | static inline struct dram_addrmap_info *sip_smc_get_dram_map(void) |
---|
260 | 359 | { |
---|
261 | 360 | return NULL; |
---|
.. | .. |
---|
277 | 376 | return tmp; |
---|
278 | 377 | } |
---|
279 | 378 | |
---|
| 379 | +static inline struct arm_smccc_res sip_smc_get_pvtpll_info(u32 sub_func_id, |
---|
| 380 | + u32 arg1) |
---|
| 381 | +{ |
---|
| 382 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED, }; |
---|
| 383 | + |
---|
| 384 | + return tmp; |
---|
| 385 | +} |
---|
| 386 | + |
---|
| 387 | +static inline struct arm_smccc_res sip_smc_pvtpll_config(u32 sub_func_id, |
---|
| 388 | + u32 arg1, u32 arg2, |
---|
| 389 | + u32 arg3, u32 arg4, |
---|
| 390 | + u32 arg5, u32 arg6) |
---|
| 391 | +{ |
---|
| 392 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED, }; |
---|
| 393 | + |
---|
| 394 | + return tmp; |
---|
| 395 | +} |
---|
| 396 | + |
---|
| 397 | +static inline void __iomem *sip_hdcp_request_share_memory(int id) |
---|
| 398 | +{ |
---|
| 399 | + return NULL; |
---|
| 400 | +} |
---|
| 401 | + |
---|
| 402 | +static inline struct arm_smccc_res sip_hdcp_config(u32 arg0, u32 arg1, u32 arg2) |
---|
| 403 | +{ |
---|
| 404 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
---|
| 405 | + |
---|
| 406 | + return tmp; |
---|
| 407 | +} |
---|
| 408 | + |
---|
| 409 | +static inline ulong sip_cpu_logical_map_mpidr(u32 cpu) { return 0; } |
---|
| 410 | + |
---|
280 | 411 | /***************************fiq debugger **************************************/ |
---|
281 | 412 | static inline void sip_fiq_debugger_enable_fiq |
---|
282 | 413 | (bool enable, uint32_t tgt_cpu) { return; } |
---|
283 | 414 | |
---|
284 | 415 | static inline void sip_fiq_debugger_enable_debug(bool enable) { return; } |
---|
285 | 416 | static inline int sip_fiq_debugger_uart_irq_tf_init(u32 irq_id, |
---|
286 | | - void *callback_fn) |
---|
| 417 | + sip_fiq_debugger_uart_irq_tf_cb_t callback_fn) |
---|
287 | 418 | { |
---|
288 | 419 | return 0; |
---|
289 | 420 | } |
---|
.. | .. |
---|
300 | 431 | static inline int sip_fiq_debugger_sdei_switch_cpu(u32 cur_cpu, u32 target_cpu, |
---|
301 | 432 | u32 flag) { return 0; } |
---|
302 | 433 | static inline int sip_fiq_debugger_is_enabled(void) { return 0; } |
---|
| 434 | +static inline int sip_fiq_debugger_sdei_get_event_id(u32 *fiq, u32 *sw_cpu, u32 *flag) |
---|
| 435 | +{ |
---|
| 436 | + return SIP_RET_NOT_SUPPORTED; |
---|
| 437 | +} |
---|
| 438 | + |
---|
| 439 | +static inline int sip_fiq_control(u32 sub_func, u32 irq, unsigned long data) |
---|
| 440 | +{ |
---|
| 441 | + return 0; |
---|
| 442 | +} |
---|
| 443 | + |
---|
| 444 | +static inline int sip_wdt_config(u32 sub_func, |
---|
| 445 | + u32 arg1, |
---|
| 446 | + u32 arg2, |
---|
| 447 | + u32 arg3) |
---|
| 448 | +{ |
---|
| 449 | + return 0; |
---|
| 450 | +} |
---|
| 451 | + |
---|
| 452 | +static inline int sip_hdmirx_config(u32 sub_func, |
---|
| 453 | + u32 arg1, |
---|
| 454 | + u32 arg2, |
---|
| 455 | + u32 arg3) |
---|
| 456 | +{ |
---|
| 457 | + return SIP_RET_NOT_SUPPORTED; |
---|
| 458 | +} |
---|
| 459 | + |
---|
| 460 | +static inline int sip_hdcpkey_init(u32 hdcp_id) |
---|
| 461 | +{ |
---|
| 462 | + return 0; |
---|
| 463 | +} |
---|
| 464 | + |
---|
| 465 | +static inline int sip_smc_mcu_config(unsigned long mcu_id, |
---|
| 466 | + unsigned long func, |
---|
| 467 | + unsigned long arg2) |
---|
| 468 | +{ |
---|
| 469 | + return SIP_RET_NOT_SUPPORTED; |
---|
| 470 | +} |
---|
303 | 471 | #endif |
---|
304 | 472 | |
---|
305 | 473 | /* 32-bit OP-TEE context, never change order of members! */ |
---|