Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mips: convert to clocksource_register_hz/khz

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>

authored by

John Stultz and committed by
John Stultz
75c4fd8c 39280742

+14 -66
+1 -2
arch/mips/alchemy/common/time.c
··· 141 141 goto cntr_err; 142 142 143 143 /* register counter1 clocksource and event device */ 144 - clocksource_set_clock(&au1x_counter1_clocksource, 32768); 145 - clocksource_register(&au1x_counter1_clocksource); 144 + clocksource_register_hz(&au1x_counter1_clocksource, 32768); 146 145 147 146 cd->shift = 32; 148 147 cd->mult = div_sc(32768, NSEC_PER_SEC, cd->shift);
+1 -2
arch/mips/cavium-octeon/csrc-octeon.c
··· 105 105 void __init plat_time_init(void) 106 106 { 107 107 clocksource_mips.rating = 300; 108 - clocksource_set_clock(&clocksource_mips, octeon_get_clock_rate()); 109 - clocksource_register(&clocksource_mips); 108 + clocksource_register_hz(&clocksource_mips, octeon_get_clock_rate()); 110 109 } 111 110 112 111 static u64 octeon_udelay_factor;
-6
arch/mips/include/asm/time.h
··· 84 84 #endif 85 85 } 86 86 87 - static inline void clocksource_set_clock(struct clocksource *cs, 88 - unsigned int clock) 89 - { 90 - clocksource_calc_mult_shift(cs, clock, 4); 91 - } 92 - 93 87 static inline void clockevent_set_clock(struct clock_event_device *cd, 94 88 unsigned int clock) 95 89 {
+1 -2
arch/mips/jz4740/time.c
··· 121 121 122 122 clockevents_register_device(&jz4740_clockevent); 123 123 124 - clocksource_set_clock(&jz4740_clocksource, clk_rate); 125 - ret = clocksource_register(&jz4740_clocksource); 124 + ret = clocksource_register_hz(&jz4740_clocksource, clk_rate); 126 125 127 126 if (ret) 128 127 printk(KERN_ERR "Failed to register clocksource: %d\n", ret);
+1 -2
arch/mips/kernel/cevt-txx9.c
··· 51 51 { 52 52 struct txx9_tmr_reg __iomem *tmrptr; 53 53 54 - clocksource_set_clock(&txx9_clocksource.cs, TIMER_CLK(imbusclk)); 55 - clocksource_register(&txx9_clocksource.cs); 54 + clocksource_register_hz(&txx9_clocksource.cs, TIMER_CLK(imbusclk)); 56 55 57 56 tmrptr = ioremap(baseaddr, sizeof(struct txx9_tmr_reg)); 58 57 __raw_writel(TCR_BASE, &tmrptr->tcr);
+1 -2
arch/mips/kernel/csrc-bcm1480.c
··· 49 49 50 50 plldiv = G_BCM1480_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG))); 51 51 zbbus = ((plldiv >> 1) * 50000000) + ((plldiv & 1) * 25000000); 52 - clocksource_set_clock(cs, zbbus); 53 - clocksource_register(cs); 52 + clocksource_register_hz(cs, zbbus); 54 53 }
+1 -3
arch/mips/kernel/csrc-ioasic.c
··· 59 59 printk(KERN_INFO "I/O ASIC clock frequency %dHz\n", freq); 60 60 61 61 clocksource_dec.rating = 200 + freq / 10000000; 62 - clocksource_set_clock(&clocksource_dec, freq); 63 - 64 - clocksource_register(&clocksource_dec); 62 + clocksource_register_hz(&clocksource_dec, freq); 65 63 }
+3 -32
arch/mips/kernel/csrc-powertv.c
··· 78 78 79 79 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000; 80 80 81 - clocksource_set_clock(&clocksource_mips, mips_hpt_frequency); 82 - 83 - clocksource_register(&clocksource_mips); 81 + clocksource_register_hz(&clocksource_mips, mips_hpt_frequency); 84 82 } 85 83 86 84 /** ··· 128 130 /** 129 131 * powertv_tim_c_clocksource_init - set up a clock source for the TIM_C clock 130 132 * 131 - * The hard part here is coming up with a constant k and shift s such that 132 - * the 48-bit TIM_C value multiplied by k doesn't overflow and that value, 133 - * when shifted right by s, yields the corresponding number of nanoseconds. 134 133 * We know that TIM_C counts at 27 MHz/8, so each cycle corresponds to 135 - * 1 / (27,000,000/8) seconds. Multiply that by a billion and you get the 136 - * number of nanoseconds. Since the TIM_C value has 48 bits and the math is 137 - * done in 64 bits, avoiding an overflow means that k must be less than 138 - * 64 - 48 = 16 bits. 134 + * 1 / (27,000,000/8) seconds. 139 135 */ 140 136 static void __init powertv_tim_c_clocksource_init(void) 141 137 { 142 - int prescale; 143 - unsigned long dividend; 144 - unsigned long k; 145 - int s; 146 - const int max_k_bits = (64 - 48) - 1; 147 - const unsigned long billion = 1000000000; 148 138 const unsigned long counts_per_second = 27000000 / 8; 149 139 150 - prescale = BITS_PER_LONG - ilog2(billion) - 1; 151 - dividend = billion << prescale; 152 - k = dividend / counts_per_second; 153 - s = ilog2(k) - max_k_bits; 154 - 155 - if (s < 0) 156 - s = prescale; 157 - 158 - else { 159 - k >>= s; 160 - s += prescale; 161 - } 162 - 163 - clocksource_tim_c.mult = k; 164 - clocksource_tim_c.shift = s; 165 140 clocksource_tim_c.rating = 200; 166 141 167 - clocksource_register(&clocksource_tim_c); 142 + clocksource_register_hz(&clocksource_tim_c, counts_per_second); 168 143 tim_c = (struct tim_c *) asic_reg_addr(tim_ch); 169 144 } 170 145
+1 -3
arch/mips/kernel/csrc-r4k.c
··· 30 30 /* Calculate a somewhat reasonable rating value */ 31 31 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000; 32 32 33 - clocksource_set_clock(&clocksource_mips, mips_hpt_frequency); 34 - 35 - clocksource_register(&clocksource_mips); 33 + clocksource_register_hz(&clocksource_mips, mips_hpt_frequency); 36 34 37 35 return 0; 38 36 }
+1 -2
arch/mips/kernel/csrc-sb1250.c
··· 65 65 IOADDR(A_SCD_TIMER_REGISTER(SB1250_HPT_NUM, 66 66 R_SCD_TIMER_CFG))); 67 67 68 - clocksource_set_clock(cs, V_SCD_TIMER_FREQ); 69 - clocksource_register(cs); 68 + clocksource_register_hz(cs, V_SCD_TIMER_FREQ); 70 69 }
+1 -4
arch/mips/kernel/i8253.c
··· 196 196 .rating = 110, 197 197 .read = pit_read, 198 198 .mask = CLOCKSOURCE_MASK(32), 199 - .mult = 0, 200 - .shift = 20, 201 199 }; 202 200 203 201 static int __init init_pit_clocksource(void) ··· 203 205 if (num_possible_cpus() > 1) /* PIT does not scale! */ 204 206 return 0; 205 207 206 - clocksource_pit.mult = clocksource_hz2mult(CLOCK_TICK_RATE, 20); 207 - return clocksource_register(&clocksource_pit); 208 + return clocksource_register_hz(&clocksource_pit, CLOCK_TICK_RATE); 208 209 } 209 210 arch_initcall(init_pit_clocksource);
+1 -4
arch/mips/loongson/common/cs5536/cs5536_mfgpt.c
··· 201 201 .rating = 120, /* Functional for real use, but not desired */ 202 202 .read = mfgpt_read, 203 203 .mask = CLOCKSOURCE_MASK(32), 204 - .mult = 0, 205 - .shift = 22, 206 204 }; 207 205 208 206 int __init init_mfgpt_clocksource(void) ··· 208 210 if (num_possible_cpus() > 1) /* MFGPT does not scale! */ 209 211 return 0; 210 212 211 - clocksource_mfgpt.mult = clocksource_hz2mult(MFGPT_TICK_RATE, 22); 212 - return clocksource_register(&clocksource_mfgpt); 213 + return clocksource_register_hz(&clocksource_mfgpt, MFGPT_TICK_RATE); 213 214 } 214 215 215 216 arch_initcall(init_mfgpt_clocksource);
+1 -2
arch/mips/sgi-ip27/ip27-timer.c
··· 177 177 { 178 178 struct clocksource *cs = &hub_rt_clocksource; 179 179 180 - clocksource_set_clock(cs, CYCLES_PER_SEC); 181 - clocksource_register(cs); 180 + clocksource_register_hz(cs, CYCLES_PER_SEC); 182 181 } 183 182 184 183 void __init plat_time_init(void)