162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * exynos_ppmu.h - Exynos PPMU header file 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (c) 2015 Samsung Electronics Co., Ltd. 662306a36Sopenharmony_ci * Author : Chanwoo Choi <cw00.choi@samsung.com> 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#ifndef __EXYNOS_PPMU_H__ 1062306a36Sopenharmony_ci#define __EXYNOS_PPMU_H__ 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_cienum ppmu_state { 1362306a36Sopenharmony_ci PPMU_DISABLE = 0, 1462306a36Sopenharmony_ci PPMU_ENABLE, 1562306a36Sopenharmony_ci}; 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_cienum ppmu_counter { 1862306a36Sopenharmony_ci PPMU_PMNCNT0 = 0, 1962306a36Sopenharmony_ci PPMU_PMNCNT1, 2062306a36Sopenharmony_ci PPMU_PMNCNT2, 2162306a36Sopenharmony_ci PPMU_PMNCNT3, 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci PPMU_PMNCNT_MAX, 2462306a36Sopenharmony_ci}; 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci/*** 2762306a36Sopenharmony_ci * PPMUv1.1 Definitions 2862306a36Sopenharmony_ci */ 2962306a36Sopenharmony_cienum ppmu_event_type { 3062306a36Sopenharmony_ci PPMU_RO_BUSY_CYCLE_CNT = 0x0, 3162306a36Sopenharmony_ci PPMU_WO_BUSY_CYCLE_CNT = 0x1, 3262306a36Sopenharmony_ci PPMU_RW_BUSY_CYCLE_CNT = 0x2, 3362306a36Sopenharmony_ci PPMU_RO_REQUEST_CNT = 0x3, 3462306a36Sopenharmony_ci PPMU_WO_REQUEST_CNT = 0x4, 3562306a36Sopenharmony_ci PPMU_RO_DATA_CNT = 0x5, 3662306a36Sopenharmony_ci PPMU_WO_DATA_CNT = 0x6, 3762306a36Sopenharmony_ci PPMU_RO_LATENCY = 0x12, 3862306a36Sopenharmony_ci PPMU_WO_LATENCY = 0x16, 3962306a36Sopenharmony_ci}; 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_cienum ppmu_reg { 4262306a36Sopenharmony_ci /* PPC control register */ 4362306a36Sopenharmony_ci PPMU_PMNC = 0x00, 4462306a36Sopenharmony_ci PPMU_CNTENS = 0x10, 4562306a36Sopenharmony_ci PPMU_CNTENC = 0x20, 4662306a36Sopenharmony_ci PPMU_INTENS = 0x30, 4762306a36Sopenharmony_ci PPMU_INTENC = 0x40, 4862306a36Sopenharmony_ci PPMU_FLAG = 0x50, 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci /* Cycle Counter and Performance Event Counter Register */ 5162306a36Sopenharmony_ci PPMU_CCNT = 0x100, 5262306a36Sopenharmony_ci PPMU_PMCNT0 = 0x110, 5362306a36Sopenharmony_ci PPMU_PMCNT1 = 0x120, 5462306a36Sopenharmony_ci PPMU_PMCNT2 = 0x130, 5562306a36Sopenharmony_ci PPMU_PMCNT3_HIGH = 0x140, 5662306a36Sopenharmony_ci PPMU_PMCNT3_LOW = 0x150, 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci /* Bus Event Generator */ 5962306a36Sopenharmony_ci PPMU_BEVT0SEL = 0x1000, 6062306a36Sopenharmony_ci PPMU_BEVT1SEL = 0x1100, 6162306a36Sopenharmony_ci PPMU_BEVT2SEL = 0x1200, 6262306a36Sopenharmony_ci PPMU_BEVT3SEL = 0x1300, 6362306a36Sopenharmony_ci PPMU_COUNTER_RESET = 0x1810, 6462306a36Sopenharmony_ci PPMU_READ_OVERFLOW_CNT = 0x1810, 6562306a36Sopenharmony_ci PPMU_READ_UNDERFLOW_CNT = 0x1814, 6662306a36Sopenharmony_ci PPMU_WRITE_OVERFLOW_CNT = 0x1850, 6762306a36Sopenharmony_ci PPMU_WRITE_UNDERFLOW_CNT = 0x1854, 6862306a36Sopenharmony_ci PPMU_READ_PENDING_CNT = 0x1880, 6962306a36Sopenharmony_ci PPMU_WRITE_PENDING_CNT = 0x1884 7062306a36Sopenharmony_ci}; 7162306a36Sopenharmony_ci 7262306a36Sopenharmony_ci/* PMNC register */ 7362306a36Sopenharmony_ci#define PPMU_PMNC_CC_RESET_SHIFT 2 7462306a36Sopenharmony_ci#define PPMU_PMNC_COUNTER_RESET_SHIFT 1 7562306a36Sopenharmony_ci#define PPMU_PMNC_ENABLE_SHIFT 0 7662306a36Sopenharmony_ci#define PPMU_PMNC_START_MODE_MASK BIT(16) 7762306a36Sopenharmony_ci#define PPMU_PMNC_CC_DIVIDER_MASK BIT(3) 7862306a36Sopenharmony_ci#define PPMU_PMNC_CC_RESET_MASK BIT(2) 7962306a36Sopenharmony_ci#define PPMU_PMNC_COUNTER_RESET_MASK BIT(1) 8062306a36Sopenharmony_ci#define PPMU_PMNC_ENABLE_MASK BIT(0) 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ci/* CNTENS/CNTENC/INTENS/INTENC/FLAG register */ 8362306a36Sopenharmony_ci#define PPMU_CCNT_MASK BIT(31) 8462306a36Sopenharmony_ci#define PPMU_PMCNT3_MASK BIT(3) 8562306a36Sopenharmony_ci#define PPMU_PMCNT2_MASK BIT(2) 8662306a36Sopenharmony_ci#define PPMU_PMCNT1_MASK BIT(1) 8762306a36Sopenharmony_ci#define PPMU_PMCNT0_MASK BIT(0) 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_ci/* PPMU_PMNCTx/PPMU_BETxSEL registers */ 9062306a36Sopenharmony_ci#define PPMU_PMNCT(x) (PPMU_PMCNT0 + (0x10 * x)) 9162306a36Sopenharmony_ci#define PPMU_BEVTxSEL(x) (PPMU_BEVT0SEL + (0x100 * x)) 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci/*** 9462306a36Sopenharmony_ci * PPMU_V2.0 definitions 9562306a36Sopenharmony_ci */ 9662306a36Sopenharmony_cienum ppmu_v2_mode { 9762306a36Sopenharmony_ci PPMU_V2_MODE_MANUAL = 0, 9862306a36Sopenharmony_ci PPMU_V2_MODE_AUTO = 1, 9962306a36Sopenharmony_ci PPMU_V2_MODE_CIG = 2, /* CIG (Conditional Interrupt Generation) */ 10062306a36Sopenharmony_ci}; 10162306a36Sopenharmony_ci 10262306a36Sopenharmony_cienum ppmu_v2_event_type { 10362306a36Sopenharmony_ci PPMU_V2_RO_DATA_CNT = 0x4, 10462306a36Sopenharmony_ci PPMU_V2_WO_DATA_CNT = 0x5, 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ci PPMU_V2_EVT3_RW_DATA_CNT = 0x22, /* Only for Event3 */ 10762306a36Sopenharmony_ci}; 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_cienum ppmu_V2_reg { 11062306a36Sopenharmony_ci /* PPC control register */ 11162306a36Sopenharmony_ci PPMU_V2_PMNC = 0x04, 11262306a36Sopenharmony_ci PPMU_V2_CNTENS = 0x08, 11362306a36Sopenharmony_ci PPMU_V2_CNTENC = 0x0c, 11462306a36Sopenharmony_ci PPMU_V2_INTENS = 0x10, 11562306a36Sopenharmony_ci PPMU_V2_INTENC = 0x14, 11662306a36Sopenharmony_ci PPMU_V2_FLAG = 0x18, 11762306a36Sopenharmony_ci 11862306a36Sopenharmony_ci /* Cycle Counter and Performance Event Counter Register */ 11962306a36Sopenharmony_ci PPMU_V2_CCNT = 0x48, 12062306a36Sopenharmony_ci PPMU_V2_PMCNT0 = 0x34, 12162306a36Sopenharmony_ci PPMU_V2_PMCNT1 = 0x38, 12262306a36Sopenharmony_ci PPMU_V2_PMCNT2 = 0x3c, 12362306a36Sopenharmony_ci PPMU_V2_PMCNT3_LOW = 0x40, 12462306a36Sopenharmony_ci PPMU_V2_PMCNT3_HIGH = 0x44, 12562306a36Sopenharmony_ci 12662306a36Sopenharmony_ci /* Bus Event Generator */ 12762306a36Sopenharmony_ci PPMU_V2_CIG_CFG0 = 0x1c, 12862306a36Sopenharmony_ci PPMU_V2_CIG_CFG1 = 0x20, 12962306a36Sopenharmony_ci PPMU_V2_CIG_CFG2 = 0x24, 13062306a36Sopenharmony_ci PPMU_V2_CIG_RESULT = 0x28, 13162306a36Sopenharmony_ci PPMU_V2_CNT_RESET = 0x2c, 13262306a36Sopenharmony_ci PPMU_V2_CNT_AUTO = 0x30, 13362306a36Sopenharmony_ci PPMU_V2_CH_EV0_TYPE = 0x200, 13462306a36Sopenharmony_ci PPMU_V2_CH_EV1_TYPE = 0x204, 13562306a36Sopenharmony_ci PPMU_V2_CH_EV2_TYPE = 0x208, 13662306a36Sopenharmony_ci PPMU_V2_CH_EV3_TYPE = 0x20c, 13762306a36Sopenharmony_ci PPMU_V2_SM_ID_V = 0x220, 13862306a36Sopenharmony_ci PPMU_V2_SM_ID_A = 0x224, 13962306a36Sopenharmony_ci PPMU_V2_SM_OTHERS_V = 0x228, 14062306a36Sopenharmony_ci PPMU_V2_SM_OTHERS_A = 0x22c, 14162306a36Sopenharmony_ci PPMU_V2_INTERRUPT_RESET = 0x260, 14262306a36Sopenharmony_ci}; 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_ci/* PMNC register */ 14562306a36Sopenharmony_ci#define PPMU_V2_PMNC_START_MODE_SHIFT 20 14662306a36Sopenharmony_ci#define PPMU_V2_PMNC_START_MODE_MASK (0x3 << PPMU_V2_PMNC_START_MODE_SHIFT) 14762306a36Sopenharmony_ci 14862306a36Sopenharmony_ci#define PPMU_PMNC_CC_RESET_SHIFT 2 14962306a36Sopenharmony_ci#define PPMU_PMNC_COUNTER_RESET_SHIFT 1 15062306a36Sopenharmony_ci#define PPMU_PMNC_ENABLE_SHIFT 0 15162306a36Sopenharmony_ci#define PPMU_PMNC_START_MODE_MASK BIT(16) 15262306a36Sopenharmony_ci#define PPMU_PMNC_CC_DIVIDER_MASK BIT(3) 15362306a36Sopenharmony_ci#define PPMU_PMNC_CC_RESET_MASK BIT(2) 15462306a36Sopenharmony_ci#define PPMU_PMNC_COUNTER_RESET_MASK BIT(1) 15562306a36Sopenharmony_ci#define PPMU_PMNC_ENABLE_MASK BIT(0) 15662306a36Sopenharmony_ci 15762306a36Sopenharmony_ci#define PPMU_V2_PMNCT(x) (PPMU_V2_PMCNT0 + (0x4 * x)) 15862306a36Sopenharmony_ci#define PPMU_V2_CH_EVx_TYPE(x) (PPMU_V2_CH_EV0_TYPE + (0x4 * x)) 15962306a36Sopenharmony_ci 16062306a36Sopenharmony_ci#endif /* __EXYNOS_PPMU_H__ */ 161