| .. | .. |
|---|
| 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 | +}; |
|---|
| 155 | 236 | |
|---|
| 156 | 237 | struct pt_regs; |
|---|
| 157 | 238 | typedef void (*sip_fiq_debugger_uart_irq_tf_cb_t)(struct pt_regs *_pt_regs, unsigned long cpu); |
|---|
| .. | .. |
|---|
| 162 | 243 | * a0: error code(0: success, !0: error); |
|---|
| 163 | 244 | * a1~a3: data |
|---|
| 164 | 245 | */ |
|---|
| 165 | | -#if IS_ENABLED(CONFIG_ROCKCHIP_SIP) |
|---|
| 246 | +#if IS_REACHABLE(CONFIG_ROCKCHIP_SIP) |
|---|
| 166 | 247 | struct arm_smccc_res sip_smc_get_atf_version(void); |
|---|
| 167 | 248 | struct arm_smccc_res sip_smc_get_sip_version(void); |
|---|
| 168 | 249 | struct arm_smccc_res sip_smc_dram(u32 arg0, u32 arg1, u32 arg2); |
|---|
| .. | .. |
|---|
| 180 | 261 | int sip_smc_secure_reg_write(u32 addr_phy, u32 val); |
|---|
| 181 | 262 | u32 sip_smc_secure_reg_read(u32 addr_phy); |
|---|
| 182 | 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); |
|---|
| 183 | 265 | int sip_smc_amp_config(u32 sub_func_id, u32 arg1, u32 arg2, u32 arg3); |
|---|
| 184 | 266 | struct arm_smccc_res sip_smc_get_amp_info(u32 sub_func_id, u32 arg1); |
|---|
| 185 | | -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); |
|---|
| 186 | 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); |
|---|
| 187 | 274 | /***************************fiq debugger **************************************/ |
|---|
| 188 | 275 | void sip_fiq_debugger_enable_fiq(bool enable, uint32_t tgt_cpu); |
|---|
| 189 | 276 | void sip_fiq_debugger_enable_debug(bool enable); |
|---|
| .. | .. |
|---|
| 195 | 282 | int sip_fiq_debugger_sdei_switch_cpu(u32 cur_cpu, u32 target_cpu, u32 flag); |
|---|
| 196 | 283 | int sip_fiq_debugger_is_enabled(void); |
|---|
| 197 | 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); |
|---|
| 198 | 290 | #else |
|---|
| 199 | 291 | static inline struct arm_smccc_res sip_smc_get_atf_version(void) |
|---|
| 200 | 292 | { |
|---|
| 201 | | - struct arm_smccc_res tmp = {0}; |
|---|
| 293 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
|---|
| 202 | 294 | return tmp; |
|---|
| 203 | 295 | } |
|---|
| 204 | 296 | |
|---|
| 205 | 297 | static inline struct arm_smccc_res sip_smc_get_sip_version(void) |
|---|
| 206 | 298 | { |
|---|
| 207 | | - struct arm_smccc_res tmp = {0}; |
|---|
| 299 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
|---|
| 208 | 300 | return tmp; |
|---|
| 209 | 301 | } |
|---|
| 210 | 302 | |
|---|
| 211 | 303 | static inline struct arm_smccc_res sip_smc_dram(u32 arg0, u32 arg1, u32 arg2) |
|---|
| 212 | 304 | { |
|---|
| 213 | | - struct arm_smccc_res tmp = {0}; |
|---|
| 305 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
|---|
| 214 | 306 | return tmp; |
|---|
| 215 | 307 | } |
|---|
| 216 | 308 | |
|---|
| 217 | 309 | static inline struct arm_smccc_res sip_smc_request_share_mem |
|---|
| 218 | 310 | (u32 page_num, share_page_type_t page_type) |
|---|
| 219 | 311 | { |
|---|
| 220 | | - struct arm_smccc_res tmp = {0}; |
|---|
| 312 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
|---|
| 221 | 313 | return tmp; |
|---|
| 222 | 314 | } |
|---|
| 223 | 315 | |
|---|
| 224 | 316 | static inline struct arm_smccc_res sip_smc_mcu_el3fiq |
|---|
| 225 | 317 | (u32 arg0, u32 arg1, u32 arg2) |
|---|
| 226 | 318 | { |
|---|
| 227 | | - struct arm_smccc_res tmp = {0}; |
|---|
| 319 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
|---|
| 228 | 320 | return tmp; |
|---|
| 229 | 321 | } |
|---|
| 230 | 322 | |
|---|
| 231 | 323 | static inline struct arm_smccc_res |
|---|
| 232 | 324 | sip_smc_vpu_reset(u32 arg0, u32 arg1, u32 arg2) |
|---|
| 233 | 325 | { |
|---|
| 234 | | - 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 }; |
|---|
| 235 | 333 | return tmp; |
|---|
| 236 | 334 | } |
|---|
| 237 | 335 | |
|---|
| 238 | 336 | static inline struct arm_smccc_res sip_smc_lastlog_request(void) |
|---|
| 239 | 337 | { |
|---|
| 240 | | - struct arm_smccc_res tmp = {0}; |
|---|
| 338 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
|---|
| 241 | 339 | return tmp; |
|---|
| 242 | 340 | } |
|---|
| 243 | 341 | |
|---|
| .. | .. |
|---|
| 246 | 344 | return 0; |
|---|
| 247 | 345 | } |
|---|
| 248 | 346 | |
|---|
| 249 | | -static inline int sip_smc_get_suspend_info(u32 info) |
|---|
| 250 | | -{ |
|---|
| 251 | | - return 0; |
|---|
| 252 | | -} |
|---|
| 253 | | - |
|---|
| 254 | 347 | static inline int sip_smc_virtual_poweroff(void) { return 0; } |
|---|
| 255 | 348 | static inline int sip_smc_remotectl_config(u32 func, u32 data) { return 0; } |
|---|
| 256 | | -static inline u32 sip_smc_secure_reg_read(u32 addr_phy) { return 0; } |
|---|
| 257 | 349 | static inline int sip_smc_secure_reg_write(u32 addr_phy, u32 val) { return 0; } |
|---|
| 258 | | -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) |
|---|
| 259 | 353 | { |
|---|
| 260 | | - return 0; |
|---|
| 354 | + struct arm_smccc_res tmp = { .a0 = SIP_RET_NOT_SUPPORTED }; |
|---|
| 355 | + return tmp; |
|---|
| 261 | 356 | } |
|---|
| 357 | + |
|---|
| 262 | 358 | static inline struct dram_addrmap_info *sip_smc_get_dram_map(void) |
|---|
| 263 | 359 | { |
|---|
| 264 | 360 | return NULL; |
|---|
| .. | .. |
|---|
| 279 | 375 | |
|---|
| 280 | 376 | return tmp; |
|---|
| 281 | 377 | } |
|---|
| 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; } |
|---|
| 282 | 410 | |
|---|
| 283 | 411 | /***************************fiq debugger **************************************/ |
|---|
| 284 | 412 | static inline void sip_fiq_debugger_enable_fiq |
|---|
| .. | .. |
|---|
| 303 | 431 | static inline int sip_fiq_debugger_sdei_switch_cpu(u32 cur_cpu, u32 target_cpu, |
|---|
| 304 | 432 | u32 flag) { return 0; } |
|---|
| 305 | 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 | +} |
|---|
| 306 | 471 | #endif |
|---|
| 307 | 472 | |
|---|
| 308 | 473 | /* 32-bit OP-TEE context, never change order of members! */ |
|---|