diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1998-08-25 09:12:35 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1998-08-25 09:12:35 +0000 |
commit | c7fc24dc4420057f103afe8fc64524ebc25c5d37 (patch) | |
tree | 3682407a599b8f9f03fc096298134cafba1c9b2f /arch/ppc/kernel/time.c | |
parent | 1d793fade8b063fde3cf275bf1a5c2d381292cd9 (diff) |
o Merge with Linux 2.1.116.
o New Newport console code.
o New G364 console code.
Diffstat (limited to 'arch/ppc/kernel/time.c')
-rw-r--r-- | arch/ppc/kernel/time.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/arch/ppc/kernel/time.c b/arch/ppc/kernel/time.c index 5a1063d4e..0857c2633 100644 --- a/arch/ppc/kernel/time.c +++ b/arch/ppc/kernel/time.c @@ -1,5 +1,5 @@ /* - * $Id: time.c,v 1.28 1998/04/07 18:49:49 cort Exp $ + * $Id: time.c,v 1.35 1998/07/24 11:05:47 geert Exp $ * Common time routines among all ppc machines. * * Written by Cort Dougan (cort@cs.nmt.edu) to merge @@ -31,6 +31,7 @@ #include <linux/kernel_stat.h> #include <linux/mc146818rtc.h> #include <linux/time.h> +#include <linux/init.h> #include <asm/segment.h> #include <asm/io.h> @@ -76,7 +77,6 @@ void timer_interrupt(struct pt_regs * regs) * this hack should leave for a better solution -- Cort */ unsigned dcache_locked = unlock_dcache(); -if ( smp_processor_id() ) printk("SMP 1: timer intr\n"); hardirq_enter(cpu); while ((dval = get_dec()) < 0) { @@ -95,10 +95,12 @@ if ( smp_processor_id() ) printk("SMP 1: timer intr\n"); * update the rtc when needed */ if ( xtime.tv_sec > last_rtc_update + 660 ) + { if (set_rtc_time(xtime.tv_sec) == 0) last_rtc_update = xtime.tv_sec; else last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ + } } } #ifdef __SMP__ @@ -116,6 +118,7 @@ if ( smp_processor_id() ) printk("SMP 1: timer intr\n"); */ void timebase_interrupt(int irq, void * dev, struct pt_regs * regs) { + printk("timebase_interrupt()\n"); } /* The RTC on the MPC8xx is an internal register. @@ -168,8 +171,7 @@ void do_settimeofday(struct timeval *tv) } -void -time_init(void) +__initfunc(void time_init(void)) { #ifndef CONFIG_MBX if ((_get_PVR() >> 16) == 1) { @@ -181,8 +183,7 @@ time_init(void) switch (_machine) { case _MACH_Pmac: - /* can't call pmac_get_rtc_time() yet, - because via-cuda isn't initialized yet. */ + xtime.tv_sec = pmac_get_rtc_time(); if ( (_get_PVR() >> 16) != 1 && (!smp_processor_id()) ) pmac_calibrate_decr(); if ( !smp_processor_id() ) @@ -200,8 +201,7 @@ time_init(void) prep_calibrate_decr(); set_rtc_time = prep_set_rtc_time; break; -/* ifdef APUS specific stuff until the merge is completed. -jskov */ -#ifdef CONFIG_APUS +#ifdef CONFIG_APUS case _MACH_apus: { xtime.tv_sec = apus_get_rtc_time(); @@ -209,11 +209,10 @@ time_init(void) set_rtc_time = apus_set_rtc_time; break; } -#endif +#endif } xtime.tv_usec = 0; - set_dec(decrementer_count); -#else +#else /* CONFIG_MBX */ mbx_calibrate_decr(); set_rtc_time = mbx_set_rtc_time; @@ -249,7 +248,7 @@ time_init(void) xtime.tv_usec = 0; #endif /* CONFIG_MBX */ - + set_dec(decrementer_count); /* mark the rtc/on-chip timer as in sync * so we don't update right away */ @@ -265,7 +264,7 @@ time_init(void) */ int calibrate_done = 0; volatile int *done_ptr = &calibrate_done; -void prep_calibrate_decr(void) +__initfunc(void prep_calibrate_decr(void)) { unsigned long flags; @@ -308,7 +307,7 @@ void prep_calibrate_decr(void) free_irq( 0, NULL); } -void prep_calibrate_decr_handler(int irq, void *dev, struct pt_regs * regs) +__initfunc(void prep_calibrate_decr_handler(int irq, void *dev, struct pt_regs * regs)) { unsigned long freq, divisor; static unsigned long t1 = 0, t2 = 0; @@ -337,8 +336,9 @@ void prep_calibrate_decr_handler(int irq, void *dev, struct pt_regs * regs) * sixteen, or external oscillator divided by four. Currently, we only * support the MBX, which is system clock divided by sixteen. */ -void mbx_calibrate_decr(void) +__initfunc(void mbx_calibrate_decr(void)) { + bd_t *binfo = (bd_t *)&res; int freq, fp, divisor; if ((((immap_t *)MBX_IMAP_ADDR)->im_clkrst.car_sccr & 0x02000000) == 0) @@ -348,7 +348,7 @@ void mbx_calibrate_decr(void) * as MHz. The value 'fp' is the number of decrementer ticks * per second. */ - /*fp = (mbx_board_info.bi_intfreq * 1000000) / 16;*/ + fp = (binfo->bi_intfreq * 1000000) / 16; freq = fp*60; /* try to make freq/1e6 an integer */ divisor = 60; printk("time_init: decrementer frequency = %d/%d\n", freq, divisor); @@ -432,3 +432,6 @@ void to_tm(int tim, struct rtc_time * tm) /* Days are what is left over (+1) from all that. */ tm->tm_mday = day + 1; } + + + |