--- zzzz-none-000/linux-2.6.19.2/arch/mips/sibyte/bcm1480/time.c 2007-01-10 19:10:37.000000000 +0000 +++ davinci-8020-5505/linux-2.6.19.2/arch/mips/sibyte/bcm1480/time.c 2007-01-11 07:38:19.000000000 +0000 @@ -47,12 +47,6 @@ #define IMR_IP3_VAL K_BCM1480_INT_MAP_I1 #define IMR_IP4_VAL K_BCM1480_INT_MAP_I2 -#ifdef CONFIG_SIMULATION -#define BCM1480_HPT_VALUE 50000 -#else -#define BCM1480_HPT_VALUE 1000000 -#endif - extern int bcm1480_steal_irq(int irq); void bcm1480_time_init(void) @@ -65,6 +59,11 @@ BUG(); } + if (!cpu) { + /* Use our own gettimeoffset() routine */ + do_gettimeoffset = bcm1480_gettimeoffset; + } + bcm1480_mask_irq(cpu, irq); /* Map the timer interrupt to ip[4] of this cpu */ @@ -75,7 +74,11 @@ /* Disable the timer and set up the count */ __raw_writeq(0, IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_CFG))); __raw_writeq( - BCM1480_HPT_VALUE/HZ +#ifndef CONFIG_SIMULATION + 1000000/HZ +#else + 50000/HZ +#endif , IOADDR(A_SCD_TIMER_REGISTER(cpu, R_SCD_TIMER_INIT))); /* Set the timer running */ @@ -119,16 +122,16 @@ } } -static unsigned int bcm1480_hpt_read(void) +/* + * We use our own do_gettimeoffset() instead of the generic one, + * because the generic one does not work for SMP case. + * In addition, since we use general timer 0 for system time, + * we can get accurate intra-jiffy offset without calibration. + */ +unsigned long bcm1480_gettimeoffset(void) { - /* We assume this function is called xtime_lock held. */ unsigned long count = __raw_readq(IOADDR(A_SCD_TIMER_REGISTER(0, R_SCD_TIMER_CNT))); - return (jiffies + 1) * (BCM1480_HPT_VALUE / HZ) - count; -} -void __init bcm1480_hpt_setup(void) -{ - mips_hpt_read = bcm1480_hpt_read; - mips_hpt_frequency = BCM1480_HPT_VALUE; + return 1000000/HZ - count; }