]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mips: convert to clocksource_register_hz/khz
authorJohn Stultz <johnstul@us.ibm.com>
Tue, 27 Apr 2010 03:23:11 +0000 (20:23 -0700)
committerJohn Stultz <john.stultz@linaro.org>
Mon, 21 Feb 2011 21:33:50 +0000 (13:33 -0800)
This converts the mips clocksources to use clocksource_register_hz/khz

CC: Ralf Baechle <ralf@linux-mips.org>
CC: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <johnstul@us.ibm.com>
13 files changed:
arch/mips/alchemy/common/time.c
arch/mips/cavium-octeon/csrc-octeon.c
arch/mips/include/asm/time.h
arch/mips/jz4740/time.c
arch/mips/kernel/cevt-txx9.c
arch/mips/kernel/csrc-bcm1480.c
arch/mips/kernel/csrc-ioasic.c
arch/mips/kernel/csrc-powertv.c
arch/mips/kernel/csrc-r4k.c
arch/mips/kernel/csrc-sb1250.c
arch/mips/kernel/i8253.c
arch/mips/loongson/common/cs5536/cs5536_mfgpt.c
arch/mips/sgi-ip27/ip27-timer.c

index 2aecb2fdf9827a6d3849916056a4661d14d93cfc..d5da6adbf63491566330f9a22309c69274d132ad 100644 (file)
@@ -141,8 +141,7 @@ static int __init alchemy_time_init(unsigned int m2int)
                goto cntr_err;
 
        /* register counter1 clocksource and event device */
-       clocksource_set_clock(&au1x_counter1_clocksource, 32768);
-       clocksource_register(&au1x_counter1_clocksource);
+       clocksource_register_hz(&au1x_counter1_clocksource, 32768);
 
        cd->shift = 32;
        cd->mult = div_sc(32768, NSEC_PER_SEC, cd->shift);
index 26bf71130bf8b1dd6fe1d24c8b5e336a2b30b78d..29d56afbb02d889e68b959eafe27626d7cfe9498 100644 (file)
@@ -105,8 +105,7 @@ unsigned long long notrace sched_clock(void)
 void __init plat_time_init(void)
 {
        clocksource_mips.rating = 300;
-       clocksource_set_clock(&clocksource_mips, octeon_get_clock_rate());
-       clocksource_register(&clocksource_mips);
+       clocksource_register_hz(&clocksource_mips, octeon_get_clock_rate());
 }
 
 static u64 octeon_udelay_factor;
index c7f1bfef157411e4faca94fce62e7af62512cc36..bc14447e69b5999c01db66f9506e3c0e9d7ac8f1 100644 (file)
@@ -84,12 +84,6 @@ static inline int init_mips_clocksource(void)
 #endif
 }
 
-static inline void clocksource_set_clock(struct clocksource *cs,
-                                        unsigned int clock)
-{
-       clocksource_calc_mult_shift(cs, clock, 4);
-}
-
 static inline void clockevent_set_clock(struct clock_event_device *cd,
                                        unsigned int clock)
 {
index fe01678d94fd4c439cd2353e3b74f57da6efebaf..03dfd4e0da4e6079777e5776f11f5ab6fc4ff2b0 100644 (file)
@@ -121,8 +121,7 @@ void __init plat_time_init(void)
 
        clockevents_register_device(&jz4740_clockevent);
 
-       clocksource_set_clock(&jz4740_clocksource, clk_rate);
-       ret = clocksource_register(&jz4740_clocksource);
+       ret = clocksource_register_hz(&jz4740_clocksource, clk_rate);
 
        if (ret)
                printk(KERN_ERR "Failed to register clocksource: %d\n", ret);
index 0b7377361e22fa8b3d76afc335344c35613cac59..f0ab92a1b0573b49637f648b9e36c91adf14ae48 100644 (file)
@@ -51,8 +51,7 @@ void __init txx9_clocksource_init(unsigned long baseaddr,
 {
        struct txx9_tmr_reg __iomem *tmrptr;
 
-       clocksource_set_clock(&txx9_clocksource.cs, TIMER_CLK(imbusclk));
-       clocksource_register(&txx9_clocksource.cs);
+       clocksource_register_hz(&txx9_clocksource.cs, TIMER_CLK(imbusclk));
 
        tmrptr = ioremap(baseaddr, sizeof(struct txx9_tmr_reg));
        __raw_writel(TCR_BASE, &tmrptr->tcr);
index 51489f8a825e3c90c43f9040eb38bd621f1f3f90..f96f99c794a32add278e8b41d4cd4ead3796c336 100644 (file)
@@ -49,6 +49,5 @@ void __init sb1480_clocksource_init(void)
 
        plldiv = G_BCM1480_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG)));
        zbbus = ((plldiv >> 1) * 50000000) + ((plldiv & 1) * 25000000);
