Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1 | /* |
Robin Getz | 96f1050 | 2009-09-24 14:11:24 +0000 | [diff] [blame] | 2 | * Common header file for Blackfin family of processors. |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 3 | * |
Mike Frysinger | 9695645 | 2011-06-17 17:54:40 -0400 | [diff] [blame^] | 4 | * Copyright 2004-2009 Analog Devices Inc. |
5 | * | ||||
6 | * Licensed under the GPL-2 or later. | ||||
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 7 | */ |
8 | |||||
9 | #ifndef _BLACKFIN_H_ | ||||
10 | #define _BLACKFIN_H_ | ||||
11 | |||||
Bryan Wu | 639f657 | 2008-08-27 10:51:02 +0800 | [diff] [blame] | 12 | #include <mach/anomaly.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 13 | |
14 | #ifndef __ASSEMBLY__ | ||||
15 | |||||
16 | /* SSYNC implementation for C file */ | ||||
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 17 | static inline void SSYNC(void) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 18 | { |
19 | int _tmp; | ||||
Robin Getz | fb51d56 | 2007-08-03 17:56:29 +0800 | [diff] [blame] | 20 | if (ANOMALY_05000312) |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 21 | __asm__ __volatile__( |
22 | "cli %0;" | ||||
23 | "nop;" | ||||
24 | "nop;" | ||||
25 | "ssync;" | ||||
26 | "sti %0;" | ||||
27 | : "=d" (_tmp) | ||||
28 | ); | ||||
Robin Getz | fb51d56 | 2007-08-03 17:56:29 +0800 | [diff] [blame] | 29 | else if (ANOMALY_05000244) |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 30 | __asm__ __volatile__( |
31 | "nop;" | ||||
32 | "nop;" | ||||
33 | "nop;" | ||||
34 | "ssync;" | ||||
35 | ); | ||||
36 | else | ||||
37 | __asm__ __volatile__("ssync;"); | ||||
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 38 | } |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 39 | |
40 | /* CSYNC implementation for C file */ | ||||
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 41 | static inline void CSYNC(void) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 42 | { |
43 | int _tmp; | ||||
Robin Getz | fb51d56 | 2007-08-03 17:56:29 +0800 | [diff] [blame] | 44 | if (ANOMALY_05000312) |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 45 | __asm__ __volatile__( |
46 | "cli %0;" | ||||
47 | "nop;" | ||||
48 | "nop;" | ||||
49 | "csync;" | ||||
50 | "sti %0;" | ||||
51 | : "=d" (_tmp) | ||||
52 | ); | ||||
Robin Getz | fb51d56 | 2007-08-03 17:56:29 +0800 | [diff] [blame] | 53 | else if (ANOMALY_05000244) |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 54 | __asm__ __volatile__( |
55 | "nop;" | ||||
56 | "nop;" | ||||
57 | "nop;" | ||||
Mike Frysinger | 35c724f | 2007-08-03 16:48:13 +0800 | [diff] [blame] | 58 | "csync;" |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 59 | ); |
60 | else | ||||
61 | __asm__ __volatile__("csync;"); | ||||
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 62 | } |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 63 | |
Robin Getz | 4bf3f3c | 2007-06-21 11:34:16 +0800 | [diff] [blame] | 64 | #else /* __ASSEMBLY__ */ |
65 | |||||
Mike Frysinger | b5e986c | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 66 | #define LO(con32) ((con32) & 0xFFFF) |
67 | #define lo(con32) ((con32) & 0xFFFF) | ||||
68 | #define HI(con32) (((con32) >> 16) & 0xFFFF) | ||||
69 | #define hi(con32) (((con32) >> 16) & 0xFFFF) | ||||
70 | |||||
Robin Getz | 4bf3f3c | 2007-06-21 11:34:16 +0800 | [diff] [blame] | 71 | /* SSYNC & CSYNC implementations for assembly files */ |
72 | |||||
73 | #define ssync(x) SSYNC(x) | ||||
74 | #define csync(x) CSYNC(x) | ||||
75 | |||||
Robin Getz | fb51d56 | 2007-08-03 17:56:29 +0800 | [diff] [blame] | 76 | #if ANOMALY_05000312 |
Robin Getz | 4bf3f3c | 2007-06-21 11:34:16 +0800 | [diff] [blame] | 77 | #define SSYNC(scratch) cli scratch; nop; nop; SSYNC; sti scratch; |
78 | #define CSYNC(scratch) cli scratch; nop; nop; CSYNC; sti scratch; | ||||
79 | |||||
Robin Getz | fb51d56 | 2007-08-03 17:56:29 +0800 | [diff] [blame] | 80 | #elif ANOMALY_05000244 |
Robin Getz | 4bf3f3c | 2007-06-21 11:34:16 +0800 | [diff] [blame] | 81 | #define SSYNC(scratch) nop; nop; nop; SSYNC; |
82 | #define CSYNC(scratch) nop; nop; nop; CSYNC; | ||||
83 | |||||
Robin Getz | fb51d56 | 2007-08-03 17:56:29 +0800 | [diff] [blame] | 84 | #else |
Robin Getz | 4bf3f3c | 2007-06-21 11:34:16 +0800 | [diff] [blame] | 85 | #define SSYNC(scratch) SSYNC; |
86 | #define CSYNC(scratch) CSYNC; | ||||
87 | |||||
88 | #endif /* ANOMALY_05000312 & ANOMALY_05000244 handling */ | ||||
89 | |||||
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 90 | #endif /* __ASSEMBLY__ */ |
91 | |||||
Mike Frysinger | fa48f84 | 2009-06-17 11:25:06 -0400 | [diff] [blame] | 92 | #include <asm/mem_map.h> |
Bryan Wu | 639f657 | 2008-08-27 10:51:02 +0800 | [diff] [blame] | 93 | #include <mach/blackfin.h> |
Mike Frysinger | 36a1548 | 2007-07-25 12:01:19 +0800 | [diff] [blame] | 94 | #include <asm/bfin-global.h> |
95 | |||||
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 96 | #endif /* _BLACKFIN_H_ */ |