hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/arch/arm/mach-mmp/time.c
....@@ -43,18 +43,21 @@
4343 static void __iomem *mmp_timer_base = TIMERS_VIRT_BASE;
4444
4545 /*
46
- * FIXME: the timer needs some delay to stablize the counter capture
46
+ * Read the timer through the CVWR register. Delay is required after requesting
47
+ * a read. The CR register cannot be directly read due to metastability issues
48
+ * documented in the PXA168 software manual.
4749 */
4850 static inline uint32_t timer_read(void)
4951 {
50
- int delay = 100;
52
+ uint32_t val;
53
+ int delay = 3;
5154
5255 __raw_writel(1, mmp_timer_base + TMR_CVWR(1));
5356
5457 while (delay--)
55
- cpu_relax();
58
+ val = __raw_readl(mmp_timer_base + TMR_CVWR(1));
5659
57
- return __raw_readl(mmp_timer_base + TMR_CVWR(1));
60
+ return val;
5861 }
5962
6063 static u64 notrace mmp_read_sched_clock(void)