plat_private.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * Copyright (c) 2014-2023, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef PLAT_PRIVATE_H
  7. #define PLAT_PRIVATE_H
  8. #ifndef __ASSEMBLER__
  9. #include <stdint.h>
  10. #include <lib/mmio.h>
  11. #include <lib/psci/psci.h>
  12. #include <lib/xlat_tables/xlat_tables_compat.h>
  13. #include <plat_params.h>
  14. #define __sramdata __attribute__((section(".sram.data")))
  15. #define __sramconst __attribute__((section(".sram.rodata")))
  16. #define __sramfunc __attribute__((section(".sram.text")))
  17. #define __pmusramdata __attribute__((section(".pmusram.data")))
  18. #define __pmusramconst __attribute__((section(".pmusram.rodata")))
  19. #define __pmusramfunc __attribute__((section(".pmusram.text")))
  20. extern uint32_t __bl31_sram_text_start, __bl31_sram_text_end;
  21. extern uint32_t __bl31_sram_data_start, __bl31_sram_data_end;
  22. extern uint32_t __bl31_sram_stack_start, __bl31_sram_stack_end;
  23. extern uint32_t __bl31_sram_text_real_end, __bl31_sram_data_real_end;
  24. extern uint32_t __sram_incbin_start, __sram_incbin_end;
  25. extern uint32_t __sram_incbin_real_end;
  26. /******************************************************************************
  27. * The register have write-mask bits, it is mean, if you want to set the bits,
  28. * you needs set the write-mask bits at the same time,
  29. * The write-mask bits is in high 16-bits.
  30. * The fllowing macro definition helps access write-mask bits reg efficient!
  31. ******************************************************************************/
  32. #define REG_MSK_SHIFT 16
  33. #ifndef WMSK_BIT
  34. #define WMSK_BIT(nr) BIT((nr) + REG_MSK_SHIFT)
  35. #endif
  36. /* set one bit with write mask */
  37. #ifndef BIT_WITH_WMSK
  38. #define BIT_WITH_WMSK(nr) (BIT(nr) | WMSK_BIT(nr))
  39. #endif
  40. #ifndef BITS_SHIFT
  41. #define BITS_SHIFT(bits, shift) ((bits) << (shift))
  42. #endif
  43. #ifndef BITS_WITH_WMASK
  44. #define BITS_WITH_WMASK(bits, msk, shift)\
  45. (BITS_SHIFT(bits, shift) | BITS_SHIFT(msk, (shift + REG_MSK_SHIFT)))
  46. #endif
  47. /******************************************************************************
  48. * Function and variable prototypes
  49. *****************************************************************************/
  50. #ifdef __aarch64__
  51. void plat_configure_mmu_el3(unsigned long total_base,
  52. unsigned long total_size,
  53. unsigned long,
  54. unsigned long,
  55. unsigned long,
  56. unsigned long);
  57. void rockchip_plat_mmu_el3(void);
  58. #else
  59. void plat_configure_mmu_svc_mon(unsigned long total_base,
  60. unsigned long total_size,
  61. unsigned long,
  62. unsigned long,
  63. unsigned long,
  64. unsigned long);
  65. void rockchip_plat_mmu_svc_mon(void);
  66. #endif
  67. void plat_cci_init(void);
  68. void plat_cci_enable(void);
  69. void plat_cci_disable(void);
  70. void plat_delay_timer_init(void);
  71. void params_early_setup(u_register_t plat_params_from_bl2);
  72. void plat_rockchip_gic_driver_init(void);
  73. void plat_rockchip_gic_init(void);
  74. void plat_rockchip_gic_cpuif_enable(void);
  75. void plat_rockchip_gic_cpuif_disable(void);
  76. void plat_rockchip_gic_pcpu_init(void);
  77. void plat_rockchip_pmu_init(void);
  78. void plat_rockchip_soc_init(void);
  79. uintptr_t plat_get_sec_entrypoint(void);
  80. void platform_cpu_warmboot(void);
  81. struct bl_aux_gpio_info *plat_get_rockchip_gpio_reset(void);
  82. struct bl_aux_gpio_info *plat_get_rockchip_gpio_poweroff(void);
  83. struct bl_aux_gpio_info *plat_get_rockchip_suspend_gpio(uint32_t *count);
  84. struct bl_aux_rk_apio_info *plat_get_rockchip_suspend_apio(void);
  85. void plat_rockchip_gpio_init(void);
  86. void plat_rockchip_save_gpio(void);
  87. void plat_rockchip_restore_gpio(void);
  88. int rockchip_soc_cores_pwr_dm_on(unsigned long mpidr, uint64_t entrypoint);
  89. int rockchip_soc_hlvl_pwr_dm_off(uint32_t lvl,
  90. plat_local_state_t lvl_state);
  91. int rockchip_soc_cores_pwr_dm_off(void);
  92. int rockchip_soc_sys_pwr_dm_suspend(void);
  93. int rockchip_soc_cores_pwr_dm_suspend(void);
  94. int rockchip_soc_hlvl_pwr_dm_suspend(uint32_t lvl,
  95. plat_local_state_t lvl_state);
  96. int rockchip_soc_hlvl_pwr_dm_on_finish(uint32_t lvl,
  97. plat_local_state_t lvl_state);
  98. int rockchip_soc_cores_pwr_dm_on_finish(void);
  99. int rockchip_soc_sys_pwr_dm_resume(void);
  100. int rockchip_soc_hlvl_pwr_dm_resume(uint32_t lvl,
  101. plat_local_state_t lvl_state);
  102. int rockchip_soc_cores_pwr_dm_resume(void);
  103. void __dead2 rockchip_soc_soft_reset(void);
  104. void __dead2 rockchip_soc_system_off(void);
  105. void __dead2 rockchip_soc_cores_pd_pwr_dn_wfi(
  106. const psci_power_state_t *target_state);
  107. void __dead2 rockchip_soc_sys_pd_pwr_dn_wfi(void);
  108. extern const unsigned char rockchip_power_domain_tree_desc[];
  109. extern void *pmu_cpuson_entrypoint;
  110. extern u_register_t cpuson_entry_point[PLATFORM_CORE_COUNT];
  111. extern uint32_t cpuson_flags[PLATFORM_CORE_COUNT];
  112. extern const mmap_region_t plat_rk_mmap[];
  113. uint32_t rockchip_get_uart_base(void);
  114. uint32_t rockchip_get_uart_baudrate(void);
  115. uint32_t rockchip_get_uart_clock(void);
  116. void rockchip_init_scmi_server(void);
  117. #endif /* __ASSEMBLER__ */
  118. /******************************************************************************
  119. * cpu up status
  120. * The bits of macro value is not more than 12 bits for cmp instruction!
  121. ******************************************************************************/
  122. #define PMU_CPU_HOTPLUG 0xf00
  123. #define PMU_CPU_AUTO_PWRDN 0xf0
  124. #define PMU_CLST_RET 0xa5
  125. #endif /* PLAT_PRIVATE_H */