/* Returns number of ms since last clock interrupt. Note that interrupts will have been disabled by do_gettimeoffset()  */
unsigned long integrator_gettimeoffset(void)
/* Returns number of ms since last clock interrupt. Note that interrupts will have been disabled by do_gettimeoffset()  */
unsigned long integrator_gettimeoffset(void)
{
	unsigned long ticks1, ticks2, status;
	ticks2 = readl(TIMER1_VA_BASE + TIMER_VALUE) & 0xffff;
	do {
		ticks1 = ticks2;
		status = __raw_readl(VA_IC_BASE + IRQ_RAW_STATUS);
		ticks2 = readl(TIMER1_VA_BASE + TIMER_VALUE) & 0xffff;
	} while (ticks2 > ticks1);
	ticks1 = timer_reload - ticks2;
	if (status & (1 << IRQ_TIMERINT1))
		ticks1 += timer_reload;
	return TICKS2USECS(ticks1);
}