mt_spm_cond.h 1.5 KB

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