exynos-ppmu.h 4.0 KB

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