aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc64/kernel/pSeries_setup.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2005-06-22 19:43:07 -0400
committerPaul Mackerras <paulus@samba.org>2005-06-22 19:43:07 -0400
commit10f7e7c15e6ce41799c5dba6925ae4bf8048c870 (patch)
tree505c9834749cd59bd8a075db7577c3b26a002f92 /arch/ppc64/kernel/pSeries_setup.c
parenta4936044001694f033fe4ea94d6034d51a6b465c (diff)
[PATCH] ppc64: consolidate calibrate_decr implementations
pSeries and maple have almost the same code for calibrate_decr, and BPA would need yet another copy. Instead, I'm moving the code to arch/ppc64/kernel/time.c. Some of the related declarations were missing from header files, so I'm moving those as well. It makes sense to merge this with the pmac function of the same name, so we end up having just one implemetation for iSeries and one for Open Firmware based machines. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc64/kernel/pSeries_setup.c')
-rw-r--r--arch/ppc64/kernel/pSeries_setup.c69
1 files changed, 1 insertions, 68 deletions
diff --git a/arch/ppc64/kernel/pSeries_setup.c b/arch/ppc64/kernel/pSeries_setup.c
index 6c0d1d58a552..f9a310c0c8d7 100644
--- a/arch/ppc64/kernel/pSeries_setup.c
+++ b/arch/ppc64/kernel/pSeries_setup.c
@@ -84,9 +84,6 @@ extern void generic_find_legacy_serial_ports(u64 *physport,
84 84
85int fwnmi_active; /* TRUE if an FWNMI handler is present */ 85int fwnmi_active; /* TRUE if an FWNMI handler is present */
86 86
87extern unsigned long ppc_proc_freq;
88extern unsigned long ppc_tb_freq;
89
90extern void pSeries_system_reset_exception(struct pt_regs *regs); 87extern void pSeries_system_reset_exception(struct pt_regs *regs);
91extern int pSeries_machine_check_exception(struct pt_regs *regs); 88extern int pSeries_machine_check_exception(struct pt_regs *regs);
92 89
@@ -482,70 +479,6 @@ static void pSeries_progress(char *s, unsigned short hex)
482 spin_unlock(&progress_lock); 479 spin_unlock(&progress_lock);
483} 480}
484 481
485extern void setup_default_decr(void);
486
487/* Some sane defaults: 125 MHz timebase, 1GHz processor */
488#define DEFAULT_TB_FREQ 125000000UL
489#define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8)
490
491static void __init pSeries_calibrate_decr(void)
492{
493 struct device_node *cpu;
494 struct div_result divres;
495 unsigned int *fp;
496 int node_found;
497
498 /*
499 * The cpu node should have a timebase-frequency property
500 * to tell us the rate at which the decrementer counts.
501 */
502 cpu = of_find_node_by_type(NULL, "cpu");
503
504 ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */
505 node_found = 0;
506 if (cpu != 0) {
507 fp = (unsigned int *)get_property(cpu, "timebase-frequency",
508 NULL);
509 if (fp != 0) {
510 node_found = 1;
511 ppc_tb_freq = *fp;
512 }
513 }
514 if (!node_found)
515 printk(KERN_ERR "WARNING: Estimating decrementer frequency "
516 "(not found)\n");
517
518 ppc_proc_freq = DEFAULT_PROC_FREQ;
519 node_found = 0;
520 if (cpu != 0) {
521 fp = (unsigned int *)get_property(cpu, "clock-frequency",
522 NULL);
523 if (fp != 0) {
524 node_found = 1;
525 ppc_proc_freq = *fp;
526 }
527 }
528 if (!node_found)
529 printk(KERN_ERR "WARNING: Estimating processor frequency "
530 "(not found)\n");
531
532 of_node_put(cpu);
533
534 printk(KERN_INFO "time_init: decrementer frequency = %lu.%.6lu MHz\n",
535 ppc_tb_freq/1000000, ppc_tb_freq%1000000);
536 printk(KERN_INFO "time_init: processor frequency = %lu.%.6lu MHz\n",
537 ppc_proc_freq/1000000, ppc_proc_freq%1000000);
538
539 tb_ticks_per_jiffy = ppc_tb_freq / HZ;
540 tb_ticks_per_sec = tb_ticks_per_jiffy * HZ;
541 tb_ticks_per_usec = ppc_tb_freq / 1000000;
542 tb_to_us = mulhwu_scale_factor(ppc_tb_freq, 1000000);
543 div128_by_32(1024*1024, 0, tb_ticks_per_sec, &divres);
544 tb_to_xs = divres.result_low;
545
546 setup_default_decr();
547}
548
549static int pSeries_check_legacy_ioport(unsigned int baseport) 482static int pSeries_check_legacy_ioport(unsigned int baseport)
550{ 483{
551 struct device_node *np; 484 struct device_node *np;
@@ -604,7 +537,7 @@ struct machdep_calls __initdata pSeries_md = {
604 .get_boot_time = pSeries_get_boot_time, 537 .get_boot_time = pSeries_get_boot_time,
605 .get_rtc_time = pSeries_get_rtc_time, 538 .get_rtc_time = pSeries_get_rtc_time,
606 .set_rtc_time = pSeries_set_rtc_time, 539 .set_rtc_time = pSeries_set_rtc_time,
607 .calibrate_decr = pSeries_calibrate_decr, 540 .calibrate_decr = generic_calibrate_decr,
608 .progress = pSeries_progress, 541 .progress = pSeries_progress,
609 .check_legacy_ioport = pSeries_check_legacy_ioport, 542 .check_legacy_ioport = pSeries_check_legacy_ioport,
610 .system_reset_exception = pSeries_system_reset_exception, 543 .system_reset_exception = pSeries_system_reset_exception,