blob: 4d4439583396c5c263f88f577a0b6e14b22779c6 [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
Bryan Wu639f6572008-08-27 10:51:02 +08009#include <mach/anomaly.h>
Bryan Wu1394f032007-05-06 14:50:22 -070010
11#ifndef __ASSEMBLY__
12
13/* SSYNC implementation for C file */
Mike Frysinger1aafd902007-07-25 11:19:14 +080014static inline void SSYNC(void)
Bryan Wu1394f032007-05-06 14:50:22 -070015{
16 int _tmp;
Robin Getzfb51d562007-08-03 17:56:29 +080017 if (ANOMALY_05000312)
Mike Frysinger1aafd902007-07-25 11:19:14 +080018 __asm__ __volatile__(
19 "cli %0;"
20 "nop;"
21 "nop;"
22 "ssync;"
23 "sti %0;"
24 : "=d" (_tmp)
25 );
Robin Getzfb51d562007-08-03 17:56:29 +080026 else if (ANOMALY_05000244)
Mike Frysinger1aafd902007-07-25 11:19:14 +080027 __asm__ __volatile__(
28 "nop;"
29 "nop;"
30 "nop;"
31 "ssync;"
32 );
33 else
34 __asm__ __volatile__("ssync;");
Bryan Wu1394f032007-05-06 14:50:22 -070035}
Bryan Wu1394f032007-05-06 14:50:22 -070036
37/* CSYNC implementation for C file */
Mike Frysinger1aafd902007-07-25 11:19:14 +080038static inline void CSYNC(void)
Bryan Wu1394f032007-05-06 14:50:22 -070039{
40 int _tmp;
Robin Getzfb51d562007-08-03 17:56:29 +080041 if (ANOMALY_05000312)
Mike Frysinger1aafd902007-07-25 11:19:14 +080042 __asm__ __volatile__(
43 "cli %0;"
44 "nop;"
45 "nop;"
46 "csync;"
47 "sti %0;"
48 : "=d" (_tmp)
49 );
Robin Getzfb51d562007-08-03 17:56:29 +080050 else if (ANOMALY_05000244)
Mike Frysinger1aafd902007-07-25 11:19:14 +080051 __asm__ __volatile__(
52 "nop;"
53 "nop;"
54 "nop;"
Mike Frysinger35c724f2007-08-03 16:48:13 +080055 "csync;"
Mike Frysinger1aafd902007-07-25 11:19:14 +080056 );
57 else
58 __asm__ __volatile__("csync;");
Bryan Wu1394f032007-05-06 14:50:22 -070059}
Bryan Wu1394f032007-05-06 14:50:22 -070060
Robin Getz4bf3f3c2007-06-21 11:34:16 +080061#else /* __ASSEMBLY__ */
62
Mike Frysingerb5e986c2008-11-18 17:48:22 +080063#define LO(con32) ((con32) & 0xFFFF)
64#define lo(con32) ((con32) & 0xFFFF)
65#define HI(con32) (((con32) >> 16) & 0xFFFF)
66#define hi(con32) (((con32) >> 16) & 0xFFFF)
67
Robin Getz4bf3f3c2007-06-21 11:34:16 +080068/* 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 Frysingerfa48f842009-06-17 11:25:06 -040089#include <asm/mem_map.h>
Bryan Wu639f6572008-08-27 10:51:02 +080090#include <mach/blackfin.h>
Mike Frysinger36a15482007-07-25 12:01:19 +080091#include <asm/bfin-global.h>
92
Bryan Wu1394f032007-05-06 14:50:22 -070093#endif /* _BLACKFIN_H_ */