exynos-ppmu.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. 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. #endif /* __EXYNOS_PPMU_H__ */