-       clocksource_set_clock(cs, zbbus);
-       clocksource_register(cs);
+       clocksource_register_hz(cs, zbbus);
 }
index 23da108506b0a325a8c0c4f8de12d744129d2676..46bd7fa98d6ca6efba607d3134e80a2d97b61f30 100644 (file)
@@ -59,7 +59,5 @@ void __init dec_ioasic_clocksource_init(void)
        printk(KERN_INFO "I/O ASIC clock frequency %dHz\n", freq);
 
        clocksource_dec.rating = 200 + freq / 10000000;
-       clocksource_set_clock(&clocksource_dec, freq);
-
-       clocksource_register(&clocksource_dec);
+       clocksource_register_hz(&clocksource_dec, freq);
 }
index a27c16c8690e3c3583ebe42df8a570cd50e17b5c..2e7c5232da8d72c09c399bacaf3ad45e2eaa726e 100644 (file)
@@ -78,9 +78,7 @@ static void __init powertv_c0_hpt_clocksource_init(void)
 
        clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000;
 
-       clocksource_set_clock(&clocksource_mips, mips_hpt_frequency);
-
-       clocksource_register(&clocksource_mips);
+       clocksource_register_hz(&clocksource_mips, mips_hpt_frequency);
 }
 
 /**
@@ -130,43 +128,16 @@ static struct clocksource clocksource_tim_c = {
 /**
  * powertv_tim_c_clocksource_init - set up a clock source for the TIM_C clock
  *
- * The hard part here is coming up with a constant k and shift s such that
- * the 48-bit TIM_C value multiplied by k doesn't overflow and that value,
- * when shifted right by s, yields the corresponding number of nanoseconds.
  * We know that TIM_C counts at 27 MHz/8, so each cycle corresponds to
- * 1 / (27,000,000/8) seconds. Multiply that by a billion and you get the
- * number of nanoseconds. Since the TIM_C value has 48 bits and the math is
- * done in 64 bits, avoiding an overflow means that k must be less than
- * 64 - 48 = 16 bits.
+ * 1 / (27,000,000/8) seconds.
  */
 static void __init powertv_tim_c_clocksource_init(void)
 {
-       int                     prescale;
-       unsigned long           dividend;
-       unsigned long           k;
-       int                     s;
-       const int               max_k_bits = (64 - 48) - 1;
-       const unsigned long     billion = 1000000000;
        const unsigned long     counts_per_second = 27000000 / 8;
 
-       prescale = BITS_PER_LONG - ilog2(billion) - 1;
-       dividend = billion << prescale;
-       k = dividend / counts_per_second;
-       s = ilog2(k) - max_k_bits;
-
-       if (s < 0)
-               s = prescale;
-
-       else {
-               k >>= s;
-               s += prescale;
-       }
-
-       clocksource_tim_c.mult = k;
-       clocksource_tim_c.shift = s;
        clocksource_tim_c.rating = 200;
 
-       clocksource_register(&clocksource_tim_c);
+       clocksource_register_hz(&clocksource_tim_c, counts_per_second);
        tim_c = (struct tim_c *) asic_reg_addr(tim_ch);
 }
 
