aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-08-28 00:25:04 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-08-28 00:25:04 -0400
commit77c0a700c1c292edafa11c1e52821ce4636f81b0 (patch)
treedb788b5bb4cbbea98d23335dfaad7c8d6cb2070a
parente5a6a1c9094839581242c678b11c93c294108696 (diff)
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>
-rw-r--r--arch/powerpc/kernel/time.c30
-rw-r--r--arch/powerpc/platforms/85xx/smp.c12
2 files changed, 22 insertions, 20 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index edb1edb36469..a180b4f9a4f6 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -727,6 +727,18 @@ static int __init get_freq(char *name, int cells, unsigned long *val)
727 return found; 727 return found;
728} 728}
729 729
730/* should become __cpuinit when secondary_cpu_time_init also is */
731void start_cpu_decrementer(void)
732{
733#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
734 /* Clear any pending timer interrupts */
735 mtspr(SPRN_TSR, TSR_ENW | TSR_WIS | TSR_DIS | TSR_FIS);
736
737 /* Enable decrementer interrupt */
738 mtspr(SPRN_TCR, TCR_DIE);
739#endif /* defined(CONFIG_BOOKE) || defined(CONFIG_40x) */
740}
741
730void __init generic_calibrate_decr(void) 742void __init generic_calibrate_decr(void)
731{ 743{
732 ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */ 744 ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */
@@ -746,14 +758,6 @@ void __init generic_calibrate_decr(void)
746 printk(KERN_ERR "WARNING: Estimating processor frequency " 758 printk(KERN_ERR "WARNING: Estimating processor frequency "
747 "(not found)\n"); 759 "(not found)\n");
748 } 760 }
749
750#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
751 /* Clear any pending timer interrupts */
752 mtspr(SPRN_TSR, TSR_ENW | TSR_WIS | TSR_DIS | TSR_FIS);
753
754 /* Enable decrementer interrupt */
755 mtspr(SPRN_TCR, TCR_DIE);
756#endif
757} 761}
758 762
759int update_persistent_clock(struct timespec now) 763int update_persistent_clock(struct timespec now)
@@ -914,6 +918,11 @@ static void __init init_decrementer_clockevent(void)
914 918
915void secondary_cpu_time_init(void) 919void secondary_cpu_time_init(void)
916{ 920{
921 /* Start the decrementer on CPUs that have manual control
922 * such as BookE
923 */
924 start_cpu_decrementer();
925
917 /* FIME: Should make unrelatred change to move snapshot_timebase 926 /* FIME: Should make unrelatred change to move snapshot_timebase
918 * call here ! */ 927 * call here ! */
919 register_decrementer_clockevent(smp_processor_id()); 928 register_decrementer_clockevent(smp_processor_id());
@@ -1017,6 +1026,11 @@ void __init time_init(void)
1017 1026
1018 write_sequnlock_irqrestore(&xtime_lock, flags); 1027 write_sequnlock_irqrestore(&xtime_lock, flags);
1019 1028
1029 /* Start the decrementer on CPUs that have manual control
1030 * such as BookE
1031 */
1032 start_cpu_decrementer();
1033
1020 /* Register the clocksource, if we're not running on iSeries */ 1034 /* Register the clocksource, if we're not running on iSeries */
1021 if (!firmware_has_feature(FW_FEATURE_ISERIES)) 1035 if (!firmware_has_feature(FW_FEATURE_ISERIES))
1022 clocksource_init(); 1036 clocksource_init();
diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
index 9f526ba31c1e..94f901da4918 100644
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -79,21 +79,9 @@ smp_85xx_kick_cpu(int nr)
79} 79}
80 80
81static void __init 81static void __init
82smp_85xx_basic_setup(int cpu_nr)
83{
84 /* Clear any pending timer interrupts */
85 mtspr(SPRN_TSR, TSR_ENW | TSR_WIS | TSR_DIS | TSR_FIS);
86
87 /* Enable decrementer interrupt */
88 mtspr(SPRN_TCR, TCR_DIE);
89}
90
91static void __init
92smp_85xx_setup_cpu(int cpu_nr) 82smp_85xx_setup_cpu(int cpu_nr)
93{ 83{
94 mpic_setup_this_cpu(); 84 mpic_setup_this_cpu();
95
96 smp_85xx_basic_setup(cpu_nr);
97} 85}
98 86
99struct smp_ops_t smp_85xx_ops = { 87struct smp_ops_t smp_85xx_ops = {