}
 }
 
-extern unsigned long ppc_proc_freq;
-extern unsigned long ppc_tb_freq;
-
 /*
  * Document me.
  */
        mf_power_off();
 }
 
-extern void setup_default_decr(void);
-
 /*
  * void __init iSeries_calibrate_decr()
  *
 
                .get_boot_time          = maple_get_boot_time,
                .set_rtc_time           = maple_set_rtc_time,
                .get_rtc_time           = maple_get_rtc_time,
-       .calibrate_decr         = maple_calibrate_decr,
+       .calibrate_decr         = generic_calibrate_decr,
        .progress               = maple_progress,
 };
 
 #define DBG(x...)
 #endif
 
-extern void setup_default_decr(void);
 extern void GregorianDay(struct rtc_time * tm);
 
-extern unsigned long ppc_tb_freq;
-extern unsigned long ppc_proc_freq;
 static int maple_rtc_addr;
 
 static int maple_clock_read(int addr)
        maple_get_rtc_time(tm);
 }
 
-/* XXX FIXME: Some sane defaults: 125 MHz timebase, 1GHz processor */
-#define DEFAULT_TB_FREQ                125000000UL
-#define DEFAULT_PROC_FREQ      (DEFAULT_TB_FREQ * 8)
-
-void __init maple_calibrate_decr(void)
-{
-       struct device_node *cpu;
-       struct div_result divres;
-       unsigned int *fp = NULL;
-
-       /*
-        * The cpu node should have a timebase-frequency property
-        * to tell us the rate at which the decrementer counts.
-        */
-       cpu = of_find_node_by_type(NULL, "cpu");
-
-       ppc_tb_freq = DEFAULT_TB_FREQ;
-       if (cpu != 0)
-               fp = (unsigned int *)get_property(cpu, "timebase-frequency", NULL);
-       if (fp != NULL)
-               ppc_tb_freq = *fp;
-       else
-               printk(KERN_ERR "WARNING: Estimating decrementer frequency (not found)\n");
-       fp = NULL;
-       ppc_proc_freq = DEFAULT_PROC_FREQ;
-       if (cpu != 0)
-               fp = (unsigned int *)get_property(cpu, "clock-frequency", NULL);
-       if (fp != NULL)
-               ppc_proc_freq = *fp;
-       else
-               printk(KERN_ERR "WARNING: Estimating processor frequency (not found)\n");
-
-       of_node_put(cpu);
-
-       printk(KERN_INFO "time_init: decrementer frequency = %lu.%.6lu MHz\n",
-              ppc_tb_freq/1000000, ppc_tb_freq%1000000);
-       printk(KERN_INFO "time_init: processor frequency   = %lu.%.6lu MHz\n",
-              ppc_proc_freq/1000000, ppc_proc_freq%1000000);
-
-       tb_ticks_per_jiffy = ppc_tb_freq / HZ;
-       tb_ticks_per_sec = tb_ticks_per_jiffy * HZ;
-       tb_ticks_per_usec = ppc_tb_freq / 1000000;
-       tb_to_us = mulhwu_scale_factor(ppc_tb_freq, 1000000);
-       div128_by_32(1024*1024, 0, tb_ticks_per_sec, &divres);
-       tb_to_xs = divres.result_low;
-
-       setup_default_decr();
-}
 
 
 int fwnmi_active;  /* TRUE if an FWNMI handler is present */
 
-extern unsigned long ppc_proc_freq;
-extern unsigned long ppc_tb_freq;
-
 extern void pSeries_system_reset_exception(struct pt_regs *regs);
 extern int pSeries_machine_check_exception(struct pt_regs *regs);
 
        spin_unlock(&progress_lock);
 }
 
