drivers: clksource: Add API to return cval
Sleep driver needs to program the absolute clock value for next expiry into pdc register for system wake up. Add an API to read the cval low and high counters. Change-Id: I3f08b3320ea281894d46f3c4bb0862784cc337a1 Signed-off-by: Channagoud Kadabi <ckadabi@codeaurora.org>
This commit is contained in:
committed by
Mahesh Sivasubramanian
parent
aece700833
commit
3c865ca80b
@@ -53,6 +53,8 @@
|
||||
#define CNTFRQ 0x10
|
||||
#define CNTP_TVAL 0x28
|
||||
#define CNTP_CTL 0x2c
|
||||
#define CNTCVAL_LO 0x30
|
||||
#define CNTCVAL_HI 0x34
|
||||
#define CNTV_TVAL 0x38
|
||||
#define CNTV_CTL 0x3c
|
||||
|
||||
@@ -868,6 +870,23 @@ u32 arch_timer_get_rate(void)
|
||||
return arch_timer_rate;
|
||||
}
|
||||
|
||||
void arch_timer_mem_get_cval(u32 *lo, u32 *hi)
|
||||
{
|
||||
u32 ctrl;
|
||||
|
||||
*lo = *hi = ~0U;
|
||||
|
||||
if (!arch_counter_base)
|
||||
return;
|
||||
|
||||
ctrl = readl_relaxed_no_log(arch_counter_base + CNTV_CTL);
|
||||
|
||||
if (ctrl & ARCH_TIMER_CTRL_ENABLE) {
|
||||
*lo = readl_relaxed_no_log(arch_counter_base + CNTCVAL_LO);
|
||||
*hi = readl_relaxed_no_log(arch_counter_base + CNTCVAL_HI);
|
||||
}
|
||||
}
|
||||
|
||||
static u64 arch_counter_get_cntvct_mem(void)
|
||||
{
|
||||
u32 vct_lo, vct_hi, tmp_hi;
|
||||
|
||||
@@ -93,7 +93,7 @@ struct arch_timer_mem {
|
||||
extern u32 arch_timer_get_rate(void);
|
||||
extern u64 (*arch_timer_read_counter)(void);
|
||||
extern struct arch_timer_kvm_info *arch_timer_get_kvm_info(void);
|
||||
|
||||
extern void arch_timer_mem_get_cval(u32 *lo, u32 *hi);
|
||||
#else
|
||||
|
||||
static inline u32 arch_timer_get_rate(void)
|
||||
@@ -106,6 +106,10 @@ static inline u64 arch_timer_read_counter(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void arch_timer_mem_get_cval(u32 *lo, u32 *hi)
|
||||
{
|
||||
*lo = *hi = ~0U;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user