From 00b137abf1ec0385d3bf84bc4c5f50bdf9d6da1e Mon Sep 17 00:00:00 2001 From: Andrew Perepech Date: Wed, 19 Feb 2025 12:04:35 -0800 Subject: [PATCH] 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 --- src/drivers/mediatek/mt8365/timer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/drivers/mediatek/mt8365/timer.c b/src/drivers/mediatek/mt8365/timer.c index 222fd85b7275..40d33a6d1b50 100644 --- a/src/drivers/mediatek/mt8365/timer.c +++ b/src/drivers/mediatek/mt8365/timer.c @@ -80,7 +80,9 @@ uint64_t platform_timer_get(struct timer *timer) if (timer->id >= NR_TMRS) return -EINVAL; - /* must read 'low' first, and 'high' next */ + /* CNTCV_H is only updated when the CNTCV_L is read. + * Always read CNTCV_L before CNTCV_H to get a valid 64-bit timestamp. + */ low = io_reg_read(CNTCV_L); high = io_reg_read(CNTCV_H); time = ((uint64_t)high << 32) | low;