aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/time_64.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc/kernel/time_64.c')
-rw-r--r--arch/sparc/kernel/time_64.c26
1 files changed, 3 insertions, 23 deletions
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c
index 63f73ae8a892..67e165102885 100644
--- a/arch/sparc/kernel/time_64.c
+++ b/arch/sparc/kernel/time_64.c
@@ -774,26 +774,9 @@ void __devinit setup_sparc64_timer(void)
774static struct clocksource clocksource_tick = { 774static struct clocksource clocksource_tick = {
775 .rating = 100, 775 .rating = 100,
776 .mask = CLOCKSOURCE_MASK(64), 776 .mask = CLOCKSOURCE_MASK(64),
777 .shift = 16,
778 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 777 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
779}; 778};
780 779
781static void __init setup_clockevent_multiplier(unsigned long hz)
782{
783 unsigned long mult, shift = 32;
784
785 while (1) {
786 mult = div_sc(hz, NSEC_PER_SEC, shift);
787 if (mult && (mult >> 32UL) == 0UL)
788 break;
789
790 shift--;
791 }
792
793 sparc64_clockevent.shift = shift;
794 sparc64_clockevent.mult = mult;
795}
796
797static unsigned long tb_ticks_per_usec __read_mostly; 780static unsigned long tb_ticks_per_usec __read_mostly;
798 781
799void __delay(unsigned long loops) 782void __delay(unsigned long loops)
@@ -828,9 +811,7 @@ void __init time_init(void)
828 clocksource_hz2mult(freq, SPARC64_NSEC_PER_CYC_SHIFT); 811 clocksource_hz2mult(freq, SPARC64_NSEC_PER_CYC_SHIFT);
829 812
830 clocksource_tick.name = tick_ops->name; 813 clocksource_tick.name = tick_ops->name;
831 clocksource_tick.mult = 814 clocksource_calc_mult_shift(&clocksource_tick, freq, 4);
832 clocksource_hz2mult(freq,
833 clocksource_tick.shift);
834 clocksource_tick.read = clocksource_tick_read; 815 clocksource_tick.read = clocksource_tick_read;
835 816
836 printk("clocksource: mult[%x] shift[%d]\n", 817 printk("clocksource: mult[%x] shift[%d]\n",
@@ -839,15 +820,14 @@ void __init time_init(void)
839 clocksource_register(&clocksource_tick); 820 clocksource_register(&clocksource_tick);
840 821
841 sparc64_clockevent.name = tick_ops->name; 822 sparc64_clockevent.name = tick_ops->name;
842 823 clockevents_calc_mult_shift(&sparc64_clockevent, freq, 4);
843 setup_clockevent_multiplier(freq);
844 824
845 sparc64_clockevent.max_delta_ns = 825 sparc64_clockevent.max_delta_ns =
846 clockevent_delta2ns(0x7fffffffffffffffUL, &sparc64_clockevent); 826 clockevent_delta2ns(0x7fffffffffffffffUL, &sparc64_clockevent);
847 sparc64_clockevent.min_delta_ns = 827 sparc64_clockevent.min_delta_ns =
848 clockevent_delta2ns(0xF, &sparc64_clockevent); 828 clockevent_delta2ns(0xF, &sparc64_clockevent);
849 829
850 printk("clockevent: mult[%ux] shift[%d]\n", 830 printk("clockevent: mult[%x] shift[%d]\n",
851 sparc64_clockevent.mult, sparc64_clockevent.shift); 831 sparc64_clockevent.mult, sparc64_clockevent.shift);
852 832
853 setup_sparc64_timer(); 833 setup_sparc64_timer();