This source file includes following definitions.
- __cr16_delay
- __udelay
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 #include <linux/module.h>
16 #include <linux/preempt.h>
17 #include <linux/init.h>
18
19 #include <asm/delay.h>
20 #include <asm/special_insns.h>
21 #include <asm/processor.h>
22
23
24 static void __cr16_delay(unsigned long __loops)
25 {
26
27
28
29
30
31
32 u32 bclock, now, loops = __loops;
33 int cpu;
34
35 preempt_disable();
36 cpu = smp_processor_id();
37 bclock = mfctl(16);
38 for (;;) {
39 now = mfctl(16);
40 if ((now - bclock) >= loops)
41 break;
42
43
44 preempt_enable();
45 asm volatile(" nop\n");
46 barrier();
47 preempt_disable();
48
49
50
51
52
53
54
55
56
57
58 if (unlikely(cpu != smp_processor_id())) {
59 loops -= (now - bclock);
60 cpu = smp_processor_id();
61 bclock = mfctl(16);
62 }
63 }
64 preempt_enable();
65 }
66
67
68 void __udelay(unsigned long usecs)
69 {
70 __cr16_delay(usecs * ((unsigned long)boot_cpu_data.cpu_hz / 1000000UL));
71 }
72 EXPORT_SYMBOL(__udelay);