18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * exynos_ppmu.h - Exynos PPMU header file 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (c) 2015 Samsung Electronics Co., Ltd. 68c2ecf20Sopenharmony_ci * Author : Chanwoo Choi <cw00.choi@samsung.com> 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#ifndef __EXYNOS_PPMU_H__ 108c2ecf20Sopenharmony_ci#define __EXYNOS_PPMU_H__ 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_cienum ppmu_state { 138c2ecf20Sopenharmony_ci PPMU_DISABLE = 0, 148c2ecf20Sopenharmony_ci PPMU_ENABLE, 158c2ecf20Sopenharmony_ci}; 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_cienum ppmu_counter { 188c2ecf20Sopenharmony_ci PPMU_PMNCNT0 = 0, 198c2ecf20Sopenharmony_ci PPMU_PMNCNT1, 208c2ecf20Sopenharmony_ci PPMU_PMNCNT2, 218c2ecf20Sopenharmony_ci PPMU_PMNCNT3, 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci PPMU_PMNCNT_MAX, 248c2ecf20Sopenharmony_ci}; 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/*** 278c2ecf20Sopenharmony_ci * PPMUv1.1 Definitions 288c2ecf20Sopenharmony_ci */ 298c2ecf20Sopenharmony_cienum ppmu_event_type { 308c2ecf20Sopenharmony_ci PPMU_RO_BUSY_CYCLE_CNT = 0x0, 318c2ecf20Sopenharmony_ci PPMU_WO_BUSY_CYCLE_CNT = 0x1, 328c2ecf20Sopenharmony_ci PPMU_RW_BUSY_CYCLE_CNT = 0x2, 338c2ecf20Sopenharmony_ci PPMU_RO_REQUEST_CNT = 0x3, 348c2ecf20Sopenharmony_ci PPMU_WO_REQUEST_CNT = 0x4, 358c2ecf20Sopenharmony_ci PPMU_RO_DATA_CNT = 0x5, 368c2ecf20Sopenharmony_ci PPMU_WO_DATA_CNT = 0x6, 378c2ecf20Sopenharmony_ci PPMU_RO_LATENCY = 0x12, 388c2ecf20Sopenharmony_ci PPMU_WO_LATENCY = 0x16, 398c2ecf20Sopenharmony_ci}; 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_cienum ppmu_reg { 428c2ecf20Sopenharmony_ci /* PPC control register */ 438c2ecf20Sopenharmony_ci PPMU_PMNC = 0x00, 448c2ecf20Sopenharmony_ci PPMU_CNTENS = 0x10, 458c2ecf20Sopenharmony_ci PPMU_CNTENC = 0x20, 468c2ecf20Sopenharmony_ci PPMU_INTENS = 0x30, 478c2ecf20Sopenharmony_ci PPMU_INTENC = 0x40, 488c2ecf20Sopenharmony_ci PPMU_FLAG = 0x50, 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci /* Cycle Counter and Performance Event Counter Register */ 518c2ecf20Sopenharmony_ci PPMU_CCNT = 0x100, 528c2ecf20Sopenharmony_ci PPMU_PMCNT0 = 0x110, 538c2ecf20Sopenharmony_ci PPMU_PMCNT1 = 0x120, 548c2ecf20Sopenharmony_ci PPMU_PMCNT2 = 0x130, 558c2ecf20Sopenharmony_ci PPMU_PMCNT3_HIGH = 0x140, 568c2ecf20Sopenharmony_ci PPMU_PMCNT3_LOW = 0x150, 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci /* Bus Event Generator */ 598c2ecf20Sopenharmony_ci PPMU_BEVT0SEL = 0x1000, 608c2ecf20Sopenharmony_ci PPMU_BEVT1SEL = 0x1100, 618c2ecf20Sopenharmony_ci PPMU_BEVT2SEL = 0x1200, 628c2ecf20Sopenharmony_ci PPMU_BEVT3SEL = 0x1300, 638c2ecf20Sopenharmony_ci PPMU_COUNTER_RESET = 0x1810, 648c2ecf20Sopenharmony_ci PPMU_READ_OVERFLOW_CNT = 0x1810, 658c2ecf20Sopenharmony_ci PPMU_READ_UNDERFLOW_CNT = 0x1814, 668c2ecf20Sopenharmony_ci PPMU_WRITE_OVERFLOW_CNT = 0x1850, 678c2ecf20Sopenharmony_ci PPMU_WRITE_UNDERFLOW_CNT = 0x1854, 688c2ecf20Sopenharmony_ci PPMU_READ_PENDING_CNT = 0x1880, 698c2ecf20Sopenharmony_ci PPMU_WRITE_PENDING_CNT = 0x1884 708c2ecf20Sopenharmony_ci}; 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci/* PMNC register */ 738c2ecf20Sopenharmony_ci#define PPMU_PMNC_CC_RESET_SHIFT 2 748c2ecf20Sopenharmony_ci#define PPMU_PMNC_COUNTER_RESET_SHIFT 1 758c2ecf20Sopenharmony_ci#define PPMU_PMNC_ENABLE_SHIFT 0 768c2ecf20Sopenharmony_ci#define PPMU_PMNC_START_MODE_MASK BIT(16) 778c2ecf20Sopenharmony_ci#define PPMU_PMNC_CC_DIVIDER_MASK BIT(3) 788c2ecf20Sopenharmony_ci#define PPMU_PMNC_CC_RESET_MASK BIT(2) 798c2ecf20Sopenharmony_ci#define PPMU_PMNC_COUNTER_RESET_MASK BIT(1) 808c2ecf20Sopenharmony_ci#define PPMU_PMNC_ENABLE_MASK BIT(0) 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci/* CNTENS/CNTENC/INTENS/INTENC/FLAG register */ 838c2ecf20Sopenharmony_ci#define PPMU_CCNT_MASK BIT(31) 848c2ecf20Sopenharmony_ci#define PPMU_PMCNT3_MASK BIT(3) 858c2ecf20Sopenharmony_ci#define PPMU_PMCNT2_MASK BIT(2) 868c2ecf20Sopenharmony_ci#define PPMU_PMCNT1_MASK BIT(1) 878c2ecf20Sopenharmony_ci#define PPMU_PMCNT0_MASK BIT(0) 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci/* PPMU_PMNCTx/PPMU_BETxSEL registers */ 908c2ecf20Sopenharmony_ci#define PPMU_PMNCT(x) (PPMU_PMCNT0 + (0x10 * x)) 918c2ecf20Sopenharmony_ci#define PPMU_BEVTxSEL(x) (PPMU_BEVT0SEL + (0x100 * x)) 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_ci/*** 948c2ecf20Sopenharmony_ci * PPMU_V2.0 definitions 958c2ecf20Sopenharmony_ci */ 968c2ecf20Sopenharmony_cienum ppmu_v2_mode { 978c2ecf20Sopenharmony_ci PPMU_V2_MODE_MANUAL = 0, 988c2ecf20Sopenharmony_ci PPMU_V2_MODE_AUTO = 1, 998c2ecf20Sopenharmony_ci PPMU_V2_MODE_CIG = 2, /* CIG (Conditional Interrupt Generation) */ 1008c2ecf20Sopenharmony_ci}; 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_cienum ppmu_v2_event_type { 1038c2ecf20Sopenharmony_ci PPMU_V2_RO_DATA_CNT = 0x4, 1048c2ecf20Sopenharmony_ci PPMU_V2_WO_DATA_CNT = 0x5, 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci PPMU_V2_EVT3_RW_DATA_CNT = 0x22, /* Only for Event3 */ 1078c2ecf20Sopenharmony_ci}; 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_cienum ppmu_V2_reg { 1108c2ecf20Sopenharmony_ci /* PPC control register */ 1118c2ecf20Sopenharmony_ci PPMU_V2_PMNC = 0x04, 1128c2ecf20Sopenharmony_ci PPMU_V2_CNTENS = 0x08, 1138c2ecf20Sopenharmony_ci PPMU_V2_CNTENC = 0x0c, 1148c2ecf20Sopenharmony_ci PPMU_V2_INTENS = 0x10, 1158c2ecf20Sopenharmony_ci PPMU_V2_INTENC = 0x14, 1168c2ecf20Sopenharmony_ci PPMU_V2_FLAG = 0x18, 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_ci /* Cycle Counter and Performance Event Counter Register */ 1198c2ecf20Sopenharmony_ci PPMU_V2_CCNT = 0x48, 1208c2ecf20Sopenharmony_ci PPMU_V2_PMCNT0 = 0x34, 1218c2ecf20Sopenharmony_ci PPMU_V2_PMCNT1 = 0x38, 1228c2ecf20Sopenharmony_ci PPMU_V2_PMCNT2 = 0x3c, 1238c2ecf20Sopenharmony_ci PPMU_V2_PMCNT3_LOW = 0x40, 1248c2ecf20Sopenharmony_ci PPMU_V2_PMCNT3_HIGH = 0x44, 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci /* Bus Event Generator */ 1278c2ecf20Sopenharmony_ci PPMU_V2_CIG_CFG0 = 0x1c, 1288c2ecf20Sopenharmony_ci PPMU_V2_CIG_CFG1 = 0x20, 1298c2ecf20Sopenharmony_ci PPMU_V2_CIG_CFG2 = 0x24, 1308c2ecf20Sopenharmony_ci PPMU_V2_CIG_RESULT = 0x28, 1318c2ecf20Sopenharmony_ci PPMU_V2_CNT_RESET = 0x2c, 1328c2ecf20Sopenharmony_ci PPMU_V2_CNT_AUTO = 0x30, 1338c2ecf20Sopenharmony_ci PPMU_V2_CH_EV0_TYPE = 0x200, 1348c2ecf20Sopenharmony_ci PPMU_V2_CH_EV1_TYPE = 0x204, 1358c2ecf20Sopenharmony_ci PPMU_V2_CH_EV2_TYPE = 0x208, 1368c2ecf20Sopenharmony_ci PPMU_V2_CH_EV3_TYPE = 0x20c, 1378c2ecf20Sopenharmony_ci PPMU_V2_SM_ID_V = 0x220, 1388c2ecf20Sopenharmony_ci PPMU_V2_SM_ID_A = 0x224, 1398c2ecf20Sopenharmony_ci PPMU_V2_SM_OTHERS_V = 0x228, 1408c2ecf20Sopenharmony_ci PPMU_V2_SM_OTHERS_A = 0x22c, 1418c2ecf20Sopenharmony_ci PPMU_V2_INTERRUPT_RESET = 0x260, 1428c2ecf20Sopenharmony_ci}; 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci/* PMNC register */ 1458c2ecf20Sopenharmony_ci#define PPMU_V2_PMNC_START_MODE_SHIFT 20 1468c2ecf20Sopenharmony_ci#define PPMU_V2_PMNC_START_MODE_MASK (0x3 << PPMU_V2_PMNC_START_MODE_SHIFT) 1478c2ecf20Sopenharmony_ci 1488c2ecf20Sopenharmony_ci#define PPMU_PMNC_CC_RESET_SHIFT 2 1498c2ecf20Sopenharmony_ci#define PPMU_PMNC_COUNTER_RESET_SHIFT 1 1508c2ecf20Sopenharmony_ci#define PPMU_PMNC_ENABLE_SHIFT 0 1518c2ecf20Sopenharmony_ci#define PPMU_PMNC_START_MODE_MASK BIT(16) 1528c2ecf20Sopenharmony_ci#define PPMU_PMNC_CC_DIVIDER_MASK BIT(3) 1538c2ecf20Sopenharmony_ci#define PPMU_PMNC_CC_RESET_MASK BIT(2) 1548c2ecf20Sopenharmony_ci#define PPMU_PMNC_COUNTER_RESET_MASK BIT(1) 1558c2ecf20Sopenharmony_ci#define PPMU_PMNC_ENABLE_MASK BIT(0) 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci#define PPMU_V2_PMNCT(x) (PPMU_V2_PMCNT0 + (0x4 * x)) 1588c2ecf20Sopenharmony_ci#define PPMU_V2_CH_EVx_TYPE(x) (PPMU_V2_CH_EV0_TYPE + (0x4 * x)) 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci#endif /* __EXYNOS_PPMU_H__ */ 161