-extern void setup_default_decr(void);
-
-/* Some sane defaults: 125 MHz timebase, 1GHz processor */
-#define DEFAULT_TB_FREQ                125000000UL
-#define DEFAULT_PROC_FREQ      (DEFAULT_TB_FREQ * 8)
-
-static void __init pSeries_calibrate_decr(void)
-{
-       struct device_node *cpu;
-       struct div_result divres;
-       unsigned int *fp;
-       int node_found;
-
-       /*
-        * The cpu node should have a timebase-frequency property
-        * to tell us the rate at which the decrementer counts.
-        */
-       cpu = of_find_node_by_type(NULL, "cpu");
-
-       ppc_tb_freq = DEFAULT_TB_FREQ;          /* hardcoded default */
-       node_found = 0;
-       if (cpu != 0) {
-               fp = (unsigned int *)get_property(cpu, "timebase-frequency",
-                                                 NULL);
-               if (fp != 0) {
-                       node_found = 1;
-                       ppc_tb_freq = *fp;
-               }
-       }
-       if (!node_found)
-               printk(KERN_ERR "WARNING: Estimating decrementer frequency "
-                               "(not found)\n");
-
-       ppc_proc_freq = DEFAULT_PROC_FREQ;
-       node_found = 0;
-       if (cpu != 0) {
-               fp = (unsigned int *)get_property(cpu, "clock-frequency",
-                                                 NULL);
-               if (fp != 0) {
-                       node_found = 1;
-                       ppc_proc_freq = *fp;
-               }
-       }
-       if (!node_found)
-               printk(KERN_ERR "WARNING: Estimating processor frequency "
-                               "(not found)\n");
-
-       of_node_put(cpu);
-
-       printk(KERN_INFO "time_init: decrementer frequency = %lu.%.6lu MHz\n",
-              ppc_tb_freq/1000000, ppc_tb_freq%1000000);
-       printk(KERN_INFO "time_init: processor frequency   = %lu.%.6lu MHz\n",
-              ppc_proc_freq/1000000, ppc_proc_freq%1000000);
-
-       tb_ticks_per_jiffy = ppc_tb_freq / HZ;
-       tb_ticks_per_sec = tb_ticks_per_jiffy * HZ;
-       tb_ticks_per_usec = ppc_tb_freq / 1000000;
-       tb_to_us = mulhwu_scale_factor(ppc_tb_freq, 1000000);
-       div128_by_32(1024*1024, 0, tb_ticks_per_sec, &divres);
-       tb_to_xs = divres.result_low;
-
-       setup_default_decr();
-}
-
 static int pSeries_check_legacy_ioport(unsigned int baseport)
 {
        struct device_node *np;
        .get_boot_time          = pSeries_get_boot_time,
        .get_rtc_time           = pSeries_get_rtc_time,
        .set_rtc_time           = pSeries_set_rtc_time,
-       .calibrate_decr         = pSeries_calibrate_decr,
+       .calibrate_decr         = generic_calibrate_decr,
        .progress               = pSeries_progress,
        .check_legacy_ioport    = pSeries_check_legacy_ioport,
        .system_reset_exception = pSeries_system_reset_exception,
 
 #define DBG(x...)
 #endif
 
-extern void setup_default_decr(void);
-
-extern unsigned long ppc_tb_freq;
-extern unsigned long ppc_proc_freq;
-
 /* Apparently the RTC stores seconds since 1 Jan 1904 */
 #define RTC_OFFSET     2082844800
 
 
 /*
  * Query the OF and get the decr frequency.
- * This was taken from the pmac time_init() when merging the prep/pmac
- * time functions.
+ * FIXME: merge this with generic_calibrate_decr
  */
 void __init pmac_calibrate_decr(void)
 {
 
 
 EXPORT_SYMBOL(machine_halt);
 
-unsigned long ppc_proc_freq;
-unsigned long ppc_tb_freq;
-
 static int ppc64_panic_event(struct notifier_block *this,
                              unsigned long event, void *ptr)
 {
 }
 
 /* This should only be called on processor 0 during calibrate decr */
-void setup_default_decr(void)
+void __init setup_default_decr(void)
 {
        struct paca_struct *lpaca = get_paca();
 
 
 
 static unsigned adjusting_time = 0;
 
+unsigned long ppc_proc_freq;
+unsigned long ppc_tb_freq;
+
 static __inline__ void timer_check_rtc(void)
 {
         /*
 
 EXPORT_SYMBOL(do_settimeofday);
 
+#if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_MAPLE) || defined(CONFIG_PPC_BPA)
+void __init generic_calibrate_decr(void)
+{
+       struct device_node *cpu;
+       struct div_result divres;
+       unsigned int *fp;
+       int node_found;
+
+       /*
+        * The cpu node should have a timebase-frequency property
+        * to tell us the rate at which the decrementer counts.
+        */
+       cpu = of_find_node_by_type(NULL, "cpu");
+
+       ppc_tb_freq = DEFAULT_TB_FREQ;          /* hardcoded default */
+       node_found = 0;
+       if (cpu != 0) {
+               fp = (unsigned int *)get_property(cpu, "timebase-frequency",
+                                                 NULL);
+               if (fp != 0) {
+                       node_found = 1;
+                       ppc_tb_freq = *fp;
+               }
+       }
+       if (!node_found)
+               printk(KERN_ERR "WARNING: Estimating decrementer frequency "
+                               "(not found)\n");
+
+       ppc_proc_freq = DEFAULT_PROC_FREQ;
+       node_found = 0;
+       if (cpu != 0) {
+               fp = (unsigned int *)get_property(cpu, "clock-frequency",
+                                                 NULL);
+               if (fp != 0) {
+                       node_found = 1;
+                       ppc_proc_freq = *fp;
+               }
+       }
+       if (!node_found)
+               printk(KERN_ERR "WARNING: Estimating processor frequency "
+                               "(not found)\n");
+
+       of_node_put(cpu);
+
+       printk(KERN_INFO "time_init: decrementer frequency = %lu.%.6lu MHz\n",
+              ppc_tb_freq/1000000, ppc_tb_freq%1000000);
+       printk(KERN_INFO "time_init: processor frequency   = %lu.%.6lu MHz\n",
+              ppc_proc_freq/1000000, ppc_proc_freq%1000000);
+
+       tb_ticks_per_jiffy = ppc_tb_freq / HZ;
+       tb_ticks_per_sec = tb_ticks_per_jiffy * HZ;
+       tb_ticks_per_usec = ppc_tb_freq / 1000000;
+       tb_to_us = mulhwu_scale_factor(ppc_tb_freq, 1000000);
+       div128_by_32(1024*1024, 0, tb_ticks_per_sec, &divres);
+       tb_to_xs = divres.result_low;
+
+       setup_default_decr();
+}
+#endif
+
 void __init time_init(void)
 {
        /* This function is only called on the boot processor */
 
 extern void to_tm(int tim, struct rtc_time * tm);
 extern time_t last_rtc_update;
 
+void generic_calibrate_decr(void);
+void setup_default_decr(void);
+
+/* Some sane defaults: 125 MHz timebase, 1GHz processor */
+extern unsigned long ppc_proc_freq;
+#define DEFAULT_PROC_FREQ      (DEFAULT_TB_FREQ * 8)
+extern unsigned long ppc_tb_freq;
+#define DEFAULT_TB_FREQ                125000000UL
+
 /*
  * By putting all of this stuff into a single struct we 
  * reduce the number of cache lines touched by do_gettimeofday.