18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _ASM_HPET_H 38c2ecf20Sopenharmony_ci#define _ASM_HPET_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#ifdef CONFIG_RS780_HPET 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#define HPET_MMAP_SIZE 1024 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#define HPET_ID 0x000 108c2ecf20Sopenharmony_ci#define HPET_PERIOD 0x004 118c2ecf20Sopenharmony_ci#define HPET_CFG 0x010 128c2ecf20Sopenharmony_ci#define HPET_STATUS 0x020 138c2ecf20Sopenharmony_ci#define HPET_COUNTER 0x0f0 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#define HPET_Tn_CFG(n) (0x100 + 0x20 * n) 168c2ecf20Sopenharmony_ci#define HPET_Tn_CMP(n) (0x108 + 0x20 * n) 178c2ecf20Sopenharmony_ci#define HPET_Tn_ROUTE(n) (0x110 + 0x20 * n) 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#define HPET_T0_IRS 0x001 208c2ecf20Sopenharmony_ci#define HPET_T1_IRS 0x002 218c2ecf20Sopenharmony_ci#define HPET_T3_IRS 0x004 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci#define HPET_T0_CFG 0x100 248c2ecf20Sopenharmony_ci#define HPET_T0_CMP 0x108 258c2ecf20Sopenharmony_ci#define HPET_T0_ROUTE 0x110 268c2ecf20Sopenharmony_ci#define HPET_T1_CFG 0x120 278c2ecf20Sopenharmony_ci#define HPET_T1_CMP 0x128 288c2ecf20Sopenharmony_ci#define HPET_T1_ROUTE 0x130 298c2ecf20Sopenharmony_ci#define HPET_T2_CFG 0x140 308c2ecf20Sopenharmony_ci#define HPET_T2_CMP 0x148 318c2ecf20Sopenharmony_ci#define HPET_T2_ROUTE 0x150 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci#define HPET_ID_REV 0x000000ff 348c2ecf20Sopenharmony_ci#define HPET_ID_NUMBER 0x00001f00 358c2ecf20Sopenharmony_ci#define HPET_ID_64BIT 0x00002000 368c2ecf20Sopenharmony_ci#define HPET_ID_LEGSUP 0x00008000 378c2ecf20Sopenharmony_ci#define HPET_ID_VENDOR 0xffff0000 388c2ecf20Sopenharmony_ci#define HPET_ID_NUMBER_SHIFT 8 398c2ecf20Sopenharmony_ci#define HPET_ID_VENDOR_SHIFT 16 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci#define HPET_CFG_ENABLE 0x001 428c2ecf20Sopenharmony_ci#define HPET_CFG_LEGACY 0x002 438c2ecf20Sopenharmony_ci#define HPET_LEGACY_8254 2 448c2ecf20Sopenharmony_ci#define HPET_LEGACY_RTC 8 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#define HPET_TN_LEVEL 0x0002 478c2ecf20Sopenharmony_ci#define HPET_TN_ENABLE 0x0004 488c2ecf20Sopenharmony_ci#define HPET_TN_PERIODIC 0x0008 498c2ecf20Sopenharmony_ci#define HPET_TN_PERIODIC_CAP 0x0010 508c2ecf20Sopenharmony_ci#define HPET_TN_64BIT_CAP 0x0020 518c2ecf20Sopenharmony_ci#define HPET_TN_SETVAL 0x0040 528c2ecf20Sopenharmony_ci#define HPET_TN_32BIT 0x0100 538c2ecf20Sopenharmony_ci#define HPET_TN_ROUTE 0x3e00 548c2ecf20Sopenharmony_ci#define HPET_TN_FSB 0x4000 558c2ecf20Sopenharmony_ci#define HPET_TN_FSB_CAP 0x8000 568c2ecf20Sopenharmony_ci#define HPET_TN_ROUTE_SHIFT 9 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ci/* Max HPET Period is 10^8 femto sec as in HPET spec */ 598c2ecf20Sopenharmony_ci#define HPET_MAX_PERIOD 100000000UL 608c2ecf20Sopenharmony_ci/* 618c2ecf20Sopenharmony_ci * Min HPET period is 10^5 femto sec just for safety. If it is less than this, 628c2ecf20Sopenharmony_ci * then 32 bit HPET counter wrapsaround in less than 0.5 sec. 638c2ecf20Sopenharmony_ci */ 648c2ecf20Sopenharmony_ci#define HPET_MIN_PERIOD 100000UL 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci#define HPET_ADDR 0x20000 678c2ecf20Sopenharmony_ci#define HPET_MMIO_ADDR 0x90000e0000020000 688c2ecf20Sopenharmony_ci#define HPET_FREQ 14318780 698c2ecf20Sopenharmony_ci#define HPET_COMPARE_VAL ((HPET_FREQ + HZ / 2) / HZ) 708c2ecf20Sopenharmony_ci#define HPET_T0_IRQ 0 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ciextern void __init setup_hpet_timer(void); 738c2ecf20Sopenharmony_ci#endif /* CONFIG_RS780_HPET */ 748c2ecf20Sopenharmony_ci#endif /* _ASM_HPET_H */ 75