Skip to content

Commit fd54677

Browse files
authored
drivers: mediatek: mt8365: Add a comment to timer.c
Add a comment explaining that the CNTCV_L register must be read before the CNTCV_H to get a valid 64-bit timestamp value Signed-off-by: Andrew Perepech <[email protected]>
1 parent 2751ee8 commit fd54677

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/drivers/mediatek/mt8365/timer.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ uint64_t platform_timer_get(struct timer *timer)
8080
if (timer->id >= NR_TMRS)
8181
return -EINVAL;
8282

83-
/* must read 'low' first, and 'high' next */
83+
/* CNTCV_H is only updated when the CNTCV_L is read.
84+
* Always read CNTCV_L before CNTCV_H to get a valid 64-bit timestamp.
85+
*/
8486
low = io_reg_read(CNTCV_L);
8587
high = io_reg_read(CNTCV_H);
8688
time = ((uint64_t)high << 32) | low;

0 commit comments

Comments
 (0)