瀏覽代碼

powerpc: Properly start decrementer on BookE secondary CPUs

This moves the code to start the decrementer on 40x and BookE into
a separate function which is now called from time_init() and
secondary_time_init(), before the respective clock sources are
registered. We also remove the 85xx specific code for doing it
from the platform code.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Benjamin Herrenschmidt 15 年之前
父節點
當前提交
77c0a700c1
共有 2 個文件被更改,包括 22 次插入20 次删除
  1. 22 8
      arch/powerpc/kernel/time.c
  2. 0 12
      arch/powerpc/platforms/85xx/smp.c

+ 22 - 8
arch/powerpc/kernel/time.c

@@ -727,6 +727,18 @@ static int __init get_freq(char *name, int cells, unsigned long *val)
 	return found;
 	return found;
 }
 }
 
 
+/* should become __cpuinit when secondary_cpu_time_init also is */
+void start_cpu_decrementer(void)
+{
+#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
+	/* Clear any pending timer interrupts */
+	mtspr(SPRN_TSR, TSR_ENW | TSR_WIS | TSR_DIS | TSR_FIS);
+
+	/* Enable decrementer interrupt */
+	mtspr(SPRN_TCR, TCR_DIE);
+#endif /* defined(CONFIG_BOOKE) || defined(CONFIG_40x) */
+}
+
 void __init generic_calibrate_decr(void)
 void __init generic_calibrate_decr(void)
 {
 {
 	ppc_tb_freq = DEFAULT_TB_FREQ;		/* hardcoded default */
 	ppc_tb_freq = DEFAULT_TB_FREQ;		/* hardcoded default */
@@ -746,14 +758,6 @@ void __init generic_calibrate_decr(void)
 		printk(KERN_ERR "WARNING: Estimating processor frequency "
 		printk(KERN_ERR "WARNING: Estimating processor frequency "
 				"(not found)\n");
 				"(not found)\n");
 	}
 	}
-
-#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
-	/* Clear any pending timer interrupts */
-	mtspr(SPRN_TSR, TSR_ENW | TSR_WIS | TSR_DIS | TSR_FIS);
-
-	/* Enable decrementer interrupt */
-	mtspr(SPRN_TCR, TCR_DIE);
-#endif
 }
 }
 
 
 int update_persistent_clock(struct timespec now)
 int update_persistent_clock(struct timespec now)
@@ -914,6 +918,11 @@ static void __init init_decrementer_clockevent(void)
 
 
 void secondary_cpu_time_init(void)
 void secondary_cpu_time_init(void)
 {
 {
+	/* Start the decrementer on CPUs that have manual control
+	 * such as BookE
+	 */
+	start_cpu_decrementer();
+
 	/* FIME: Should make unrelatred change to move snapshot_timebase
 	/* FIME: Should make unrelatred change to move snapshot_timebase
 	 * call here ! */
 	 * call here ! */
 	register_decrementer_clockevent(smp_processor_id());
 	register_decrementer_clockevent(smp_processor_id());
@@ -1017,6 +1026,11 @@ void __init time_init(void)
 
 
 	write_sequnlock_irqrestore(&xtime_lock, flags);
 	write_sequnlock_irqrestore(&xtime_lock, flags);
 
 
+	/* Start the decrementer on CPUs that have manual control
+	 * such as BookE
+	 */
+	start_cpu_decrementer();
+
 	/* Register the clocksource, if we're not running on iSeries */
 	/* Register the clocksource, if we're not running on iSeries */
 	if (!firmware_has_feature(FW_FEATURE_ISERIES))
 	if (!firmware_has_feature(FW_FEATURE_ISERIES))
 		clocksource_init();
 		clocksource_init();

+ 0 - 12
arch/powerpc/platforms/85xx/smp.c

@@ -78,22 +78,10 @@ smp_85xx_kick_cpu(int nr)
 	pr_debug("waited %d msecs for CPU #%d.\n", n, nr);
 	pr_debug("waited %d msecs for CPU #%d.\n", n, nr);
 }
 }
 
 
-static void __init
-smp_85xx_basic_setup(int cpu_nr)
-{
-	/* Clear any pending timer interrupts */
-	mtspr(SPRN_TSR, TSR_ENW | TSR_WIS | TSR_DIS | TSR_FIS);
-
-	/* Enable decrementer interrupt */
-	mtspr(SPRN_TCR, TCR_DIE);
-}
-
 static void __init
 static void __init
 smp_85xx_setup_cpu(int cpu_nr)
 smp_85xx_setup_cpu(int cpu_nr)
 {
 {
 	mpic_setup_this_cpu();
 	mpic_setup_this_cpu();
-
-	smp_85xx_basic_setup(cpu_nr);
 }
 }
 
 
 struct smp_ops_t smp_85xx_ops = {
 struct smp_ops_t smp_85xx_ops = {