mt_spm_cond.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (c) 2021-2023, MediaTek Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef MT_SPM_CONDIT_H
  7. #define MT_SPM_CONDIT_H
  8. #include <mt_lp_rm.h>
  9. enum PLAT_SPM_COND {
  10. PLAT_SPM_COND_MTCMOS1 = 0,
  11. PLAT_SPM_COND_CG_INFRA_0,
  12. PLAT_SPM_COND_CG_INFRA_1,
  13. PLAT_SPM_COND_CG_INFRA_2,
  14. PLAT_SPM_COND_CG_INFRA_3,
  15. PLAT_SPM_COND_CG_INFRA_4,
  16. PLAT_SPM_COND_CG_PERI_SW_0,
  17. PLAT_SPM_COND_CG_VPPSYS0_SW_CG_0,
  18. PLAT_SPM_COND_CG_VPPSYS0_SW_CG_1,
  19. PLAT_SPM_COND_CG_VPPSYS0_SW_CG_2,
  20. PLAT_SPM_COND_CG_VPPSYS1_SW_CG_0,
  21. PLAT_SPM_COND_CG_VPPSYS1_SW_CG_1,
  22. PLAT_SPM_COND_CG_VDOSYS0_SW_CG_0,
  23. PLAT_SPM_COND_CG_VDOSYS0_SW_CG_1,
  24. PLAT_SPM_COND_CG_VDOSYS1_SW_CG_0,
  25. PLAT_SPM_COND_CG_VDOSYS1_SW_CG_1,
  26. PLAT_SPM_COND_CG_VDOSYS1_SW_CG_2,
  27. PLAT_SPM_COND_CG_I2C_SW_CG,
  28. PLAT_SPM_COND_MAX,
  29. };
  30. enum PLAT_SPM_COND_PLL {
  31. PLAT_SPM_COND_PLL_UNIVPLL = 0,
  32. PLAT_SPM_COND_PLL_MFGPLL,
  33. PLAT_SPM_COND_PLL_MSDCPLL,
  34. PLAT_SPM_COND_PLL_TVDPLL,
  35. PLAT_SPM_COND_PLL_MMPLL,
  36. PLAT_SPM_COND_PLL_MAX,
  37. };
  38. #define PLL_BIT_MFGPLL BIT(PLAT_SPM_COND_PLL_MFGPLL)
  39. #define PLL_BIT_MMPLL BIT(PLAT_SPM_COND_PLL_MMPLL)
  40. #define PLL_BIT_UNIVPLL BIT(PLAT_SPM_COND_PLL_UNIVPLL)
  41. #define PLL_BIT_MSDCPLL BIT(PLAT_SPM_COND_PLL_MSDCPLL)
  42. #define PLL_BIT_TVDPLL BIT(PLAT_SPM_COND_PLL_TVDPLL)
  43. /* Definition about SPM_COND_CHECK_BLOCKED
  44. * bit [00 ~ 17]: cg blocking index
  45. * bit [18 ~ 29]: pll blocking index
  46. * bit [30] : pll blocking information
  47. * bit [31] : idle condition check fail
  48. */
  49. #define SPM_COND_BLOCKED_CG_IDX U(0)
  50. #define SPM_COND_BLOCKED_PLL_IDX U(18)
  51. #define SPM_COND_CHECK_BLOCKED_PLL BIT(30)
  52. #define SPM_COND_CHECK_FAIL BIT(31)
  53. struct mt_spm_cond_tables {
  54. char *name;
  55. unsigned int table_cg[PLAT_SPM_COND_MAX];
  56. unsigned int table_pll;
  57. void *priv;
  58. };
  59. extern unsigned int mt_spm_cond_check(int state_id,
  60. const struct mt_spm_cond_tables *src,
  61. const struct mt_spm_cond_tables *dest,
  62. struct mt_spm_cond_tables *res);
  63. extern int mt_spm_cond_update(struct mt_resource_constraint **con, unsigned int num,
  64. int stateid, void *priv);
  65. #endif /* MT_SPM_CONDIT_H */