[PATCH] MIPS: SGI-IP22: Retry the third timer calibration sample on zero

From: Imre Kaloz

Date: Sat Nov 28 2026 - 10:45:00 EST


The third calibration sample can be 0 and is then averaged in, which
sets the Count rate to two thirds of its real value. Loop until it
is non-zero, as for the first two.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Imre Kaloz <kaloz@xxxxxxxxxx>
---
arch/mips/sgi-ip22/ip22-time.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/mips/sgi-ip22/ip22-time.c b/arch/mips/sgi-ip22/ip22-time.c
index 045aa89f28d8..e911bc03f1dd 100644
--- a/arch/mips/sgi-ip22/ip22-time.c
+++ b/arch/mips/sgi-ip22/ip22-time.c
@@ -93,7 +93,9 @@ __init void plat_time_init(void)

if (r4k_ticks[0] != r4k_ticks[1]) {
printk("warning: timer counts differ, retrying... ");
- r4k_ticks[2] = dosample();
+ do {
+ r4k_ticks[2] = dosample();
+ } while (!r4k_ticks[2]);
if (r4k_ticks[2] == r4k_ticks[0]
|| r4k_ticks[2] == r4k_ticks[1])
r4k_tick = r4k_ticks[2];

base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
--
2.47.3