@@ -53,6 +53,9 @@ static inline unsigned long kimage_addr_to_ra(const void *p)
void do_signal32(struct pt_regs * regs);
asmlinkage int do_sys32_sigstack(u32 u_ssptr, u32 u_ossptr, unsigned long sp);
+/* time_64.c */
+void __init time_init_early(void);
+
/* compat_audit.c */
extern unsigned int sparc32_dir_class[];
extern unsigned int sparc32_chattr_class[];
@@ -365,6 +365,7 @@ void __init start_early_boot(void)
}
current_thread_info()->cpu = cpu;
+ time_init_early();
prom_init_report();
start_kernel();
}
@@ -49,6 +49,7 @@
#include <asm/irq_regs.h>
#include "entry.h"
+#include "kernel.h"
DEFINE_SPINLOCK(rtc_lock);
@@ -177,6 +178,8 @@ static unsigned long tick_add_tick(unsigned long adj)
struct sparc64_tick_ops *tick_ops __read_mostly = &tick_operations;
EXPORT_SYMBOL(tick_ops);
+static unsigned long stick_frequency;
+
static void stick_disable_irq(void)
{
__asm__ __volatile__(
@@ -583,30 +586,25 @@ static int __init clock_init(void)
fs_initcall(clock_init);
/* This is gets the master TICK_INT timer going. */
-static unsigned long sparc64_init_timers(void)
+static unsigned long sparc64_init_timers_spitfire(void)
{
struct device_node *dp;
unsigned long freq;
+ unsigned long ver, manuf, impl;
dp = of_find_node_by_path("/");
- if (tlb_type == spitfire) {
- unsigned long ver, manuf, impl;
-
- __asm__ __volatile__ ("rdpr %%ver, %0"
- : "=&r" (ver));
- manuf = ((ver >> 48) & 0xffff);
- impl = ((ver >> 32) & 0xffff);
- if (manuf == 0x17 && impl == 0x13) {
- /* Hummingbird, aka Ultra-IIe */
- tick_ops = &hbtick_operations;
- freq = of_getintprop_default(dp, "stick-frequency", 0);
- } else {
- tick_ops = &tick_operations;
- freq = local_cpu_data().clock_tick;
- }
- } else {
- tick_ops = &stick_operations;
+
+ __asm__ __volatile__ ("rdpr %%ver, %0"
+ : "=&r" (ver));
+ manuf = ((ver >> 48) & 0xffff);
+ impl = ((ver >> 32) & 0xffff);
+ if (manuf == 0x17 && impl == 0x13) {
+ /* Hummingbird, aka Ultra-IIe */
+ tick_ops = &hbtick_operations;
freq = of_getintprop_default(dp, "stick-frequency", 0);
+ } else {
+ tick_ops = &tick_operations;
+ freq = local_cpu_data().clock_tick;
}
return freq;
@@ -775,14 +773,32 @@ static u64 clocksource_tick_read(struct clocksource *cs)
return tick_ops->get_tick();
}
+void __init time_init_early(void)
+{
+ if (tlb_type == spitfire)
+ return;
+
+ stick_frequency = prom_getint(prom_root_node, "stick-frequency");
+ tick_ops = &stick_operations;
+ timer_ticks_per_nsec_quotient =
+ clocksource_hz2mult(stick_frequency,
+ SPARC64_NSEC_PER_CYC_SHIFT);
+}
+
void __init time_init(void)
{
- unsigned long freq = sparc64_init_timers();
+ unsigned long freq;
- tb_ticks_per_usec = freq / USEC_PER_SEC;
+ if (tlb_type == spitfire) {
+ stick_frequency = sparc64_init_timers_spitfire();
- timer_ticks_per_nsec_quotient =
- clocksource_hz2mult(freq, SPARC64_NSEC_PER_CYC_SHIFT);
+ timer_ticks_per_nsec_quotient =
+ clocksource_hz2mult(stick_frequency,
+ SPARC64_NSEC_PER_CYC_SHIFT);
+ }
+ freq = stick_frequency;
+
+ tb_ticks_per_usec = freq / USEC_PER_SEC;
clocksource_tick.name = tick_ops->name;
clocksource_tick.read = clocksource_tick_read;