exynos-ppmu.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * exynos_ppmu.h - Exynos PPMU header file
  4. *
  5. * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  6. * Author : Chanwoo Choi <[email protected]>
  7. */
  8. #ifndef __EXYNOS_PPMU_H__
  9. #define __EXYNOS_PPMU_H__
  10. enum ppmu_state {
  11. PPMU_DISABLE = 0,
  12. PPMU_ENABLE,
  13. };
  14. enum ppmu_counter {
  15. PPMU_PMNCNT0 = 0,
  16. PPMU_PMNCNT1,
  17. PPMU_PMNCNT2,
  18. PPMU_PMNCNT3,
  19. PPMU_PMNCNT_MAX,
  20. };
  21. /***
  22. * PPMUv1.1 Definitions
  23. */
  24. enum ppmu_event_type {
  25. PPMU_RO_BUSY_CYCLE_CNT = 0x0,
  26. PPMU_WO_BUSY_CYCLE_CNT = 0x1,
  27. PPMU_RW_BUSY_CYCLE_CNT = 0x2,
  28. PPMU_RO_REQUEST_CNT = 0x3,
  29. PPMU_WO_REQUEST_CNT = 0x4,
  30. PPMU_RO_DATA_CNT = 0x5,
  31. PPMU_WO_DATA_CNT = 0x6,
  32. PPMU_RO_LATENCY = 0x12,
  33. PPMU_WO_LATENCY = 0x16,
  34. };
  35. enum ppmu_reg {
  36. /* PPC control register */
  37. PPMU_PMNC = 0x00,
  38. PPMU_CNTENS = 0x10,
  39. PPMU_CNTENC = 0x20,
  40. PPMU_INTENS = 0x30,
  41. PPMU_INTENC = 0x40,
  42. PPMU_FLAG = 0x50,
  43. /* Cycle Counter and Performance Event Counter Register */
  44. PPMU_CCNT = 0x100,
  45. PPMU_PMCNT0 = 0x110,
  46. PPMU_PMCNT1 = 0x120,
  47. PPMU_PMCNT2 = 0x130,
  48. PPMU_PMCNT3_HIGH = 0x140,
  49. PPMU_PMCNT3_LOW = 0x150,
  50. /* Bus Event Generator */
  51. PPMU_BEVT0SEL = 0x1000,
  52. PPMU_BEVT1SEL = 0x1100,
  53. PPMU_BEVT2SEL = 0x1200,
  54. PPMU_BEVT3SEL = 0x1300,
  55. PPMU_COUNTER_RESET = 0x1810,
  56. PPMU_READ_OVERFLOW_CNT = 0x1810,
  57. PPMU_READ_UNDERFLOW_CNT = 0x1814,
  58. PPMU_WRITE_OVERFLOW_CNT = 0x1850,
  59. PPMU_WRITE_UNDERFLOW_CNT = 0x1854,
  60. PPMU_READ_PENDING_CNT = 0x1880,
  61. PPMU_WRITE_PENDING_CNT = 0x1884
  62. };
  63. /* PMNC register */
  64. #define PPMU_PMNC_CC_RESET_SHIFT 2
  65. #define PPMU_PMNC_COUNTER_RESET_SHIFT 1
  66. #define PPMU_PMNC_ENABLE_SHIFT 0
  67. #define PPMU_PMNC_START_MODE_MASK BIT(16)
  68. #define PPMU_PMNC_CC_DIVIDER_MASK BIT(3)
  69. #define PPMU_PMNC_CC_RESET_MASK BIT(2)
  70. #define PPMU_PMNC_COUNTER_RESET_MASK BIT(1)
  71. #define PPMU_PMNC_ENABLE_MASK BIT(0)
  72. /* CNTENS/CNTENC/INTENS/INTENC/FLAG register */
  73. #define PPMU_CCNT_MASK BIT(31)
  74. #define PPMU_PMCNT3_MASK BIT(3)
  75. #define PPMU_PMCNT2_MASK BIT(2)
  76. #define PPMU_PMCNT1_MASK BIT(1)
  77. #define PPMU_PMCNT0_MASK BIT(0)
  78. /* PPMU_PMNCTx/PPMU_BETxSEL registers */
  79. #define PPMU_PMNCT(x) (PPMU_PMCNT0 + (0x10 * x))
  80. #define PPMU_BEVTxSEL(x) (PPMU_BEVT0SEL + (0x100 * x))
  81. /***
  82. * PPMU_V2.0 definitions
  83. */
  84. enum ppmu_v2_mode {
  85. PPMU_V2_MODE_MANUAL = 0,
  86. PPMU_V2_MODE_AUTO = 1,
  87. PPMU_V2_MODE_CIG = 2, /* CIG (Conditional Interrupt Generation) */
  88. };
  89. enum ppmu_v2_event_type {
  90. PPMU_V2_RO_DATA_CNT = 0x4,
  91. PPMU_V2_WO_DATA_CNT = 0x5,
  92. PPMU_V2_EVT3_RW_DATA_CNT = 0x22, /* Only for Event3 */
  93. };
  94. enum ppmu_V2_reg {
  95. /* PPC control register */
  96. PPMU_V2_PMNC = 0x04,
  97. PPMU_V2_CNTENS = 0x08,
  98. PPMU_V2_CNTENC = 0x0c,
  99. PPMU_V2_INTENS = 0x10,
  100. PPMU_V2_INTENC = 0x14,
  101. PPMU_V2_FLAG = 0x18,
  102. /* Cycle Counter and Performance Event Counter Register */
  103. PPMU_V2_CCNT = 0x48,
  104. PPMU_V2_PMCNT0 = 0x34,
  105. PPMU_V2_PMCNT1 = 0x38,
  106. PPMU_V2_PMCNT2 = 0x3c,
  107. PPMU_V2_PMCNT3_LOW = 0x40,
  108. PPMU_V2_PMCNT3_HIGH = 0x44,
  109. /* Bus Event Generator */
  110. PPMU_V2_CIG_CFG0 = 0x1c,
  111. PPMU_V2_CIG_CFG1 = 0x20,
  112. PPMU_V2_CIG_CFG2 = 0x24,
  113. PPMU_V2_CIG_RESULT = 0x28,
  114. PPMU_V2_CNT_RESET = 0x2c,
  115. PPMU_V2_CNT_AUTO = 0x30,
  116. PPMU_V2_CH_EV0_TYPE = 0x200,
  117. PPMU_V2_CH_EV1_TYPE = 0x204,
  118. PPMU_V2_CH_EV2_TYPE = 0x208,
  119. PPMU_V2_CH_EV3_TYPE = 0x20c,
  120. PPMU_V2_SM_ID_V = 0x220,
  121. PPMU_V2_SM_ID_A = 0x224,
  122. PPMU_V2_SM_OTHERS_V = 0x228,
  123. PPMU_V2_SM_OTHERS_A = 0x22c,
  124. PPMU_V2_INTERRUPT_RESET = 0x260,
  125. };
  126. /* PMNC register */
  127. #define PPMU_V2_PMNC_START_MODE_SHIFT 20
  128. #define PPMU_V2_PMNC_START_MODE_MASK (0x3 << PPMU_V2_PMNC_START_MODE_SHIFT)
  129. #define PPMU_PMNC_CC_RESET_SHIFT 2
  130. #define PPMU_PMNC_COUNTER_RESET_SHIFT 1
  131. #define PPMU_PMNC_ENABLE_SHIFT 0
  132. #define PPMU_PMNC_START_MODE_MASK BIT(16)
  133. #define PPMU_PMNC_CC_DIVIDER_MASK BIT(3)
  134. #define PPMU_PMNC_CC_RESET_MASK BIT(2)
  135. #define PPMU_PMNC_COUNTER_RESET_MASK BIT(1)
  136. #define PPMU_PMNC_ENABLE_MASK BIT(0)
  137. #define PPMU_V2_PMNCT(x) (PPMU_V2_PMCNT0 + (0x4 * x))
  138. #define PPMU_V2_CH_EVx_TYPE(x) (PPMU_V2_CH_EV0_TYPE + (0x4 * x))
  139. #endif /* __EXYNOS_PPMU_H__ */