mt_spm_cond.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright (c) 2020-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_INFRA_5,
  17. PLAT_SPM_COND_CG_MMSYS_0,
  18. PLAT_SPM_COND_CG_MMSYS_1,
  19. PLAT_SPM_COND_CG_MMSYS_2,
  20. PLAT_SPM_COND_MAX,
  21. };
  22. #define PLL_BIT_UNIVPLL BIT(0)
  23. #define PLL_BIT_MFGPLL BIT(1)
  24. #define PLL_BIT_MSDCPLL BIT(2)
  25. #define PLL_BIT_TVDPLL BIT(3)
  26. #define PLL_BIT_MMPLL BIT(4)
  27. /* Definition about SPM_COND_CHECK_BLOCKED
  28. * bit [00 ~ 15]: cg blocking index
  29. * bit [16 ~ 29]: pll blocking index
  30. * bit [30] : pll blocking information
  31. * bit [31] : idle condition check fail
  32. */
  33. #define SPM_COND_BLOCKED_CG_IDX U(0)
  34. #define SPM_COND_BLOCKED_PLL_IDX U(16)
  35. #define SPM_COND_CHECK_BLOCKED_PLL BIT(30)
  36. #define SPM_COND_CHECK_FAIL BIT(31)
  37. struct mt_spm_cond_tables {
  38. char *name;
  39. unsigned int table_cg[PLAT_SPM_COND_MAX];
  40. unsigned int table_pll;
  41. void *priv;
  42. };
  43. extern unsigned int mt_spm_cond_check(int state_id,
  44. const struct mt_spm_cond_tables *src,
  45. const struct mt_spm_cond_tables *dest,
  46. struct mt_spm_cond_tables *res);
  47. extern int mt_spm_cond_update(struct mt_resource_constraint **con, unsigned int num,
  48. int stateid, void *priv);
  49. #endif /* MT_SPM_CONDIT_H */