Example #1
0
unsigned long long frc_clock_ticks63(void)
{
	unsigned long t = frc_clock_ticks32();
	/* For cnt32_to_63 to work correctly we MUST call this routine
	 * at least once every half-32-bit-wraparound period - that's once
	 * every 35minutes or so - using it in sched_clock() should ensure this
	 */
	return cnt32_to_63(t);
}
Example #2
0
/*
 * MIPS sched_clock implementation.
 *
 * Because the hardware timer period is quite short and because cnt32_to_63()
 * needs to be called at least once per half period to work properly, a kernel
 * timer is set up to ensure this requirement is always met.
 *
 * Please refer to include/linux/cnt32_to_63.h, arch/arm/plat-orion/time.c and
 * arch/mips/include/asm/time.h (mips_sched_clock)
 */
unsigned long long notrace sched_clock(void)
{
	u64 cnt = cnt32_to_63(read_c0_count());

	if (cnt & 0x8000000000000000)
		cnt &= 0x7fffffffffffffff;

	return mips_sched_clock(&clocksource_mips, cnt);
}
/*
 * This is the Realview and Versatile sched_clock implementation.  This
 * has a resolution of 41.7ns, and a maximum value of about 35583 days.
 *
 * The return value is guaranteed to be monotonic in that range as
 * long as there is always less than 89 seconds between successive
 * calls to this function.
 */
unsigned long long sched_clock(void)
{
	unsigned long long v = cnt32_to_63(readl(REFCOUNTER));

	/* the <<1 gets rid of the cnt_32_to_63 top bit saving on a bic insn */
	v *= 125<<1;
	do_div(v, 3<<1);

	return v;
}
unsigned long long sched_clock(void)
{
	unsigned long long v;

	if (unlikely(!mtu0_base))
		return 0;

	v = cnt32_to_63(0xffffffff - readl(mtu0_base + MTU_VAL(1)));
	return (v * tclk2ns_scale) >> TCLK2NS_SCALE_FACTOR;
}
Example #5
0
/*
 * This is the SA11x0 sched_clock implementation.  This has
 * a resolution of 271ns, and a maximum value of 32025597s (370 days).
 *
 * The return value is guaranteed to be monotonic in that range as
 * long as there is always less than 582 seconds between successive
 * calls to this function.
 *
 *  ( * 1E9 / 3686400 => * 78125 / 288)
 */
unsigned long long sched_clock(void)
{
	unsigned long long v = cnt32_to_63(OSCR);

	/* the <<1 gets rid of the cnt_32_to_63 top bit saving on a bic insn */
	v *= 78125<<1;
	do_div(v, 288<<1);

	return v;
}
Example #6
0
unsigned long long notrace sched_clock(void)
{
	if (timer_initialized) {
		struct clocksource *cs = &clocksource_microblaze;

		cycle_t cyc = cnt32_to_63(cs->read(NULL)) & LLONG_MAX;
		return clocksource_cyc2ns(cyc, cs->mult, cs->shift);
	}
	return 0;
}
/*
 * Returns current time from boot in nsecs. It's OK for this to wrap
 * around for now, as it's just a relative time stamp.
 */
unsigned long long sched_clock(void)
{
	struct omap_32k_sync_device     *omap = thecs;
	unsigned long long v;

	if (!omap)
		return 0;

	v = cnt32_to_63(omap->cs.read(&omap->cs));
	return (v * omap->tcr2ns_scale) >> TCR2NS_SCALE_FACTOR;
}
Example #8
0
unsigned long long sched_clock(void)
{
    unsigned long long v;

    if (tclk2ns_scale == 0)
        return 0;

    v = cnt32_to_63(0xffffffff - __raw_readl(S5PV310_FRCNTO));

    return (v * tclk2ns_scale) >> TCLK2NS_SCALE_FACTOR;
}
Example #9
0
unsigned long long sched_clock(void)
{
	struct clocksource *cs = &cksrc_tcc88xx_oscr;
	unsigned long long v;

	if (!clock_valid)
		return 0ULL;

	v = cnt32_to_63(cs->read(cs));
	return (v * oscr2ns_scale) >> OSCR2NS_SCALE_FACTOR;
}
/*
 * This is the PKUnity sched_clock implementation.  This has
 * a resolution of 271ns, and a maximum value of 32025597s (370 days).
 *
 * The return value is guaranteed to be monotonic in that range as
 * long as there is always less than 582 seconds between successive
 * calls to this function.
 *
 *  ( * 1E9 / CLOCK_TICK_RATE ) -> about 2235/32
 */
unsigned long long sched_clock(void)
{
	unsigned long long v = cnt32_to_63(readl(OST_OSCR));

	/* original conservative method, but overflow frequently
	 * v *= NSEC_PER_SEC >> 12;
	 * do_div(v, CLOCK_TICK_RATE >> 12);
	 */
	v = ((v & 0x7fffffffffffffffULL) * 2235) >> 5;

	return v;
}
Example #11
0
unsigned long long notrace sched_clock(void)
{
	u64 cyc = cnt32_to_63(read_c0_count());

#ifdef CONFIG_64BIT
	/* For we have used 128bit arithmatic to cope with the overflow
	 * problem, the method to clear the top bit with an event value doesn't
	 * work now, therefore, clear it at run-time is needed.
	 */
	if (cyc & 0x8000000000000000)
		cyc &= 0x7fffffffffffffff;
#endif
	return mips_cyc2ns(cyc, mult, shift);
}
Example #12
0
static cycle_t tegra_clocksource_read(struct clocksource *cs)
{
	return cnt32_to_63(timer_readl(TIMERUS_CNTR_1US));
}
Example #13
0
unsigned long long sched_clock(void)
{
	unsigned long long v = cnt32_to_63(OSCR);
	return (v * oscr2ns_scale) >> OSCR2NS_SCALE_FACTOR;
}
Example #14
0
unsigned long long sched_clock(void)
{
	unsigned long long v = cnt32_to_63(0xffffffff - readl(TIMER0_VAL));
	return (v * tclk2ns_scale) >> TCLK2NS_SCALE_FACTOR;
}
Example #15
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;
}
Example #16
0
unsigned long long sched_clock(void)
{
	unsigned long long v = cnt32_to_63(timer_read());
	return (v * tcr2ns_scale) >> TCR2NS_SCALE_FACTOR;
}