diff options
Diffstat (limited to 'arch/mips/sgi-ip27/ip27-timer.c')
-rw-r--r-- | arch/mips/sgi-ip27/ip27-timer.c | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c index 8c3c78c63ccd..b7b3479b6bce 100644 --- a/arch/mips/sgi-ip27/ip27-timer.c +++ b/arch/mips/sgi-ip27/ip27-timer.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #define TICK_SIZE (tick_nsec / 1000) | 40 | #define TICK_SIZE (tick_nsec / 1000) |
41 | 41 | ||
42 | static unsigned long ct_cur[NR_CPUS]; /* What counter should be at next timer irq */ | 42 | static unsigned long ct_cur[NR_CPUS]; /* What counter should be at next timer irq */ |
43 | static long last_rtc_update; /* Last time the rtc clock got updated */ | ||
44 | 43 | ||
45 | #if 0 | 44 | #if 0 |
46 | static int set_rtc_mmss(unsigned long nowtime) | 45 | static int set_rtc_mmss(unsigned long nowtime) |
@@ -113,23 +112,6 @@ again: | |||
113 | 112 | ||
114 | update_process_times(user_mode(get_irq_regs())); | 113 | update_process_times(user_mode(get_irq_regs())); |
115 | 114 | ||
116 | /* | ||
117 | * If we have an externally synchronized Linux clock, then update | ||
118 | * RTC clock accordingly every ~11 minutes. Set_rtc_mmss() has to be | ||
119 | * called as close as possible to when a second starts. | ||
120 | */ | ||
121 | if (ntp_synced() && | ||
122 | xtime.tv_sec > last_rtc_update + 660 && | ||
123 | (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && | ||
124 | (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { | ||
125 | if (rtc_mips_set_time(xtime.tv_sec) == 0) { | ||
126 | last_rtc_update = xtime.tv_sec; | ||
127 | } else { | ||
128 | last_rtc_update = xtime.tv_sec - 600; | ||
129 | /* do it again in 60 s */ | ||
130 | } | ||
131 | } | ||
132 | |||
133 | write_sequnlock(&xtime_lock); | 115 | write_sequnlock(&xtime_lock); |
134 | irq_exit(); | 116 | irq_exit(); |
135 | } | 117 | } |
@@ -141,7 +123,7 @@ again: | |||
141 | #include <asm/sn/sn0/hubio.h> | 123 | #include <asm/sn/sn0/hubio.h> |
142 | #include <asm/pci/bridge.h> | 124 | #include <asm/pci/bridge.h> |
143 | 125 | ||
144 | static __init unsigned long get_m48t35_time(void) | 126 | unsigned long read_persistent_clock(void) |
145 | { | 127 | { |
146 | unsigned int year, month, date, hour, min, sec; | 128 | unsigned int year, month, date, hour, min, sec; |
147 | struct m48t35_rtc *rtc; | 129 | struct m48t35_rtc *rtc; |
@@ -218,17 +200,23 @@ void __init plat_timer_setup(struct irqaction *irq) | |||
218 | setup_irq(irqno, &rt_irqaction); | 200 | setup_irq(irqno, &rt_irqaction); |
219 | } | 201 | } |
220 | 202 | ||
221 | static cycle_t ip27_hpt_read(void) | 203 | static cycle_t hub_rt_read(void) |
222 | { | 204 | { |
223 | return REMOTE_HUB_L(cputonasid(0), PI_RT_COUNT); | 205 | return REMOTE_HUB_L(cputonasid(0), PI_RT_COUNT); |
224 | } | 206 | } |
225 | 207 | ||
226 | void __init ip27_time_init(void) | 208 | struct clocksource ht_rt_clocksource = { |
209 | .name = "HUB", | ||
210 | .rating = 200, | ||
211 | .read = hub_rt_read, | ||
212 | .mask = CLOCKSOURCE_MASK(52), | ||
213 | .shift = 32, | ||
214 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | ||
215 | }; | ||
216 | |||
217 | void __init plat_time_init(void) | ||
227 | { | 218 | { |
228 | clocksource_mips.read = ip27_hpt_read; | 219 | clocksource_register(&ht_rt_clocksource); |
229 | mips_hpt_frequency = CYCLES_PER_SEC; | ||
230 | xtime.tv_sec = get_m48t35_time(); | ||
231 | xtime.tv_nsec = 0; | ||
232 | } | 220 | } |
233 | 221 | ||
234 | void __init cpu_time_init(void) | 222 | void __init cpu_time_init(void) |