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