diff -Naur uClinux-dist.ref/linux-2.4.x/arch/m68knommu/kernel/time.c uClinux-dist/linux-2.4.x/arch/m68knommu/kernel/time.c --- uClinux-dist.ref/linux-2.4.x/arch/m68knommu/kernel/time.c Wed Nov 21 23:59:20 2001 +++ uClinux-dist/linux-2.4.x/arch/m68knommu/kernel/time.c Mon Mar 25 20:13:51 2002 @@ -130,19 +130,15 @@ */ void do_gettimeofday(struct timeval *tv) { -#if 0 /* DAVIDM later if possible */ - extern volatile unsigned long lost_ticks; -#endif + extern volatile unsigned long wall_jiffies; unsigned long flags; unsigned long usec, sec, lost; read_lock_irqsave(&xtime_lock, flags); usec = mach_gettimeoffset ? mach_gettimeoffset() : 0; -#if 0 /* DAVIDM later if possible */ - lost = lost_ticks; + lost = jiffies - wall_jiffies; if (lost) usec += lost * (1000000/HZ); -#endif sec = xtime.tv_sec; usec += xtime.tv_usec; read_unlock_irqrestore(&xtime_lock, flags); diff -Naur uClinux-dist.ref/linux-2.4.x/arch/m68knommu/platform/68VZ328/ucdimm/config.c uClinux-dist/linux-2.4.x/arch/m68knommu/platform/68VZ328/ucdimm/config.c --- uClinux-dist.ref/linux-2.4.x/arch/m68knommu/platform/68VZ328/ucdimm/config.c Sun Mar 10 00:37:48 2002 +++ uClinux-dist/linux-2.4.x/arch/m68knommu/platform/68VZ328/ucdimm/config.c Mon Mar 25 19:57:18 2002 @@ -25,27 +25,47 @@ #include "bootstd.h" #include -void BSP_sched_init(void (*timer_routine)(int, void *, struct pt_regs *)) +#define CLOCK_COMPARE (32768/HZ) + +static void BSP_sched_init(void (*timer_routine)(int, void *, struct pt_regs *)) { - /* Restart mode, Enable int, 32KHz, Enable timer */ - TCTL = TCTL_OM | TCTL_IRQEN | TCTL_CLKSOURCE_32KHZ | TCTL_TEN; - /* Set prescaler (Divide 32KHz by 32)*/ - TPRER = 31; - /* Set compare register 32Khz / 32 / 10 = 100 */ - TCMP = 10; + /* disable timer 1 */ + TCTL = 0; + + /* set ISR */ + request_irq(TMR_IRQ_NUM, timer_routine, IRQ_FLG_LOCK, "timer", NULL); - request_irq(TMR_IRQ_NUM, timer_routine, IRQ_FLG_LOCK, "timer", NULL); + /* Restart mode, Enable int, 32KHz */ + TCTL = TCTL_OM | TCTL_IRQEN | TCTL_CLKSOURCE_32KHZ; + TPRER = 0; + TCMP = CLOCK_COMPARE-1; + + /* Enable timer 1 */ + TCTL |= TCTL_TEN; } -void BSP_tick(void) +static void BSP_tick(void) { /* Reset Timer1 */ TSTAT &= 0; } -unsigned long BSP_gettimeoffset (void) +static unsigned long BSP_gettimeoffset(void) { - return 0; + unsigned long ticks, offset = 0; + + ticks = TCN; + + if (ticks > (CLOCK_COMPARE>>1)) { + /* check for pending interrupt */ + if (ISR & (1<