aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/time.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-07-14 05:23:37 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-07-16 07:05:02 -0400
commit8b99cfb8cc51adae7f5294c8962a026c63100959 (patch)
tree349cebcae3eda608f1ed52fa3afcf661fca075a9 /arch/sparc64/kernel/time.c
parent27a2ef382c7935a4dd02bff9fd361ce118df98c6 (diff)
[SPARC64]: More sensible udelay implementation.
Take a page from the powerpc folks and just calculate the delay factor directly. Since frequency scaling chips use a system-tick register, the value is going to be the same system-wide. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/time.c')
-rw-r--r--arch/sparc64/kernel/time.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index a31a0439244f..62e316ab1339 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -849,9 +849,6 @@ static unsigned long sparc64_init_timers(void)
849{ 849{
850 struct device_node *dp; 850 struct device_node *dp;
851 unsigned long clock; 851 unsigned long clock;
852#ifdef CONFIG_SMP
853 extern void smp_tick_init(void);
854#endif
855 852
856 dp = of_find_node_by_path("/"); 853 dp = of_find_node_by_path("/");
857 if (tlb_type == spitfire) { 854 if (tlb_type == spitfire) {
@@ -874,10 +871,6 @@ static unsigned long sparc64_init_timers(void)
874 clock = of_getintprop_default(dp, "stick-frequency", 0); 871 clock = of_getintprop_default(dp, "stick-frequency", 0);
875 } 872 }
876 873
877#ifdef CONFIG_SMP
878 smp_tick_init();
879#endif
880
881 return clock; 874 return clock;
882} 875}
883 876
@@ -1038,10 +1031,31 @@ static void __init setup_clockevent_multiplier(unsigned long hz)
1038 sparc64_clockevent.mult = mult; 1031 sparc64_clockevent.mult = mult;
1039} 1032}
1040 1033
1034static unsigned long tb_ticks_per_usec __read_mostly;
1035
1036void __delay(unsigned long loops)
1037{
1038 unsigned long bclock, now;
1039
1040 bclock = tick_ops->get_tick();
1041 do {
1042 now = tick_ops->get_tick();
1043 } while ((now-bclock) < loops);
1044}
1045EXPORT_SYMBOL(__delay);
1046
1047void udelay(unsigned long usecs)
1048{
1049 __delay(tb_ticks_per_usec * usecs);
1050}
1051EXPORT_SYMBOL(udelay);
1052
1041void __init time_init(void) 1053void __init time_init(void)
1042{ 1054{
1043 unsigned long clock = sparc64_init_timers(); 1055 unsigned long clock = sparc64_init_timers();
1044 1056
1057 tb_ticks_per_usec = clock / USEC_PER_SEC;
1058
1045 timer_ticks_per_nsec_quotient = 1059 timer_ticks_per_nsec_quotient =
1046 clocksource_hz2mult(clock, SPARC64_NSEC_PER_CYC_SHIFT); 1060 clocksource_hz2mult(clock, SPARC64_NSEC_PER_CYC_SHIFT);
1047 1061