]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
powerpc: Fix some bugs in the new merged time code
authorPaul Mackerras <paulus@samba.org>
Thu, 20 Oct 2005 12:33:06 +0000 (22:33 +1000)
committerPaul Mackerras <paulus@samba.org>
Thu, 20 Oct 2005 12:33:06 +0000 (22:33 +1000)
I had the sense of the test for when to use the old 601-style RTC
registers inverted.  pmac_calibrate_decr and via_calibrate_decr
weren't setting ppc_tb_freq, on which all the further calculations
depended.  Lastly, update_gtod was losing the top 32 bits of
the new tb_to_xs value.

Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/time.c
arch/powerpc/platforms/powermac/time.c
include/asm-powerpc/time.h

index 7d406b73a855271542b32a77af13ae0c9858cbbe..3e722370113b793ed841de5b095a9fbbf0dc265f 100644 (file)
@@ -222,7 +222,7 @@ static inline void timer_sync_xtime(unsigned long cur_tb)
  * between updates.
  */
 static inline void update_gtod(u64 new_tb_stamp, u64 new_stamp_xsec,
-                              unsigned int new_tb_to_xs)
+                              u64 new_tb_to_xs)
 {
        unsigned temp_idx;
        struct gettimeofday_vars *temp_varp;
index eb9969b52f96f456719f2d971ff4200f9347b9a7..a6d2d231d5a0100e8ff55509af9b0a9eae3beeb8 100644 (file)
@@ -216,8 +216,8 @@ via_calibrate_decr(void)
                ;
        dend = get_dec();
 
+       ppc_tb_freq = (dstart - dend) * 100 / 6;
        tb_ticks_per_jiffy = (dstart - dend) / ((6 * HZ)/100);
-       tb_to_us = mulhwu_scale_factor(dstart - dend, 60000);
 
        printk(KERN_INFO "via_calibrate_decr: ticks per jiffy = %lu (%u ticks)\n",
               tb_ticks_per_jiffy, dstart - dend);
@@ -306,6 +306,5 @@ pmac_calibrate_decr(void)
        freq = *fp;
        printk("time_init: decrementer frequency = %u.%.6u MHz\n",
               freq/1000000, freq%1000000);
-       tb_ticks_per_jiffy = freq / HZ;
-       tb_to_us = mulhwu_scale_factor(freq, 1000000);
+       ppc_tb_freq = freq;
 }
index 4eecc38f70923fa427d73cf3942f92012e9dcbe7..f8ef186c81e4764482f5d93c436d8b0cbce3b3f7 100644 (file)
@@ -75,7 +75,7 @@ struct div_result {
 /* Accessor functions for the timebase (RTC on 601) registers. */
 /* If one day CONFIG_POWER is added just define __USE_RTC as 1 */
 #ifdef CONFIG_6xx
-#define __USE_RTC()    cpu_has_feature(CPU_FTR_USE_TB)
+#define __USE_RTC()    (!cpu_has_feature(CPU_FTR_USE_TB))
 #else
 #define __USE_RTC()    0
 #endif