.. | .. |
---|
262 | 262 | |
---|
263 | 263 | return res; |
---|
264 | 264 | } |
---|
| 265 | +EXPORT_SYMBOL_GPL(sip_smc_lastlog_request); |
---|
265 | 266 | |
---|
266 | 267 | int sip_smc_amp_config(u32 sub_func_id, u32 arg1, u32 arg2, u32 arg3) |
---|
267 | 268 | { |
---|
.. | .. |
---|
271 | 272 | 0, 0, 0, &res); |
---|
272 | 273 | return res.a0; |
---|
273 | 274 | } |
---|
| 275 | +EXPORT_SYMBOL_GPL(sip_smc_amp_config); |
---|
274 | 276 | |
---|
275 | 277 | struct arm_smccc_res sip_smc_get_amp_info(u32 sub_func_id, u32 arg1) |
---|
276 | 278 | { |
---|
.. | .. |
---|
279 | 281 | arm_smccc_smc(RK_SIP_AMP_CFG, sub_func_id, arg1, 0, 0, 0, 0, 0, &res); |
---|
280 | 282 | return res; |
---|
281 | 283 | } |
---|
| 284 | +EXPORT_SYMBOL_GPL(sip_smc_get_amp_info); |
---|
282 | 285 | |
---|
283 | | -EXPORT_SYMBOL_GPL(sip_smc_lastlog_request); |
---|
| 286 | +struct arm_smccc_res sip_smc_get_pvtpll_info(u32 sub_func_id, u32 arg1) |
---|
| 287 | +{ |
---|
| 288 | + struct arm_smccc_res res; |
---|
| 289 | + |
---|
| 290 | + /* |
---|
| 291 | + * res.a0: error code(0: success, !0: error). |
---|
| 292 | + * res.a1: low temp config flag(0: support, !0: don't support). |
---|
| 293 | + */ |
---|
| 294 | + arm_smccc_smc(SIP_PVTPLL_CFG, sub_func_id, arg1, 0, 0, 0, 0, 0, &res); |
---|
| 295 | + return res; |
---|
| 296 | +} |
---|
| 297 | +EXPORT_SYMBOL_GPL(sip_smc_get_pvtpll_info); |
---|
| 298 | + |
---|
| 299 | +struct arm_smccc_res sip_smc_pvtpll_config(u32 sub_func_id, u32 arg1, u32 arg2, |
---|
| 300 | + u32 arg3, u32 arg4, u32 arg5, u32 arg6) |
---|
| 301 | +{ |
---|
| 302 | + struct arm_smccc_res res; |
---|
| 303 | + |
---|
| 304 | + /* |
---|
| 305 | + * res.a0: error code(0: success, !0: error). |
---|
| 306 | + */ |
---|
| 307 | + arm_smccc_smc(SIP_PVTPLL_CFG, sub_func_id, arg1, arg2, arg3, arg4, arg5, |
---|
| 308 | + arg6, &res); |
---|
| 309 | + return res; |
---|
| 310 | +} |
---|
| 311 | +EXPORT_SYMBOL_GPL(sip_smc_pvtpll_config); |
---|
| 312 | + |
---|
| 313 | +void __iomem *sip_hdcp_request_share_memory(int id) |
---|
| 314 | +{ |
---|
| 315 | + static void __iomem *base; |
---|
| 316 | + struct arm_smccc_res res; |
---|
| 317 | + |
---|
| 318 | + if (id < 0 || id >= MAX_DEVICE) { |
---|
| 319 | + pr_err("%s: invalid device id\n", __func__); |
---|
| 320 | + return NULL; |
---|
| 321 | + } |
---|
| 322 | + |
---|
| 323 | + if (!base) { |
---|
| 324 | + /* request page share memory */ |
---|
| 325 | + res = sip_smc_request_share_mem(2, SHARE_PAGE_TYPE_HDCP); |
---|
| 326 | + if (IS_SIP_ERROR(res.a0)) |
---|
| 327 | + return NULL; |
---|
| 328 | + base = (void __iomem *)res.a1; |
---|
| 329 | + } |
---|
| 330 | + |
---|
| 331 | + return base + id * 1024; |
---|
| 332 | +} |
---|
| 333 | +EXPORT_SYMBOL_GPL(sip_hdcp_request_share_memory); |
---|
| 334 | + |
---|
| 335 | +struct arm_smccc_res sip_hdcp_config(u32 arg0, u32 arg1, u32 arg2) |
---|
| 336 | +{ |
---|
| 337 | + struct arm_smccc_res res; |
---|
| 338 | + |
---|
| 339 | + res = __invoke_sip_fn_smc(SIP_HDCP_CONFIG, arg0, arg1, arg2); |
---|
| 340 | + return res; |
---|
| 341 | +} |
---|
| 342 | +EXPORT_SYMBOL_GPL(sip_hdcp_config); |
---|
284 | 343 | |
---|
285 | 344 | /************************** fiq debugger **************************************/ |
---|
286 | 345 | /* |
---|
.. | .. |
---|
300 | 359 | static int fiq_target_cpu; |
---|
301 | 360 | static phys_addr_t ft_fiq_mem_phy; |
---|
302 | 361 | static void __iomem *ft_fiq_mem_base; |
---|
303 | | -static void (*sip_fiq_debugger_uart_irq_tf)(struct pt_regs *_pt_regs, |
---|
304 | | - uint32_t cpu); |
---|
| 362 | +static sip_fiq_debugger_uart_irq_tf_cb_t sip_fiq_debugger_uart_irq_tf; |
---|
305 | 363 | static struct pt_regs fiq_pt_regs; |
---|
306 | 364 | |
---|
307 | 365 | int sip_fiq_debugger_is_enabled(void) |
---|
.. | .. |
---|
388 | 446 | |
---|
389 | 447 | static void sip_fiq_debugger_uart_irq_tf_cb(unsigned long sp_el1, |
---|
390 | 448 | unsigned long offset, |
---|
391 | | - uint32_t cpu) |
---|
| 449 | + unsigned long cpu) |
---|
392 | 450 | { |
---|
393 | 451 | char *cpu_context; |
---|
394 | 452 | |
---|
.. | .. |
---|
403 | 461 | __invoke_sip_fn_smc(SIP_UARTDBG_FN, 0, 0, UARTDBG_CFG_OSHDL_TO_OS); |
---|
404 | 462 | } |
---|
405 | 463 | |
---|
406 | | -int sip_fiq_debugger_uart_irq_tf_init(u32 irq_id, void *callback_fn) |
---|
| 464 | +int sip_fiq_debugger_uart_irq_tf_init(u32 irq_id, sip_fiq_debugger_uart_irq_tf_cb_t callback_fn) |
---|
407 | 465 | { |
---|
408 | 466 | struct arm_smccc_res res; |
---|
| 467 | + |
---|
| 468 | + fiq_target_cpu = 0; |
---|
409 | 469 | |
---|
410 | 470 | /* init fiq debugger callback */ |
---|
411 | 471 | sip_fiq_debugger_uart_irq_tf = callback_fn; |
---|
.. | .. |
---|
438 | 498 | { |
---|
439 | 499 | #ifdef MODULE |
---|
440 | 500 | /* Empirically, local "cpu_logical_map()" for rockchip platforms */ |
---|
441 | | - ulong mpidr = 0x00; |
---|
| 501 | + ulong mpidr = read_cpuid_mpidr(); |
---|
442 | 502 | |
---|
443 | | - if (cpu < 4) |
---|
444 | | - /* 0x00, 0x01, 0x02, 0x03 */ |
---|
445 | | - mpidr = cpu; |
---|
446 | | - else if (cpu < 8) |
---|
447 | | - /* 0x100, 0x101, 0x102, 0x103 */ |
---|
448 | | - mpidr = 0x100 | (cpu - 4); |
---|
449 | | - else |
---|
450 | | - pr_err("Unsupported map cpu: %d\n", cpu); |
---|
| 503 | + if (mpidr & MPIDR_MT_BITMASK) { |
---|
| 504 | + /* 0x100, 0x200, 0x300, 0x400 ... */ |
---|
| 505 | + mpidr = (cpu & 0xff) << 8; |
---|
| 506 | + } else { |
---|
| 507 | + if (cpu < 4) |
---|
| 508 | + /* 0x00, 0x01, 0x02, 0x03 */ |
---|
| 509 | + mpidr = cpu; |
---|
| 510 | + else if (cpu < 8) |
---|
| 511 | + /* 0x100, 0x101, 0x102, 0x103 */ |
---|
| 512 | + mpidr = 0x100 | (cpu - 4); |
---|
| 513 | + else |
---|
| 514 | + pr_err("Unsupported map cpu: %d\n", cpu); |
---|
| 515 | + } |
---|
451 | 516 | |
---|
452 | 517 | return mpidr; |
---|
453 | 518 | #else |
---|
454 | 519 | return cpu_logical_map(cpu); |
---|
455 | 520 | #endif |
---|
456 | 521 | } |
---|
| 522 | + |
---|
| 523 | +ulong sip_cpu_logical_map_mpidr(u32 cpu) |
---|
| 524 | +{ |
---|
| 525 | + return cpu_logical_map_mpidr(cpu); |
---|
| 526 | +} |
---|
| 527 | +EXPORT_SYMBOL_GPL(sip_cpu_logical_map_mpidr); |
---|
457 | 528 | |
---|
458 | 529 | int sip_fiq_debugger_switch_cpu(u32 cpu) |
---|
459 | 530 | { |
---|
.. | .. |
---|
541 | 612 | } |
---|
542 | 613 | EXPORT_SYMBOL_GPL(sip_fiq_debugger_enable_fiq); |
---|
543 | 614 | |
---|
| 615 | +int sip_fiq_control(u32 sub_func, u32 irq, unsigned long data) |
---|
| 616 | +{ |
---|
| 617 | + struct arm_smccc_res res; |
---|
| 618 | + |
---|
| 619 | + res = __invoke_sip_fn_smc(RK_SIP_FIQ_CTRL, |
---|
| 620 | + sub_func, irq, data); |
---|
| 621 | + return res.a0; |
---|
| 622 | +} |
---|
| 623 | +EXPORT_SYMBOL_GPL(sip_fiq_control); |
---|
| 624 | + |
---|
| 625 | +int sip_wdt_config(u32 sub_func, u32 arg1, u32 arg2, u32 arg3) |
---|
| 626 | +{ |
---|
| 627 | + struct arm_smccc_res res; |
---|
| 628 | + |
---|
| 629 | + arm_smccc_smc(SIP_WDT_CFG, sub_func, arg1, arg2, arg3, |
---|
| 630 | + 0, 0, 0, &res); |
---|
| 631 | + |
---|
| 632 | + return res.a0; |
---|
| 633 | +} |
---|
| 634 | +EXPORT_SYMBOL_GPL(sip_wdt_config); |
---|
| 635 | + |
---|
| 636 | +int sip_hdmirx_config(u32 sub_func, u32 arg1, u32 arg2, u32 arg3) |
---|
| 637 | +{ |
---|
| 638 | + struct arm_smccc_res res; |
---|
| 639 | + |
---|
| 640 | + arm_smccc_smc(SIP_HDMIRX_CFG, sub_func, arg1, arg2, arg3, |
---|
| 641 | + 0, 0, 0, &res); |
---|
| 642 | + |
---|
| 643 | + return res.a0; |
---|
| 644 | +} |
---|
| 645 | +EXPORT_SYMBOL_GPL(sip_hdmirx_config); |
---|
| 646 | + |
---|
| 647 | +int sip_hdcpkey_init(u32 hdcp_id) |
---|
| 648 | +{ |
---|
| 649 | + struct arm_smccc_res res; |
---|
| 650 | + |
---|
| 651 | + res = __invoke_sip_fn_smc(TRUSTED_OS_HDCPKEY_INIT, hdcp_id, 0, 0); |
---|
| 652 | + |
---|
| 653 | + return res.a0; |
---|
| 654 | +} |
---|
| 655 | +EXPORT_SYMBOL_GPL(sip_hdcpkey_init); |
---|
| 656 | + |
---|
| 657 | +int sip_smc_mcu_config(unsigned long mcu_id, |
---|
| 658 | + unsigned long func, |
---|
| 659 | + unsigned long arg2) |
---|
| 660 | +{ |
---|
| 661 | + struct arm_smccc_res res; |
---|
| 662 | + |
---|
| 663 | + res = __invoke_sip_fn_smc(SIP_MCU_CFG, mcu_id, func, arg2); |
---|
| 664 | + return res.a0; |
---|
| 665 | +} |
---|
| 666 | +EXPORT_SYMBOL_GPL(sip_smc_mcu_config); |
---|
544 | 667 | /******************************************************************************/ |
---|
545 | 668 | #ifdef CONFIG_ARM |
---|
546 | 669 | static __init int sip_firmware_init(void) |
---|