Ejemplo n.º 1
0
/* 
 * Sleeps for usec useconds. Safe to call in timeout loop.
 */
void __udelay (unsigned long usec)
{
	ulong tics, last_tics, delta;
	ulong time_usec = 0;

	last_tics = timer_readl(TIMER_TIMER1VALUE);
	while ( time_usec <  usec ) {

		tics = timer_readl(TIMER_TIMER1VALUE);

		if (last_tics >= tics) {
			delta = tics_to_usec(last_tics - tics);
		}
		else {
			delta = tics_to_usec(last_tics + TIMER_RELOAD - tics);
		}

		update_global_time( tics );

		if(delta > 0) {
			time_usec += delta;
			last_tics = tics;
		}
	}
}
Ejemplo n.º 2
0
static int tegra_timer_suspend(void)
{
	usec_config = timer_readl(TIMERUS_USEC_CFG);

	usec_offset += timer_readl(TIMERUS_CNTR_1US);
	usec_suspended = true;

	return 0;
}
Ejemplo n.º 3
0
static void tegra_timer_resume(void)
{
	timer_writel(usec_config, TIMERUS_USEC_CFG);

	usec_offset -= timer_readl(TIMERUS_CNTR_1US);
	usec_suspended = false;
}
Ejemplo n.º 4
0
static u32 notrace tegra_read_usec(void)
{
	u32 cyc = usec_offset;
	if (!usec_suspended)
		cyc += timer_readl(TIMERUS_CNTR_1US);
	return cyc;
}
Ejemplo n.º 5
0
unsigned long tegra3_lp2_timer_remain(void)
{
	unsigned int cpu = smp_processor_id();

	return timer_readl(cpu_local_timers[cpu] + TIMER_PCR) & 0x1ffffffful;

}
Ejemplo n.º 6
0
unsigned long tegra3_lp2_timer_remain(void)
{
	int cpu = cpu_number();

	if (cpumask_test_and_clear_cpu(cpu, &wake_timer_canceled))
		return -ETIME;

	return timer_readl(lp2_wake_timers[cpu] + TIMER_PCR) & 0x1ffffffful;
}
Ejemplo n.º 7
0
static void tegra_clocksource_resume(struct clocksource *cs)
{
    u32 usec;

    usec = timer_readl(TIMERUS_CNTR_1US);
    tegra_usec_start_time =
        rtc_readl(RTC_MILLISECONDS_REG)*1000 +
        (cycle_t)rtc_readl(RTC_SHADOW_SECONDS)*1000000;
    /*  On first time power up the usec timer will be greater than the rtc,
        since it has smaller time steps.  A negative tegra_usec_start_time is
        not desirable in this case. */
    if ((cycle_t)usec > tegra_usec_start_time)
        tegra_usec_start_time = 0;
    else
        tegra_usec_start_time -= usec;
}
Ejemplo n.º 8
0
static int tegra_timer_suspend(void)
{
	usec_config = timer_readl(TIMERUS_USEC_CFG);
	return 0;
}
Ejemplo n.º 9
0
static u32 notrace tegra_read_sched_clock(void)
{
	return timer_readl(TIMERUS_CNTR_1US);
}
Ejemplo n.º 10
0
u32 notrace tegra_read_usec_raw(void)
{
	return timer_readl(TIMERUS_CNTR_1US);
}
Ejemplo n.º 11
0
static cycle_t tegra_clocksource_read(struct clocksource *cs)
{
	return cnt32_to_63(timer_readl(TIMERUS_CNTR_1US));
}
void tegra_timer_suspend(void)
{
	usec_config = timer_readl(TIMERUS_USEC_CFG);
}
Ejemplo n.º 13
0
/*
 * Returns current time, in ms. 
 *
 * Function should be called once every (1/CONFIG_SYS_TIMER_CLK_MHZ) to
 * keep it precise.
 */
ulong get_timer_masked(void)
{
	update_global_time( timer_readl(TIMER_TIMER1VALUE) );
	return g_time_ms;
}
Ejemplo n.º 14
0
static cycle_t tegra_clocksource_read(struct clocksource *cs)
{
    return cnt32_to_63(timer_readl(TIMERUS_CNTR_1US)&TIMER_MASK) + tegra_usec_start_time;
}
Ejemplo n.º 15
0
unsigned long tegra2_lp2_timer_remain(void)
{
    return timer_readl(TIMER4_OFFSET + TIMER_PCR) & 0x1ffffffful;
}
Ejemplo n.º 16
0
void reset_timer_masked(void)
{
	g_last_tics = timer_readl(TIMER_TIMER1VALUE);
	g_time_ms = 0;
}
Ejemplo n.º 17
0
unsigned long long notrace sched_clock(void)
{
	u32 cyc = timer_readl(TIMERUS_CNTR_1US);
	return cyc_to_fixed_sched_clock(&cd, cyc, (u32)~0, SC_MULT, SC_SHIFT);
}
Ejemplo n.º 18
0
static void notrace tegra_update_sched_clock(void)
{
	u32 cyc = timer_readl(TIMERUS_CNTR_1US);
	update_sched_clock(&cd, cyc, (u32)~0);
}
Ejemplo n.º 19
0
unsigned long tegra3_lp2_timer_remain(void)
{
	int cpu = cpu_number();

	return timer_readl(lp2_wake_timers[cpu] + TIMER_PCR) & 0x1ffffffful;
}