index e95a3cd48eeacac0c03f22b8e8ac2fcf2e3a7f52..decd1fa38d551bf132f9bba4aa2a48400e129ac8 100644 (file)
@@ -30,9 +30,7 @@ int __init init_r4k_clocksource(void)
        /* Calculate a somewhat reasonable rating value */
        clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000;
 
-       clocksource_set_clock(&clocksource_mips, mips_hpt_frequency);
-
-       clocksource_register(&clocksource_mips);
+       clocksource_register_hz(&clocksource_mips, mips_hpt_frequency);
 
        return 0;
 }
index d14d3d1907fa6c8103cc1e398a24542905200359..e9606d9076858f74f78a0180d8c9edc6a2410249 100644 (file)
@@ -65,6 +65,5 @@ void __init sb1250_clocksource_init(void)
                     IOADDR(A_SCD_TIMER_REGISTER(SB1250_HPT_NUM,
                                                 R_SCD_TIMER_CFG)));
 
-       clocksource_set_clock(cs, V_SCD_TIMER_FREQ);
-       clocksource_register(cs);
+       clocksource_register_hz(cs, V_SCD_TIMER_FREQ);
 }
index 2392a7a296d41d4585fc406948ed58d4f83443f9..9fadd17888d99479c63220226479d7407192c1e2 100644 (file)
@@ -196,8 +196,6 @@ static struct clocksource clocksource_pit = {
        .rating = 110,
        .read   = pit_read,
        .mask   = CLOCKSOURCE_MASK(32),
-       .mult   = 0,
-       .shift  = 20,
 };
 
 static int __init init_pit_clocksource(void)
@@ -205,7 +203,6 @@ static int __init init_pit_clocksource(void)
        if (num_possible_cpus() > 1) /* PIT does not scale! */
                return 0;
 
-       clocksource_pit.mult = clocksource_hz2mult(CLOCK_TICK_RATE, 20);
-       return clocksource_register(&clocksource_pit);
+       return clocksource_register_hz(&clocksource_pit, CLOCK_TICK_RATE);
 }
 arch_initcall(init_pit_clocksource);
index 8c807c9651990bb973d2c13123ac911abb35e23f..0cb1b9760e34f32c19b57f8a0de4f9442766190e 100644 (file)
@@ -201,8 +201,6 @@ static struct clocksource clocksource_mfgpt = {
        .rating = 120, /* Functional for real use, but not desired */
        .read = mfgpt_read,
        .mask = CLOCKSOURCE_MASK(32),
-       .mult = 0,
-       .shift = 22,
 };
 
 int __init init_mfgpt_clocksource(void)
@@ -210,8 +208,7 @@ int __init init_mfgpt_clocksource(void)
        if (num_possible_cpus() > 1)    /* MFGPT does not scale! */
                return 0;
 
-       clocksource_mfgpt.mult = clocksource_hz2mult(MFGPT_TICK_RATE, 22);
-       return clocksource_register(&clocksource_mfgpt);
+       return clocksource_register_hz(&clocksource_mfgpt, MFGPT_TICK_RATE);
 }
 
 arch_initcall(init_mfgpt_clocksource);
index d6802d6d1f827a21b79cd0d8c4fb54b29cf7ae4d..3cac88382d4c12dea1fa4af8ff15ce4698d84d2b 100644 (file)
@@ -177,8 +177,7 @@ static void __init hub_rt_clocksource_init(void)
 {
        struct clocksource *cs = &hub_rt_clocksource;
 
-       clocksource_set_clock(cs, CYCLES_PER_SEC);
-       clocksource_register(cs);
+       clocksource_register_hz(cs, CYCLES_PER_SEC);
 }
 
 void __init plat_time_init(void)