]> Pileus Git - ~andy/linux/blobdiff - arch/mips/mips-boards/generic/time.c
[MIPS] VSMP: Synchronize cp0 counters on bootup.
[~andy/linux] / arch / mips / mips-boards / generic / time.c
index 659706705005de54b94527910cc4a87e9e68e509..d817c60c5ca50caeb08ff5390517083e707828a5 100644 (file)
@@ -209,6 +209,7 @@ static unsigned int __init estimate_cpu_frequency(void)
 #endif
 #if defined(CONFIG_MIPS_ATLAS) || defined(CONFIG_MIPS_MALTA)
        unsigned long flags;
+       unsigned int start;
 
        local_irq_save(flags);
 
@@ -217,13 +218,13 @@ static unsigned int __init estimate_cpu_frequency(void)
        while (!(CMOS_READ(RTC_REG_A) & RTC_UIP));
 
        /* Start r4k counter. */
-       write_c0_count(0);
+       start = read_c0_count();
 
        /* Read counter exactly on falling edge of update flag */
        while (CMOS_READ(RTC_REG_A) & RTC_UIP);
        while (!(CMOS_READ(RTC_REG_A) & RTC_UIP));
 
-       count = read_c0_count();
+       count = read_c0_count() - start;
 
        /* restore interrupts */
        local_irq_restore(flags);