mt_spm_rc_internal.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Copyright (c) 2023, MediaTek Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef MT_SPM_RC_INTERNAL_H
  7. #define MT_SPM_RC_INTERNAL_H
  8. #ifdef MTK_PLAT_SPM_SRAM_SLP_UNSUPPORT
  9. #define SPM_FLAG_SRAM_SLEEP_CTRL (SPM_FLAG_DISABLE_DRAMC_MCU_SRAM_SLEEP)
  10. #define SPM_SRAM_SLEEP_RC_RES_RESTRICT (0)
  11. #else
  12. #define SPM_FLAG_SRAM_SLEEP_CTRL (0)
  13. #define SPM_SRAM_SLEEP_RC_RES_RESTRICT (0)
  14. #endif
  15. #define SPM_RC_UPDATE_COND_ID_MASK (0xffff)
  16. #define SPM_RC_UPDATE_COND_RC_ID_MASK (0xffff)
  17. #define SPM_RC_UPDATE_COND_RC_ID_SHIFT (16)
  18. #define SPM_RC_UPDATE_COND_RC_ID_GET(val) \
  19. ((val >> SPM_RC_UPDATE_COND_RC_ID_SHIFT) & SPM_RC_UPDATE_COND_RC_ID_MASK)
  20. #define SPM_RC_UPDATE_COND_ID_GET(val) (val & SPM_RC_UPDATE_COND_ID_MASK)
  21. /* cpu buck/ldo constraint function */
  22. bool spm_is_valid_rc_cpu_buck_ldo(unsigned int cpu, int state_id);
  23. int spm_update_rc_cpu_buck_ldo(int state_id, int type, const void *val);
  24. unsigned int spm_allow_rc_cpu_buck_ldo(int state_id);
  25. int spm_run_rc_cpu_buck_ldo(unsigned int cpu, int state_id);
  26. int spm_reset_rc_cpu_buck_ldo(unsigned int cpu, int state_id);
  27. int spm_get_status_rc_cpu_buck_ldo(unsigned int type, void *priv);
  28. /* spm resource dram constraint function */
  29. bool spm_is_valid_rc_dram(unsigned int cpu, int state_id);
  30. int spm_update_rc_dram(int state_id, int type, const void *val);
  31. unsigned int spm_allow_rc_dram(int state_id);
  32. int spm_run_rc_dram(unsigned int cpu, int state_id);
  33. int spm_reset_rc_dram(unsigned int cpu, int state_id);
  34. int spm_get_status_rc_dram(unsigned int type, void *priv);
  35. /* spm resource syspll constraint function */
  36. bool spm_is_valid_rc_syspll(unsigned int cpu, int state_id);
  37. int spm_update_rc_syspll(int state_id, int type, const void *val);
  38. unsigned int spm_allow_rc_syspll(int state_id);
  39. int spm_run_rc_syspll(unsigned int cpu, int state_id);
  40. int spm_reset_rc_syspll(unsigned int cpu, int state_id);
  41. int spm_get_status_rc_syspll(unsigned int type, void *priv);
  42. /* spm resource bus26m constraint function */
  43. bool spm_is_valid_rc_bus26m(unsigned int cpu, int state_id);
  44. int spm_update_rc_bus26m(int state_id, int type, const void *val);
  45. unsigned int spm_allow_rc_bus26m(int state_id);
  46. int spm_run_rc_bus26m(unsigned int cpu, int state_id);
  47. int spm_reset_rc_bus26m(unsigned int cpu, int state_id);
  48. int spm_get_status_rc_bus26m(unsigned int type, void *priv);
  49. #endif