diff options
Diffstat (limited to 'arch/powerpc/kernel/time.c')
-rw-r--r-- | arch/powerpc/kernel/time.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index eae4511ceeac..a180b4f9a4f6 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -479,7 +479,8 @@ static int __init iSeries_tb_recal(void) | |||
479 | unsigned long tb_ticks = tb - iSeries_recal_tb; | 479 | unsigned long tb_ticks = tb - iSeries_recal_tb; |
480 | unsigned long titan_usec = (titan - iSeries_recal_titan) >> 12; | 480 | unsigned long titan_usec = (titan - iSeries_recal_titan) >> 12; |
481 | unsigned long new_tb_ticks_per_sec = (tb_ticks * USEC_PER_SEC)/titan_usec; | 481 | unsigned long new_tb_ticks_per_sec = (tb_ticks * USEC_PER_SEC)/titan_usec; |
482 | unsigned long new_tb_ticks_per_jiffy = (new_tb_ticks_per_sec+(HZ/2))/HZ; | 482 | unsigned long new_tb_ticks_per_jiffy = |
483 | DIV_ROUND_CLOSEST(new_tb_ticks_per_sec, HZ); | ||
483 | long tick_diff = new_tb_ticks_per_jiffy - tb_ticks_per_jiffy; | 484 | long tick_diff = new_tb_ticks_per_jiffy - tb_ticks_per_jiffy; |
484 | char sign = '+'; | 485 | char sign = '+'; |
485 | /* make sure tb_ticks_per_sec and tb_ticks_per_jiffy are consistent */ | 486 | /* make sure tb_ticks_per_sec and tb_ticks_per_jiffy are consistent */ |
@@ -726,6 +727,18 @@ static int __init get_freq(char *name, int cells, unsigned long *val) | |||
726 | return found; | 727 | return found; |
727 | } | 728 | } |
728 | 729 | ||
730 | /* should become __cpuinit when secondary_cpu_time_init also is */ | ||
731 | void 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 | |||
729 | void __init generic_calibrate_decr(void) | 742 | void __init generic_calibrate_decr(void) |
730 | { | 743 | { |
731 | ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */ | 744 | ppc_tb_freq = DEFAULT_TB_FREQ; /* hardcoded default */ |
@@ -745,14 +758,6 @@ void __init generic_calibrate_decr(void) | |||
745 | printk(KERN_ERR "WARNING: Estimating processor frequency " | 758 | printk(KERN_ERR "WARNING: Estimating processor frequency " |
746 | "(not found)\n"); | 759 | "(not found)\n"); |
747 | } | 760 | } |
748 | |||
749 | #if defined(CONFIG_BOOKE) || defined(CONFIG_40x) | ||
750 | /* Clear any pending timer interrupts */ | ||
751 | mtspr(SPRN_TSR, TSR_ENW | TSR_WIS | TSR_DIS | TSR_FIS); | ||
752 | |||
753 | /* Enable decrementer interrupt */ | ||
754 | mtspr(SPRN_TCR, TCR_DIE); | ||
755 | #endif | ||
756 | } | 761 | } |
757 | 762 | ||
758 | int update_persistent_clock(struct timespec now) | 763 | int update_persistent_clock(struct timespec now) |
@@ -913,6 +918,11 @@ static void __init init_decrementer_clockevent(void) | |||
913 | 918 | ||
914 | void secondary_cpu_time_init(void) | 919 | void secondary_cpu_time_init(void) |
915 | { | 920 | { |
921 | /* Start the decrementer on CPUs that have manual control | ||
922 | * such as BookE | ||
923 | */ | ||
924 | start_cpu_decrementer(); | ||
925 | |||
916 | /* FIME: Should make unrelatred change to move snapshot_timebase | 926 | /* FIME: Should make unrelatred change to move snapshot_timebase |
917 | * call here ! */ | 927 | * call here ! */ |
918 | register_decrementer_clockevent(smp_processor_id()); | 928 | register_decrementer_clockevent(smp_processor_id()); |
@@ -1016,6 +1026,11 @@ void __init time_init(void) | |||
1016 | 1026 | ||
1017 | write_sequnlock_irqrestore(&xtime_lock, flags); | 1027 | write_sequnlock_irqrestore(&xtime_lock, flags); |
1018 | 1028 | ||
1029 | /* Start the decrementer on CPUs that have manual control | ||
1030 | * such as BookE | ||
1031 | */ | ||
1032 | start_cpu_decrementer(); | ||
1033 | |||
1019 | /* Register the clocksource, if we're not running on iSeries */ | 1034 | /* Register the clocksource, if we're not running on iSeries */ |
1020 | if (!firmware_has_feature(FW_FEATURE_ISERIES)) | 1035 | if (!firmware_has_feature(FW_FEATURE_ISERIES)) |
1021 | clocksource_init(); | 1036 | clocksource_init(); |