diff options
author | Paul Mackerras <paulus@samba.org> | 2005-10-20 07:04:51 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-10-20 07:04:51 -0400 |
commit | 374e99d450a0c44dc30041fa83eccfd0890330c7 (patch) | |
tree | ffa9384b104133941df368dd6542d76d1286ca1c | |
parent | 0458060c1c59c5378d8fb5daabe18cf4681c35cd (diff) |
powerpc: Move some calculations from xxx_calibrate_decr to time_init
Previously the individual xxx_calibrate_decr functions would each
print the timebase and cpu frequency and calculate several values
such as tb_to_us and tb_to_xs. This moves those printks and
calculations into time_init just after the call to the platform's
calibrate_decr function.
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/kernel/time.c | 27 | ||||
-rw-r--r-- | arch/ppc64/kernel/pmac_time.c | 14 |
2 files changed, 14 insertions, 27 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index d1608473075f..7d406b73a855 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -548,11 +548,9 @@ int do_settimeofday(struct timespec *tv) | |||
548 | 548 | ||
549 | EXPORT_SYMBOL(do_settimeofday); | 549 | EXPORT_SYMBOL(do_settimeofday); |
550 | 550 | ||
551 | #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_MAPLE) || defined(CONFIG_PPC_BPA) || defined(CONFIG_PPC_ISERIES) | ||
552 | void __init generic_calibrate_decr(void) | 551 | void __init generic_calibrate_decr(void) |
553 | { | 552 | { |
554 | struct device_node *cpu; | 553 | struct device_node *cpu; |
555 | struct div_result divres; | ||
556 | unsigned int *fp; | 554 | unsigned int *fp; |
557 | int node_found; | 555 | int node_found; |
558 | 556 | ||
@@ -591,20 +589,7 @@ void __init generic_calibrate_decr(void) | |||
591 | "(not found)\n"); | 589 | "(not found)\n"); |
592 | 590 | ||
593 | of_node_put(cpu); | 591 | of_node_put(cpu); |
594 | |||
595 | printk(KERN_INFO "time_init: decrementer frequency = %lu.%.6lu MHz\n", | ||
596 | ppc_tb_freq/1000000, ppc_tb_freq%1000000); | ||
597 | printk(KERN_INFO "time_init: processor frequency = %lu.%.6lu MHz\n", | ||
598 | ppc_proc_freq/1000000, ppc_proc_freq%1000000); | ||
599 | |||
600 | tb_ticks_per_jiffy = ppc_tb_freq / HZ; | ||
601 | tb_ticks_per_sec = tb_ticks_per_jiffy * HZ; | ||
602 | tb_ticks_per_usec = ppc_tb_freq / 1000000; | ||
603 | tb_to_us = mulhwu_scale_factor(ppc_tb_freq, 1000000); | ||
604 | div128_by_32(1024*1024, 0, tb_ticks_per_sec, &divres); | ||
605 | tb_to_xs = divres.result_low; | ||
606 | } | 592 | } |
607 | #endif | ||
608 | 593 | ||
609 | unsigned long get_boot_time(void) | 594 | unsigned long get_boot_time(void) |
610 | { | 595 | { |
@@ -633,6 +618,18 @@ void __init time_init(void) | |||
633 | 618 | ||
634 | ppc_md.calibrate_decr(); | 619 | ppc_md.calibrate_decr(); |
635 | 620 | ||
621 | printk(KERN_INFO "time_init: decrementer frequency = %lu.%.6lu MHz\n", | ||
622 | ppc_tb_freq / 1000000, ppc_tb_freq % 1000000); | ||
623 | printk(KERN_INFO "time_init: processor frequency = %lu.%.6lu MHz\n", | ||
624 | ppc_proc_freq / 1000000, ppc_proc_freq % 1000000); | ||
625 | |||
626 | tb_ticks_per_jiffy = ppc_tb_freq / HZ; | ||
627 | tb_ticks_per_sec = tb_ticks_per_jiffy * HZ; | ||
628 | tb_ticks_per_usec = ppc_tb_freq / 1000000; | ||
629 | tb_to_us = mulhwu_scale_factor(ppc_tb_freq, 1000000); | ||
630 | div128_by_32(1024*1024, 0, tb_ticks_per_sec, &res); | ||
631 | tb_to_xs = res.result_low; | ||
632 | |||
636 | #ifdef CONFIG_PPC64 | 633 | #ifdef CONFIG_PPC64 |
637 | get_paca()->default_decr = tb_ticks_per_jiffy; | 634 | get_paca()->default_decr = tb_ticks_per_jiffy; |
638 | #endif | 635 | #endif |
diff --git a/arch/ppc64/kernel/pmac_time.c b/arch/ppc64/kernel/pmac_time.c index 56f335115916..928bf213ec4e 100644 --- a/arch/ppc64/kernel/pmac_time.c +++ b/arch/ppc64/kernel/pmac_time.c | |||
@@ -152,8 +152,7 @@ unsigned long __init pmac_get_boot_time(void) | |||
152 | void __init pmac_calibrate_decr(void) | 152 | void __init pmac_calibrate_decr(void) |
153 | { | 153 | { |
154 | struct device_node *cpu; | 154 | struct device_node *cpu; |
155 | unsigned int freq, *fp; | 155 | unsigned int *fp; |
156 | struct div_result divres; | ||
157 | 156 | ||
158 | /* | 157 | /* |
159 | * The cpu node should have a timebase-frequency property | 158 | * The cpu node should have a timebase-frequency property |
@@ -165,16 +164,7 @@ void __init pmac_calibrate_decr(void) | |||
165 | fp = (unsigned int *) get_property(cpu, "timebase-frequency", NULL); | 164 | fp = (unsigned int *) get_property(cpu, "timebase-frequency", NULL); |
166 | if (fp == 0) | 165 | if (fp == 0) |
167 | panic("can't get cpu timebase frequency"); | 166 | panic("can't get cpu timebase frequency"); |
168 | freq = *fp; | 167 | ppc_tb_freq = *fp; |
169 | printk("time_init: decrementer frequency = %u.%.6u MHz\n", | ||
170 | freq/1000000, freq%1000000); | ||
171 | tb_ticks_per_jiffy = freq / HZ; | ||
172 | tb_ticks_per_sec = tb_ticks_per_jiffy * HZ; | ||
173 | tb_ticks_per_usec = freq / 1000000; | ||
174 | tb_to_us = mulhwu_scale_factor(freq, 1000000); | ||
175 | div128_by_32( 1024*1024, 0, tb_ticks_per_sec, &divres ); | ||
176 | tb_to_xs = divres.result_low; | ||
177 | ppc_tb_freq = freq; | ||
178 | 168 | ||
179 | fp = (unsigned int *)get_property(cpu, "clock-frequency", NULL); | 169 | fp = (unsigned int *)get_property(cpu, "clock-frequency", NULL); |
180 | if (fp == 0) | 170 | if (fp == 0) |