blob: 984b74f0a2ecdf1b76f713f9a597d9c48fb40cae [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
2 * Common header file for blackfin family of processors.
3 *
4 */
5
6#ifndef _BLACKFIN_H_
7#define _BLACKFIN_H_
8
Mike Frysingerdf30b112007-06-11 17:47:27 +08009#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
Mike Frysinger36a15482007-07-25 12:01:19 +080014#include <asm/mach/anomaly.h>
Bryan Wu1394f032007-05-06 14:50:22 -070015
16#ifndef __ASSEMBLY__
17
18/* SSYNC implementation for C file */
Mike Frysinger1aafd902007-07-25 11:19:14 +080019static inline void SSYNC(void)
Bryan Wu1394f032007-05-06 14:50:22 -070020{
21 int _tmp;
Robin Getzfb51d562007-08-03 17:56:29 +080022 if (ANOMALY_05000312)
Mike Frysinger1aafd902007-07-25 11:19:14 +080023 __asm__ __volatile__(
24 "cli %0;"
25 "nop;"
26 "nop;"
27 "ssync;"
28 "sti %0;"
29 : "=d" (_tmp)
30 );
Robin Getzfb51d562007-08-03 17:56:29 +080031 else if (ANOMALY_05000244)
Mike Frysinger1aafd902007-07-25 11:19:14 +080032 __asm__ __volatile__(
33 "nop;"
34 "nop;"
35 "nop;"
36 "ssync;"
37 );
38 else
39 __asm__ __volatile__("ssync;");
Bryan Wu1394f032007-05-06 14:50:22 -070040}
Bryan Wu1394f032007-05-06 14:50:22 -070041
42/* CSYNC implementation for C file */
Mike Frysinger1aafd902007-07-25 11:19:14 +080043static inline void CSYNC(void)
Bryan Wu1394f032007-05-06 14:50:22 -070044{
45 int _tmp;
Robin Getzfb51d562007-08-03 17:56:29 +080046 if (ANOMALY_05000312)
Mike Frysinger1aafd902007-07-25 11:19:14 +080047 __asm__ __volatile__(
48 "cli %0;"
49 "nop;"
50 "nop;"
51 "csync;"
52 "sti %0;"
53 : "=d" (_tmp)
54 );
Robin Getzfb51d562007-08-03 17:56:29 +080055 else if (ANOMALY_05000244)
Mike Frysinger1aafd902007-07-25 11:19:14 +080056 __asm__ __volatile__(
57 "nop;"
58 "nop;"
59 "nop;"
Mike Frysinger35c724f2007-08-03 16:48:13 +080060 "csync;"
Mike Frysinger1aafd902007-07-25 11:19:14 +080061 );
62 else
63 __asm__ __volatile__("csync;");
Bryan Wu1394f032007-05-06 14:50:22 -070064}
Bryan Wu1394f032007-05-06 14:50:22 -070065
Robin Getz4bf3f3c2007-06-21 11:34:16 +080066#else /* __ASSEMBLY__ */
67
68/* SSYNC & CSYNC implementations for assembly files */
69
70#define ssync(x) SSYNC(x)
71#define csync(x) CSYNC(x)
72
Robin Getzfb51d562007-08-03 17:56:29 +080073#if ANOMALY_05000312
Robin Getz4bf3f3c2007-06-21 11:34:16 +080074#define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch;
75#define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch;
76
Robin Getzfb51d562007-08-03 17:56:29 +080077#elif ANOMALY_05000244
Robin Getz4bf3f3c2007-06-21 11:34:16 +080078#define SSYNC(scratch) nop; nop; nop; SSYNC;
79#define CSYNC(scratch) nop; nop; nop; CSYNC;
80
Robin Getzfb51d562007-08-03 17:56:29 +080081#else
Robin Getz4bf3f3c2007-06-21 11:34:16 +080082#define SSYNC(scratch) SSYNC;
83#define CSYNC(scratch) CSYNC;
84
85#endif /* ANOMALY_05000312 & ANOMALY_05000244 handling */
86
Bryan Wu1394f032007-05-06 14:50:22 -070087#endif /* __ASSEMBLY__ */
88
Mike Frysinger36a15482007-07-25 12:01:19 +080089#include <asm/mach/blackfin.h>
90#include <asm/bfin-global.h>
91
Bryan Wu1394f032007-05-06 14:50:22 -070092#endif /* _BLACKFIN_H_ */