15 #include <linux/kernel.h>
25 #include <plat/common.h>
26 #include <plat/clock.h>
29 #define OMAP2_32KSYNCNT_REV_OFF 0x0
30 #define OMAP2_32KSYNCNT_REV_SCHEME (0x3 << 30)
31 #define OMAP2_32KSYNCNT_CR_OFF_LOW 0x10
32 #define OMAP2_32KSYNCNT_CR_OFF_HIGH 0x30
40 static void __iomem *sync32k_cnt_reg;
42 static u32 notrace omap_32k_read_sched_clock(
void)
44 return sync32k_cnt_reg ?
__raw_readl(sync32k_cnt_reg) : 0;
54 static struct timespec persistent_ts;
56 static unsigned int persistent_mult, persistent_shift;
59 static void omap_read_persistent_clock(
struct timespec *
ts)
61 unsigned long long nsecs;
68 cycles = sync32k_cnt_reg ?
__raw_readl(sync32k_cnt_reg) : 0;
70 nsecs = clocksource_cyc2ns(cycles - last_cycles,
71 persistent_mult, persistent_shift);
73 timespec_add_ns(&persistent_ts, nsecs);
77 spin_unlock_irqrestore(&read_persistent_clock_lock, flags);
115 pr_err(
"32k_counter: can't register clocksource\n");
121 pr_info(
"OMAP clocksource: 32k_counter at 32768 Hz\n");