Pull now into release branch
[pandora-kernel.git] / include / asm-blackfin / blackfin.h
1 /*
2  * Common header file for blackfin family of processors.
3  *
4  */
5
6 #ifndef _BLACKFIN_H_
7 #define _BLACKFIN_H_
8
9 #define LO(con32) ((con32) & 0xFFFF)
10 #define lo(con32) ((con32) & 0xFFFF)
11 #define HI(con32) (((con32) >> 16) & 0xFFFF)
12 #define hi(con32) (((con32) >> 16) & 0xFFFF)
13
14 #include <asm/mach/blackfin.h>
15 #include <asm/bfin-global.h>
16
17 #ifndef __ASSEMBLY__
18
19 /* SSYNC implementation for C file */
20 #if defined(ANOMALY_05000312) && defined(ANOMALY_05000244)
21 static inline void SSYNC (void)
22 {
23         int _tmp;
24         __asm__ __volatile__ ("cli %0;\n\t"
25                         "nop;nop;\n\t"
26                         "ssync;\n\t"
27                         "sti %0;\n\t"
28                         :"=d"(_tmp):);
29 }
30 #elif defined(ANOMALY_05000312) && !defined(ANOMALY_05000244)
31 static inline void SSYNC (void)
32 {
33         int _tmp;
34         __asm__ __volatile__ ("cli %0;\n\t"
35                         "ssync;\n\t"
36                         "sti %0;\n\t"
37                         :"=d"(_tmp):);
38 }
39 #elif !defined(ANOMALY_05000312) && defined(ANOMALY_05000244)
40 static inline void SSYNC (void)
41 {
42         __asm__ __volatile__ ("nop; nop; nop;\n\t"
43                         "ssync;\n\t"
44                         ::);
45 }
46 #elif !defined(ANOMALY_05000312) && !defined(ANOMALY_05000244)
47 static inline void SSYNC (void)
48 {
49         __asm__ __volatile__ ("ssync;\n\t");
50 }
51 #endif
52
53 /* CSYNC implementation for C file */
54 #if defined(ANOMALY_05000312) && defined(ANOMALY_05000244)
55 static inline void CSYNC (void)
56 {
57         int _tmp;
58         __asm__ __volatile__ ("cli %0;\n\t"
59                         "nop;nop;\n\t"
60                         "csync;\n\t"
61                         "sti %0;\n\t"
62                         :"=d"(_tmp):);
63 }
64 #elif defined(ANOMALY_05000312) && !defined(ANOMALY_05000244)
65 static inline void CSYNC (void)
66 {
67         int _tmp;
68         __asm__ __volatile__ ("cli %0;\n\t"
69                         "csync;\n\t"
70                         "sti %0;\n\t"
71                         :"=d"(_tmp):);
72 }
73 #elif !defined(ANOMALY_05000312) && defined(ANOMALY_05000244)
74 static inline void CSYNC (void)
75 {
76         __asm__ __volatile__ ("nop; nop; nop;\n\t"
77                         "ssync;\n\t"
78                         ::);
79 }
80 #elif !defined(ANOMALY_05000312) && !defined(ANOMALY_05000244)
81 static inline void CSYNC (void)
82 {
83         __asm__ __volatile__ ("csync;\n\t");
84 }
85 #endif
86
87 #else  /* __ASSEMBLY__ */
88
89 /* SSYNC & CSYNC implementations for assembly files */
90
91 #define ssync(x) SSYNC(x)
92 #define csync(x) CSYNC(x)
93
94 #if defined(ANOMALY_05000312) && defined(ANOMALY_05000244)
95 #define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch;
96 #define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch;
97
98 #elif defined(ANOMALY_05000312) && !defined(ANOMALY_05000244)
99 #define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch;
100 #define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch;
101
102 #elif !defined(ANOMALY_05000312) && defined(ANOMALY_05000244)
103 #define SSYNC(scratch) nop; nop; nop; SSYNC;
104 #define CSYNC(scratch) nop; nop; nop; CSYNC;
105
106 #elif !defined(ANOMALY_05000312) && !defined(ANOMALY_05000244)
107 #define SSYNC(scratch) SSYNC;
108 #define CSYNC(scratch) CSYNC;
109
110 #endif /* ANOMALY_05000312 & ANOMALY_05000244 handling */
111
112 #endif /* __ASSEMBLY__ */
113
114 #endif                          /* _BLACKFIN_H_ */