~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to arch/tile/lib/delay.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#include <linux/module.h>
16
16
#include <linux/delay.h>
17
17
#include <linux/thread_info.h>
18
 
#include <asm/fixmap.h>
19
 
#include <hv/hypervisor.h>
 
18
#include <asm/timex.h>
20
19
 
21
20
void __udelay(unsigned long usecs)
22
21
{
23
 
        hv_nanosleep(usecs * 1000);
 
22
        if (usecs > ULONG_MAX / 1000) {
 
23
                WARN_ON_ONCE(usecs > ULONG_MAX / 1000);
 
24
                usecs = ULONG_MAX / 1000;
 
25
        }
 
26
        __ndelay(usecs * 1000);
24
27
}
25
28
EXPORT_SYMBOL(__udelay);
26
29
 
27
30
void __ndelay(unsigned long nsecs)
28
31
{
29
 
        hv_nanosleep(nsecs);
 
32
        cycles_t target = get_cycles();
 
33
        target += ns2cycles(nsecs);
 
34
        while (get_cycles() < target)
 
35
                cpu_relax();
30
36
}
31
37
EXPORT_SYMBOL(__ndelay);
32
38
 
33
 
/* FIXME: should be declared in a header somewhere. */
 
39
void __delay(unsigned long cycles)
 
40
{
 
41
        cycles_t target = get_cycles() + cycles;
 
42
        while (get_cycles() < target)
 
43
                cpu_relax();
 
44
}
34
45
EXPORT_SYMBOL(__delay);